BRepOffsetAPI_MakeOffset of an open TopoDS_Wire


I have some problems since the 6.5.3 release to create the offset of an open TopoDS_Wire.
The TopoDS_Wire in this case is really simple. It contains an unique straight TopoDS_Edge (see attached brep).
The used code is the next one :

The TopoDS_Wire "wire" contains the read ExtractedWire.brep.

const double dDistance = 5.0;
TopoDS_Wire offsetWire;

BRepOffsetAPI_MakeOffset aOffAlgo(wire,GeomAbs_Arc);

if (aOffAlgo.IsDone())
const TopoDS_Shape& shape = aOffAlgo.Shape();
if (!shape.IsNull() && shape.ShapeType()==TopAbs_WIRE)
offsetWire = TopoDS::Wire(shape);
catch (Standard_Failure)
Handle(Standard_Failure) E = Standard_Failure::Caught();

When the Perform method is called, the method crash and throw a Standard_Failure exception.
So my question is if it is possible to generate the offset of an open wire ?
I remember to succeed making it before the new release (the offset wire have a "capsule" form shape of wire type which surround the original wire).

Thanks to indicate if it is a regression bug of the 6.5.3.


Steph's picture

I've make some other tests and the offset of an open wire work in the majority of the cases except when the edge is a straight edge !!!
It's really strange because if with a curve edge it work like a charm... It's seem to be a bug of a specific case of a straight edge.

Pawel's picture

Hi Steph,

actually the documentation says the algorithm (BRepOffsetAPI_MakeOffset) needs "a set of
wires contained in a planar face". Although this is actually the case for a line, the plane cannot be computed and so an exception is produced (Standard_Failure not Standard_ConstructionError as the documentation says).

Not sure why it worked in previous versions but this behaviour seems OK to me.


Forum supervisor's picture

Dear Steph,
Indeed the documentation says that the algorithm expects "a set of
wires contained in a planar face". Pay your attention on the last words " a planar face".
The provided edge has no connection with any surface (make dump of the edge).
See the next example when offset is built from a straight edge
box b 100 100 100
explo b E
don b_1
wire w1 b_1
mkoffset r w1 1 10

See result in the attached picture.

Steph's picture

Hi Supervisor,

Really interesting.
So what you're saying me is that the construction of my wire and of it's edge(s) is bad done and must be associated to a plane (with that i will avoid the posted code fix) ?

If so how can be done ?

Is there any method to set a plane to an existing wire or iterating over the edges to each edge ?


Forum supervisor's picture

Dear Steph,
I just payed your attention to the documentation note and its right understanding.
Unfortunately I can't answer to the question because we are not providing technical
consulting on the Forum. If you need our professional support you may contact us via
the Contact Form

Steph's picture

Hi Pawel, thanks for the answer.

You're absolutely right. If the wire contains two edges which allow to compute the plane the offset of an open wire work perfectly.
My case is a specific case of a wire with only one edge. So you're right the plane can't be computed as can pass through this wire an infinite number of planes.

So if it is of interest of other people i add in my code before calling the offset this part of code :

//Check if it possible to compute the plane. In my case can't
BRepBuilderAPI_FindPlane findPlane(wire);
if (!findPlane.Found())
//So i create an face from the XOY plane for instance and add it the wire.

const gp_Pln& plane = gp_Pln(gp_Ax3(gp::XOY()));

BRepBuilderAPI_MakeFace makeFace(plane);

//And now the offset is well computed
BRepOffsetAPI_MakeOffset aOffAlgo(makeFace.Face(),GeomAbs_Arc);

Thanks a lot.