BRepOffsetAPI_ThruSections fails in building a shape with two wires


I am trying to generate a shell/solid with two closed wires using BRepOffsetAPI_ThruSections.

But it is crashing when I called shape() method to get the generated shape.

Here is the code I use :


BRepOffsetAPI_ThruSections thruSect(Standard_False, Standard_False, 1.0e-6);

thruSect.AddWire(sections[i - 1]);

TopoDS_Shape shape = thruSect.Shape();


This fails not for all cases. But it fails only some cases.

Then I search the forum and modified the code as follows.


BRepOffsetAPI_ThruSections thruSect(Standard_False, Standard_False, 1.0e-6);

thruSect.AddWire(sections[i - 1]);


TopoDS_Shape shape = thruSect.Shape();


But when we called Shape() then automatically Build() also invoked there.

So please suggest me are there any ways to over come this issue.

Anything can done by SetSmoothing(), SetContinuity() like other functions.. or If there is any othe API that I can use?

I attached my failing two TopoDS_Wire  along with this.

Please help me to solve this.

Thanks in advance.


Timo Roth's picture

I tried your wires in OCC Draw with the following script:

pload ALL

restore wire0.brep a

restore wire1.brep b

whatis a

whatis b

explode a

explode b

thrusections r 0 0 a b

=> An exception was caught 00000000034A3760 : Standard_DomainError: Sections must be all closed or all open​

One of your wires is open and the other is closed. It seems this is not supported.

Vinojan Thiyagarasah's picture

Thank you Timo Roth.

Ya I found that wire0(a) is not fully closed. There is the problem occurs.

Now I made it close and get the correct final result.

Thank you for your reply.