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 (not verified) Tue, 03/07/2006 - 13:00
Hi,
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 (not verified) Tue, 03/07/2006 - 17:24
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.
Tue, 03/07/2006 - 13:00
Hi,
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.
Tue, 03/07/2006 - 17:24
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,
Francois.
Sat, 03/11/2006 - 14:25
WOW guys,
Both of them works very well, Thanks a lot.