4 Replies Latest reply: Oct 21, 2010 9:08 AM by btemp RSS

    layers

    deerowbear Community Member

      Hi I am currently drawing a circ, but the circle currently isn't coming out on the correct layer, whatever the layer the user currently has selected is the where the circle gets placed. How do I get the circle to go on the very top layer? For the sAIShapeConstruction object I don't see a parameter to set the circle on a particuliar layer like when drawing new art "kPlaceInsideOnTop"....any help would be appreciated. Thanks!

       

      const AIBoolean reversed = false;

      const AIRealRect circ = {this->fEndPoint.h - 6, this->fEndPoint.v - 6, this->fEndPoint.h + 6, this->fEndPoint.v + 6};

      error = sAIShapeConstruction->NewCircumscribedOval(circ.top, circ.left, circ.bottom, circ.right, reversed, &ai_circle);

      //give the path a style no stroke white fill

      error = sAIPathStyle->GetCurrentPathStyle( &pathStyle, &pathStyleMap, &advStrokeParams );

      pathStyle.fillPaint = true;

       

      pathStyle.fill.color.kind = kGrayColor;

      pathStyle.fill.color.c.g.gray = kAIRealZero;

      pathStyle.strokePaint = false;

      error = sAIPathStyle->SetPathStyle( ai_circle, &pathStyle );

       

       

        • 1. Re: layers
          A. Patterson Community Member

          Use AIArtSuite::ReorderArt() on your circle. I think just this:

           

          sArt->ReorderArt(ai_circle, kPlaceAboveAll, 0);

           

          should do it. Failing that, you might need to get the handle to the top layer (you can iterator, take a look at AILayer.h) and then get its first child (AIArtSuite::GetFirstArtOfLayer) and like so:

           

          AIArtHandle layerGroup 0;

          sArt->GetFirstArtOfLayer(layerHandle, &layerGroup);

          sArt->ReorderArt(ai_circle, kPlaceInsideOnTop, layerGroup);

          • 2. Re: layers
            deerowbear Community Member

            sAIArt->ReorderArt(ai_circle, kPlaceAboveAll, 0);

             

            I used this after I drew the circle, but the illustrator crashes. I may try investigation:

            AIAPI AIErr(*

            GetFirstLayer )(AILayerHandle *first)

            AIAPI AIErr(*

            SetCurrentLayer )(AILayerHandle layer)

            • 3. Re: layers
              deerowbear Community Member

              Actually your code works, I of course just checked it on a "funky" file... I used this code and it did the same thing it crashed.

               

              AILayerHandle top_layer;

              sAILayer->GetNthLayer(0,&top_layer);

              sAILayer->SetCurrentLayer(top_layer);

               

              Either way, your code and the above code seem to work except on one file...thank you for the help.

              • 4. Re: layers
                btemp Community Member

                The SetInsertionPoint function in the AIArt suite lets you set the insertion point for new art objects. Setting that to where you want before you start drawing would be another way.