AnsweredAssumed Answered

questions about getsketchregions and outloop

Question asked by Moon Wang on Sep 10, 2017
Latest reply on Sep 28, 2017 by Jacob Corder

hello,

 

I get the sketch by 3DIntersections.when I used  getsketchregions ,it shows that the SketchRegionCount is 2,I doubt how it allocate regions(I thought the regioncount is 1),however when I get the firstloop and get the loop‘s edgecout ,the edgecount is 1,and OuterLoop isTRUE.So,the squence of loop is also a puzzle to me .who can help me,thank you

my code is as below.

.......

swSketch = (ISketch)swFeature.GetSpecificFeature2();

.......

if ((swSketch != null))

                    {

                        regionCount = swSketch.GetSketchRegionCount();

                        vSkRegions = (object[])swSketch.GetSketchRegions();

                        for (i = vSkRegions.GetLowerBound(0); i <= vSkRegions.GetUpperBound(0); i++)

                        {

                            skRegion = (SketchRegion)vSkRegions[i];

 

                            if ((skRegion != null))

                            {

                                j = 0;

                                myLoop = skRegion.GetFirstLoop();

                                while ((myLoop != null))

                                {

                                    edgeCount = myLoop.GetEdgeCount();

                                    vertexCount = myLoop.GetVertexCount();

                                    outer = myLoop.IsOuter();

                                    if (outer == false)

                                    {

                                        strOuter = "Inner loop";

                                    }

                                    else

                                    {

                                        strOuter = "Outer loop";

                                    }

                                    vEdges = (object[])myLoop.GetEdges();

                                    for (k = vEdges.GetLowerBound(0); k <= vEdges.GetUpperBound(0); k++)

                                    {

                                        myEdge = (Edge)vEdges[k];

                                        if ((myEdge != null))

                                        {

                                            test1 = (Vertex)myEdge.GetStartVertex();

                                            test2 = (Vertex)myEdge.GetEndVertex();

                                            //vPoint = (double[])test1.GetPoint();

                                         }

                                    }

                                    vVertices = (object[])myLoop.GetVertices();

                                    for (k = vVertices.GetLowerBound(0); k <= vVertices.GetUpperBound(0); k++)

                                    {

                                        myVertex = (Vertex)vVertices[k];

                                        if ((myVertex != null))

                                        {

                                            vPoint = myVertex.GetPoint();

                                            X = vPoint[0];

                                            Y = vPoint[1];

                                            Z = vPoint[2];

                                  

                                        }

                                    }

                                    myLoop = (Loop2)myLoop.GetNext();

                                    j = j + 1;

                                }

Outcomes