DiscussionsIssue archiveOCCT:Modeling Algorithms

Archived issue #0029645

Hang on making pipe shell using BRepOffsetAPI_MakePipeShell

CommunityOCCT:Modeling Algorithmsclosed19 public notes

Search issues

Description

Algorithm hangs in GeomFill_CorrectedFrenet::GetAngleAT

Steps to reproduce

Paste this code to CModelingDoc::OnWire() and include <BRepOffsetAPI_MakePipeShell.hxx>, <TopExp.hxx>
    TopoDS_Wire profile;

    {
        BRep_Builder builder;
        TopoDS_Vertex verts[4];

        builder.MakeVertex(verts[0], gp_Pnt(-26, 12, 0), Precision::Confusion());
        builder.MakeVertex(verts[1], gp_Pnt(-26, 0, 0), Precision::Confusion());
        builder.MakeVertex(verts[2], gp_Pnt(26, 0, 0), Precision::Confusion());
        builder.MakeVertex(verts[3], gp_Pnt(26, 12, 0), Precision::Confusion());

        BRepBuilderAPI_MakeEdge line1(verts[0], verts[1]);
        BRepBuilderAPI_MakeEdge line2(verts[1], verts[2]);
        BRepBuilderAPI_MakeEdge line3(verts[2], verts[3]);
        BRepBuilderAPI_MakeEdge line4(verts[3], verts[0]);
        BRepBuilderAPI_MakeWire wire_maker;

        wire_maker.Add(line1.Edge());
        wire_maker.Add(line2.Edge());
        wire_maker.Add(line3.Edge());
        wire_maker.Add(line4.Edge());

        profile = wire_maker.Wire();
    }

    TopoDS_Wire path;
    TopoDS_Vertex path_vertex;

    {
        TColStd_Array1OfReal knots(1, 5);
        knots(1) = 0;
        knots(2) = 45.880278987817846;
        knots(3) = 99.638999210680296;
        knots(4) = 162.40841851658115;
        knots(5) = 188.71431139251297;
        TColgp_Array1OfPnt poles(1, 7);
        poles(1) = gp_Pnt(-1, 0, -179);
        poles(2) = gp_Pnt(0.37902151193486527, 0, -164.30703183772184);
        poles(3) = gp_Pnt(11.195586011484558, 0, -132.50453080937984);
        poles(4) = gp_Pnt(41.585039692913654, 0, -80.520244067871488);
        poles(5) = gp_Pnt(5.5420134018386120, 0, -38.231472197588452);
        poles(6) = gp_Pnt(0.50268655678950513, 0, -8.9676964506451551);
        poles(7) = gp_Pnt(1, 0, 0);
        TColStd_Array1OfInteger mults(1, 5);
        mults(1) = 4;
        mults(2) = 1;
        mults(3) = 1;
        mults(4) = 1;
        mults(5) = 4;
        bool is_periodic = 0;
        int degree = 3;

        Handle(Geom_BSplineCurve) spl = new Geom_BSplineCurve(poles, knots, mults, degree, is_periodic);
        BRepBuilderAPI_MakeEdge edge_maker(spl);
        BRepBuilderAPI_MakeWire wire_maker;
        TopoDS_Edge edge = edge_maker.Edge();

        edge.Reverse();

        wire_maker.Add(edge);

        path_vertex = TopExp::FirstVertex(edge, 1);

        path = wire_maker.Wire();
    }

    BRepOffsetAPI_MakePipeShell sweep(path);

    sweep.Add(profile, path_vertex, Standard_False, Standard_False);
    sweep.Build();

    Handle(AIS_Shape) ais_prism = new AIS_Shape(sweep.Shape());
    myAISContext->SetColor(ais_prism,Quantity_NOC_RED,Standard_False); 
    myAISContext->Display(ais_prism,Standard_False);

Public activity

19 archived notes

Participants are labeled by their role within this record.

01Commenter 2
I encounter a similar problem with BRepOffsetAPI_MakePipe and the attached files spine_32 and profile_32. The program hangs in GeomFill_CorrectedFrenet::GetAngleAT(double).

- Linux Ubuntu 20.04 64-bit
- Version 7.5
02Commenter 3
The attached files cant open by drawtest,show error: File was not written with this version of the topology
03Commenter 3
The attached files is written by newer version.Rewrite CASCADE Topology V3, (c) Open Cascade to CASCADE Topology V1, (c) Matra-Datavision,the files can read by OCCT 7.5.Then use BRepOffsetAPI_MakePipe,the application crash
04Commenter 2
Yes... I actually exported those files with the latest version of OCE that I used to test if my problem had been fixed, I had not realized that the exported brep would be different, I'll now upload the files exported with the version 7.5.0.

Note that this bug happens when using the following code:

BRepOffsetAPI_MakePipeShell pipeBuilder(spine);
pipeBuilder.SetTransitionMode(BRepBuilderAPI_RightCorner);
pipeBuilder.Add(profile);
pipeBuilder.Build();
pipeBuilder.MakeSolid();

If I add "pipeBuilder.SetDiscreteMode();" then I get this crash: #0031147
05Commenter 4
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: Commenter 5
Date: Thu Apr 29 11:03:45 2021 +0300

    0029645: Hang on making pipe shell using BRepOffsetAPI_MakePipeShell
    
    Added condition for exit from infinite loop.
06Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
07Commenter 5
Branch for review:
OCCT - CR29645
08Commenter 5
09Commenter 9
Your solution is not good.
Please pay attention to GeomFill_Frenet.cxx, lines 695 and 729:

GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion);

Method GeomLib::FuseIntervals gives wrong result in this case, because it considers two arrays as having equal importance. You should write your own method instead: this method must adjust singularities to knots of the curve (if they are close enough).

And, of course, you should add 1 or 2 test cases.
10Commenter 4
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: Commenter 5
Date: Tue May 4 13:28:25 2021 +0300

    0029645: Hang on making pipe shell using BRepOffsetAPI_MakePipeShell
    
    Added new boolean parameter to GeomLib::FuseIntervals() to select method of defining an element with close values
11Commenter 5
Branch for review:
CR29645_1
12Commenter 6
Andrey,
-  Standard_EXPORT static void FuseIntervals (const TColStd_Array1OfReal& Interval1, const TColStd_Array1OfReal& Interval2, TColStd_SequenceOfReal& Fusion, const Standard_Real Confusion = 1.0e-9);
+  Standard_EXPORT static void FuseIntervals (const TColStd_Array1OfReal& Interval1, const TColStd_Array1OfReal& Interval2, TColStd_SequenceOfReal& Fusion,
+                                             const Standard_Real Confusion = 1.0e-9, const Standard_Boolean IsToFirstInterval = Standard_False);

could you please add description to this method and it's parameters?

13Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
14Commenter 14
Remarks:

1. GeomLib.hxx, cxx:
Add detailed description of the method FuseIntervals including explanation of all parameters. Rename last parameter to "IsAdjustToFirstInterval".
Reformat all GeomLib.hxx in order to adjust it to line's length <= 100 simbols.
2. GeomFill_Frenet.cxx:
line 729: use Precision::PConfusion() instead of 1.e-9.
line 695: correct call of FuseIntervals like in line 729.
3. GeomFill_CorrectedFrenet.cxx:
lines 885, 916: may be it is right to fuse intervals adjusting to "FrenetInt"?
15Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
16Commenter 16
Reviewed.

Branches for integration:
OCCT – CR29645_1
Products – NOT
17Commenter 1
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17874.080000000333 / 17899.800000000352 [-0.14%]
Products
Total CPU difference: 11557.880000000083 / 11563.54000000011 [-0.05%]
Windows-64-VC14:
OCCT
Total CPU difference: 19394.921875 / 19369.625 [+0.13%]
Products
Total CPU difference: 12880.234375 / 12896.03125 [-0.12%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
18Commenter 4
Branch [archived branch] has been deleted by Participant.

[revision removed]
19Commenter 4
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records