BRepOffsetAPI_MakePipeShell crash: StdFail_NotDone("BRep_API: command not done")

Hello. When creating a pipe shell, I get the exception StdFail_NotDone("BRep_API: command not done") The figure is successfully built for the profile files profile0.brep and profile1.brep (Screenshot_1.png). The error occurs when using the files fail_profile0.brep and fail_profile1.brep (Screenshot_2.png).

[CODE]

TopoDS_Shape make_pipe_shell( const std::vector<TopoDS_Wire>& profiles, const TopoDS_Wire& path )
{
    BRepOffsetAPI_MakePipeShell mkPipeShell(path);

    mkPipeShell.SetMode(true);
    mkPipeShell.SetForceApproxC1(true);
    mkPipeShell.SetDiscreteMode();
    mkPipeShell.SetTransitionMode(BRepBuilderAPI_RoundCorner);

    for (auto a : profiles)
        mkPipeShell.Add(a, false, true);

    if (!mkPipeShell.IsReady())
        std::logic_error("shape is not ready to build");

    mkPipeShell.Build();

    return mkPipeShell.Shape();

    return TopoDS_Shape();
}

TopoDS_Wire read(const char* file)
{
    BRep_Builder builder;

    TopoDS_Wire shape;

    std::ifstream is;
    is.open(file);
    BRepTools::Read(shape, is, builder);
    is.close();

    return shape;
}

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    BRep_Builder builder;

    TopoDS_Wire wire = read("d:/test/wire.brep");

    { // successfully
        TopoDS_Wire profile0 = read("d:/test/profile0.brep");
        TopoDS_Wire profile1 = read("d:/test/profile1.brep");

        auto pipe = make_pipe_shell({ profile0, profile1 }, wire);
    }

    { // failed
        TopoDS_Wire profile0 = read("d:/test/fail_profile0.brep");
        TopoDS_Wire profile1 = read("d:/test/fail_profile1.brep");

        auto pipe = make_pipe_shell({ profile0, profile1 }, wire);
    }

    return a.exec();
}

OpenCASCADE: v 7.6.0 OS: Windows 10 Pro x64 21H2 CPU: AMD Ryzen 5 2400G

Eugene Zaliznyak's picture

Hello Valerii, I think you should call IsDone() before getting result shape. It is to avoid the exception.

Valerii Kabanov's picture

Hello Eugene Zaliznyak.
Thank you for your reply.

The task is not to avoid the exception.
I do not understand why for one set of profiles the correct shape is obtained, and if you change the profile form, you get an error.

Eugene Zaliznyak's picture

I understand. I analyzed your geometry and I see - any of this profile separately produces not done exception even with simplest straight spine (line). So, for me it looks simply bug in code.

Valerii Kabanov's picture

The code for creating pipes is the same.

In this figure, the creation of a pipe for profiles (red line) is successful:

   

and on this for another profile form, the creation ends with an error 'BRep_API: command not done':

For both cases, the path is the same, the profile shapes are different

 

 

Eugene Zaliznyak's picture

Yes, I understand. The difference is in profile. It cannot build even straight path for this profile. Actually, I do not see any serious reason to do not build the pipe. Next could be debugging the OCC and reporting bug to Team.