DiscussionsIssue archiveOther usage issues

Archived discussion

offset problem

Other usage issuesFri, 03/07/2008 - 19:066 replies

Browse this forum
QuestionAuthor

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

Discussion

6 archived replies

Posts are displayed in their archived order.

01Author

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

02Author

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 ?

03Commenter-1

Maybe you can try Geom_OffsetCurve

04Commenter-2

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!

05Commenter-3

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 @Commenter-2 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?

06Commenter-4

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.