Bad result of BRepOffsetAPI_ThruSections to create a ruled surface.

Hi All,

I am using BRepOffsetAPI_ThruSections to create loft or ruled surface. But I find it can't work well on wires which contains several edges. Such as this sample,

wire1
________________
| wire2 |
| _____ |
| | \ |
| | \ |
| |_____| |
|______________|

wire1 is a rectangle wire which contains 4 edges. wire2 contains 5 edges, one edge is a chamfer edge.
But using BRepOffsetAPI_ThruSections, I can't get correct ruled surface no matter how I change the start points of the wire to match the loop order. In fact, I suffer this problem for a long time, but I can't find any improvement in 6.2, 6.3 version. I really hope OCC team to improve this basic modelling API, it's really important for modeling loft and ruled surface.
Regards.

-Cauchy Ding

Cauchy Ding's picture

wire1
___________________
|******************|
|******wire2*******|
|*****____*********|
|*****|***\********|
|*****|****\*******|
|*****|****|*******|
|*****|____|*******|
|******************|
|__________________|

To format the shape, I have to use "*" instead of the space.

jelle's picture

I'm experiencing the exact same problem.
I'm seeing a lot of segfaults when calling BrepOffsetAPI_ThruSections, when lofting wires which have different numbers of edges.
Not cool to see such a fundemental feature not being able to deal with such input!

-jelle

jelle's picture

Cauchy,

There might be a pretty simple fix for this; it seems that BrepOffsetAPI_ThruSections::CreateRuled does *not* except 2 wires with different number of edges.
This is not checked in the BrepOffsetAPI_ThruSections, when calling BRepFill_Generator:

void BRepOffsetAPI_ThruSections::CreateRuled()
{
Standard_Integer nbSects = myWires.Length();
BRepFill_Generator aGene;
// for (Standard_Integer i=1; i<=nbSects; i++) {
Standard_Integer i;
for (i=1; i<=nbSects; i++) {
aGene.AddWire(TopoDS::Wire(myWires(i)));
}
aGene.Perform();
TopoDS_Shell shell = aGene.Shell();

I'm sorry, I'm not a C++ dev, but what do you think?
Could that be it?

-jelle

jelle's picture

Ai, I'm sorry, the above is incorrect; BrepFill_CompatibleWires is called in the .Build method

jelle's picture

I'm a little bit futher: BrepFill_CompatibleWires is to blame.
An interesting thread here: http://www.opencascade.org/org/forum/thread_12012/
Seems the issue surfaced before.

-jelle

Markus's picture

Same problem here - it seems that this is really hard to solve. Are there any workarounds for this?

jelle's picture

You could use BrepFill().Face(edg1,edg2) or .Shell(wire1,wire2)
That way the input curves are not altered ( usually, you *need* this though ;')

-jelle

Markus Hagemann's picture

Is this still an issue? Or is it at least solved in the commercial version?

sergey zaritchny's picture

At the moment you can consider it as a limitation of the algorithm -
each wire selected must have the same number of edges and vertices.
Probably you may use the sweeping algorithm of MakePipeShell, ?
Regards