Active Contributor pfk
Active Contributor
Posts: 35
Registered: ‎02-11-2013
Message 1 of 2 (111 Views)

Bug in edge enumerator

111 Views, 1 Replies
09-12-2013 06:00 PM



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?



ADN Support Specialist
Posts: 749
Registered: ‎03-21-2011
Message 2 of 2 (62 Views)

Re: Bug in edge enumerator

09-24-2013 11:43 PM in reply to: pfk



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 ?




Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.