Fri, 03/07/2008 - 19:06
Forums:
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
Fri, 03/07/2008 - 19:11
forgot to say that ther error message is
terminate called after throwing an instance of 'StdFail_NotDone'
Mon, 03/10/2008 - 16:08
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 ?
Wed, 05/21/2008 - 06:42
Maybe you can try Geom_OffsetCurve
Mon, 09/21/2009 - 09:16
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!
Mon, 12/18/2023 - 16:12
I have tried this for FreeCAD's sketcher's offset tool as I was having the same issue : offset failing on single lines.
But with this the offset is not working properly for negative distances anymore...
I mean that before if the distance was positive, then we made the offset outward, if distance negative offset inward.
When I initialize with workingPlane as in @zhangzhigang824 example, then the offset always go in the same direction (inward or inward depending on the wires), ie exactly as if I was doing offset.Perform(fabs(distance));
Which of course is not intended...
Any idea what is happening?
Tue, 01/09/2024 - 10:26
Hi, I've not analysed this deeper, but if you define your working plane with its opposite normal direction then you get the offset into the other direction.