How to judge if a Geom_Curve object is ceated successfully

Hi,

I need to convert an Edge to a Geom_Curve. I did that and there are not compilation error :

Handle(Geom_Curve) myCurve = BRep_Tool::Curve(myEdge, First, Last);

gp_Pnt aPnt = myCurve->Value(First);

When I execute the program I have an error on this last line.

How to judge if a Geom_Curve object is ceated successfully

Can someone help me.

Thanks in advance,

Eugine's picture

Hi,

BRep_Tool::Curve() returns null handle if curve has not been created, so you should simply add the following check after the curve creation:

if (!myCurve.IsNull())
{
...
}

Best regards,
Eugine.