offset problem

hello all,

I'm having a problem with BRepOffsetAPI_MakeOffset. Any ideas why this is crashing :

TopoDS_Wire *s2;
s2 = TopoDS::Wire(GetShape("Contour",ic));
BRepOffsetAPI_MakeOffset mkOffset(*s2)
mkOffset.Perform(dist);

GetShape returns a TopoDS_Shape (a wire) , dist is a real (0.001) an ic is an integer

It crashes, whatever I do. Please help

Jouke

hylkema's picture

forgot to say that ther error message is
terminate called after throwing an instance of 'StdFail_NotDone'

hylkema's picture

OK .. I figured out what the problem is. The wire consists of one single edge so the algorithm can not decide on what plane to use for the offset.
The question is now, how can I offset a single edge ?

Bill Chen's picture

Maybe you can try Geom_OffsetCurve

zhangzhigang824's picture

Hi,

You can specify a plane for offset, and then offset a single edge will OK.
The sample code is followed.

TopoDS_Face workingPlane = BRepBuilderAPI_MakeFace(gp_Pln(gp::Origin(),gp::DZ()));
BRepOffsetAPI_MakeOffset offset(workingPlane);
offset.AddWire(aWire);
offset.Perform(distance);
TopoDS_Shape newWire = offset.Shape();

Thanks!