Thu, 09/03/2009 - 20:46
Forums:
Hello.
I have a TopoDS_Face which I made with the BRepBuilderAPI_MakePolygon.Its always a triangle. Later I need the XYZ values from the 3 points inside the face. If I use TopExp_Explorer casVertexExplorer(casFace , TopAbs_VERTEX) I get 6 points. Thats not what I want but its reasonable.
Now my question: Will I always get the vertex in this order 122331? Than I can dump the double points... Or better: Is there the possibility to get only the three original vertex and not the vertex by edges?
Thanks
Regards Simon
Fri, 09/04/2009 - 11:48
Hi Simon,
I also faced this issue with pythonOCC. This is how I fixed it: the Handle_Standard_Transient class (and all classes that inherit from it) has a method named HashCode (have a look to Handle_Standard_Transient.hxx). It returns an integer which actually is the (u)id of the object.
In your TopExp_Explorer loop, you can add a check over the hashcode to see if the current TopAbs_Vertex was already returned. At the end of the loop, you should only get the 3 vertices of the face.
Regards,
Thomas
Fri, 09/04/2009 - 13:54
Thanks! This is very handy, also in other situations!
Regards
Simon