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

Bug in edge enumerator

108 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: 733
Registered: ‎03-21-2011
Message 2 of 2 (59 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
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!