.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug in edge enumerator

1 REPLY 1
Reply
Message 1 of 2
pfk
Enthusiast
264 Views, 1 Reply

Bug in edge enumerator

Hi

 

There seems to be some issues with the Brep edge enumerator.  Firstly, after 4 edges it is not returning Current to null.

 

But more importantly, the last edge of the loop appears to have vertex1 and vertex2 flipped - so the last edge is pointing in the opposite direction.  Is this a know issue?  Does it happen with every edge?

 

Thanks

1 REPLY 1
Message 2 of 2
Balaji_Ram
in reply to: pfk

Hi,

 

After the edge enumerator is obtained, the "MoveNext" method is to be used. The return value of this method will position the enumerator at the begin and indicate if it is safe to continue iterating further. The other way is to use the "foreach" to iterate.

 

Here is a sample code :

 

using (BrepEdgeEnumerator brepEdgeEnum = brep.Edges.GetEnumerator())
{
    bool canContinue = brepEdgeEnum.MoveNext();
    while (canContinue)
    {
        Edge edge = brepEdgeEnum.Current;

        Autodesk.AutoCAD.BoundaryRepresentation.Vertex v1 = edge.Vertex1;
        Point3d pt1 = v1.Point;
        ed.WriteMessage("\n --> Vertex 1 : {0}", pt1);

        Autodesk.AutoCAD.BoundaryRepresentation.Vertex v2 = edge.Vertex2;
        Point3d pt2 = v2.Point;
        ed.WriteMessage("\n --> Vertex 2 : {0}", pt2);

        canContinue = brepEdgeEnum.MoveNext();
    }
}

 

About the last edge flipping its vertices - No, this is not a known behavior. It might be specific to the entity on which you are using BRep. Can you please try on a simple planar surface created in AutoCAD and is the same behavior reproducible ?

 

Regards,

 



Balaji
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost