TopoDS_Wire to TopoDS_Edge

Hi all,

I have many edges that are connected as a wire, and I am want to convert it to a geom_curve type, or convert it to TopoDS_Edge type then convert it to a Geom_Curve. How should I do it?

many thnks!

DELORME's picture


One solution is to discretize your edges, then interpolate the points with a BSpline, so finally you get a Geom_Curve.
You can take a look at the classes GCPnts_UniformAbscissa, GeomAPI_PointsToBSpline for that purpose.

François Lauzon's picture

Another way, if you have a wire that doesn't have discontinuity, is to approximate it using OCC algorithm:

// make your wire looks like a curve to other algorithm
BRepAdaptor_CompCurve wireAdaptor(aWire);
Handle_BRepAdaptor_HCompCurve curve=new BRepAdaptor_HCompCurve(wireAdaptor);

// approximate the curve using a tolerance
Approx_Curve3d approx(curve,0.001,GeomAbs_C2,200,12);
if (approx.IsDone() && approx.HasResult()) {
// have the result
Handle_Geom_Curve anApproximatedCurve=approx.Curve();

You should look at cdl files for each of the class to know more about the parameters and limitations.

Good Luck,

RicePotato2006's picture

WOW guys,

Both of them works very well, Thanks a lot.