Wed, 06/19/2002 - 17:12
Forums:
Hi,
I used the HLRBRep_Algo to create a 2D view of my shapes. I was able to get the single edges (TopoDS_Edge) from the HLR. Now I need to know the geometric type of the edges, if this edge is a line, a circle and so on. How can I do this? I think all the edges should be Geom2d_Curve or Geom_Curve type. I tried the Brep_Tool::Curve and Brep_Tool::CurveOnSurface, but none of them did work?
Does anybody know how to obtain the geometric type from the HLR edges?
Thanks for any advice,
Stefan Waldner
Wed, 06/19/2002 - 17:52
hello
you can do this with methods of the package GeomAbs.
This package provides method to control the type of a curve or a surface.
good luck
Jerome
Thu, 06/20/2002 - 08:58
Hi,
thanks for responses.
The Brep_Tool::Curve should work, if my TopoDS_Edge is a Geom_Curve. Unfortunately it is a Geom2d_Curve and I must use the Brep_Tool::CurveOnSurface, which needs a TopoDS_Face, too. But I don't know the face the curve should be on. Is there a way to get the face from HLR Algo?
Or how can I use the Geom_Abs package?
Thanks,
Stefan
Thu, 06/20/2002 - 09:37
hello
If you have a geom2d_Curve you can use Geom2dAdaptor::GetType method.
The result is an enumeration CurveType from Geom_Abs. With this method you know if the curve is Line, Circle,Ellipse, Hyperbola, Parabola,BezierCurve, BSplineCurve,OtherCurve.
For more details you can read the cdl file of GeomAbs and Geom2dAdaptor package.
Wed, 06/19/2002 - 18:12
BRep_Tool::Curve should work
Thu, 06/20/2002 - 09:40
Hi,
finally I found a way to get my curves from the edges. Here is the code strip, perhaps it helps anyone in the future:
Handle(Geom2d_Curve) actCurve;
BRep_ListIteratorOfListOfCurveRepresentation itcr((*((Handle(BRep_TEdge)*)&actEdge.TShape()))->ChangeCurves());
while (itcr.More())
{
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
actCurve=GC->PCurve();
itcr.Next();
};
if (actCurve->IsKind(STANDARD_TYPE(Geom2d_Line)))
...
This works, because I made sure, that my TopoDS_Edge has only one curve, so my iterator loop is only done once.
Once again thanks for your help, this brougth me up to rigth source files in OpenCascade to have a look at.
Stefan
const Handle(Geom2d_Line)& line=Handle(Geom2d_Line)::DownCast(actCurve);