
Mon, 02/11/2008 - 22:18
I am trying to copy a TopoDS_Edge, here's the code I am using:
TopoDS_Edge *theEdge = occ_curve->get_TopoDS_Edge();
TopoDS_Shape newShape = theEdge->EmptyCopied();
TopoDS_Edge newEdge = TopoDS::Edge(newShape);
TopExp_Explorer Ex;
for (Ex.Init(newEdge, TopAbs_VERTEX); Ex.More(); Ex.Next())
populate_topology_bridge(TopoDS::Vertex(Ex.Current()));
It directly jumped over the last line, showing newEdge doesn't have vertices.
How ever, if I replace the newEdge in the "for" loop with "theEdge", it goes into the "populate" code twice.
Has someone see this error? Is there a fix for it pending post? or Should I use a different call or should I have to copy the vertices first seperately?
Thank you for your help in advance!
Jane
Mon, 02/11/2008 - 22:29
EmptyCopied is the wrong function to use :
"Returns a copy of the TShape with no sub-shapes"
I remember using an OCC method for copying a shape a very long time ago, but I faced some problems.
The hack workaround I found was to Write and ReRead the shape to a stream (suing BRepTools::Write / ::Read )
Stephane
Mon, 02/11/2008 - 22:33
If I remember correctly, the copy method I used was BRepBuilderAPI_Copy.
No idea if it works better now, but you can give it a try.
Stephane
Mon, 02/11/2008 - 22:41
Thanks, Stephane! I'll definitely try it!
Jane