EmptyCopied() for TopoDS_Edge didn't copy vertices

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

Stephane Routelous's picture

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

Stephane Routelous's picture

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

Jane Hu's picture

Thanks, Stephane! I'll definitely try it!

Jane