diff --git a/src/Mod/PartDesign/App/FeaturePipe.cpp b/src/Mod/PartDesign/App/FeaturePipe.cpp index fa0050696..9357abdad 100644 --- a/src/Mod/PartDesign/App/FeaturePipe.cpp +++ b/src/Mod/PartDesign/App/FeaturePipe.cpp @@ -50,6 +50,8 @@ #include #include #include +#include +#include #endif #include @@ -155,53 +157,46 @@ App::DocumentObjectExecReturn *Pipe::execute(void) buildPipePath(auxshape, auxsubedge, auxpath); } - //build the outer wire first - BRepOffsetAPI_MakePipeShell mkPipeShell(TopoDS::Wire(path)); - setupAlgorithm(mkPipeShell, auxpath); - mkPipeShell.Add(wires.front()); - - if (!mkPipeShell.IsReady()) - Standard_Failure::Raise("shape is not ready to build"); - mkPipeShell.Build(); - mkPipeShell.MakeSolid(); - - //now remove all inner wires - TopoDS_Compound comp; - TopoDS_Builder mkCmp; - mkCmp.MakeCompound(comp); - for(int i=1; i shells; + std::vector frontwires, backwires; + for(TopoDS_Wire& wire : wires) { BRepOffsetAPI_MakePipeShell mkPS(TopoDS::Wire(path)); setupAlgorithm(mkPS, auxpath); - mkPS.Add(wires[i]); + mkPS.Add(wire); if (!mkPS.IsReady()) - Standard_Failure::Raise("shape is not ready to build"); - mkPS.Build(); - mkPS.MakeSolid(); + return new App::DocumentObjectExecReturn("pipe could not be build"); - mkCmp.Add(comp, mkPS.Shape()); + //build the shell use simulate to get the top and bottom wires in an easy way + shells.push_back(mkPS.Shape()); + TopTools_ListOfShape sim; + mkPS.Simulate(2, sim); + frontwires.push_back(TopoDS::Wire(sim.First())); + backwires.push_back(TopoDS::Wire(sim.Last())); } - //TODO: This method is very slow. It wuld be better to build the individual pipes as shells - //and create the solid by hand from the shells. As we can assume no intersection between inner and outer - //shell this should work. - BRepAlgoAPI_Cut cut(mkPipeShell.Shape(), comp); - if (!cut.IsDone()) - return new App::DocumentObjectExecReturn("Building inner wire failed"); - -/* - TopTools_ListOfShape sim; - mkPipeShell.Simulate(5, sim); - BRep_Builder builder; - TopoDS_Compound Comp; - builder.MakeCompound(Comp); + //build the top and bottom face, sew the shell and build the final solid + TopoDS_Shape front = makeFace(frontwires); + TopoDS_Shape back = makeFace(backwires); - TopTools_ListIteratorOfListOfShape simIt; - for (simIt.Initialize(sim); simIt.More(); simIt.Next()) - builder.Add(Comp, simIt.Value()) ; - */ - this->Shape.setValue(cut.Shape()); + BRepBuilderAPI_Sewing sewer; + sewer.SetTolerance(Precision::Confusion()); + sewer.Add(front); + sewer.Add(back); + for(TopoDS_Shape& s : shells) + sewer.Add(s); + + sewer.Perform(); + + //build the solid + BRepBuilderAPI_MakeSolid mkSolid; + mkSolid.Add(TopoDS::Shell(sewer.SewedShape())); + if(!mkSolid.IsDone()) + return new App::DocumentObjectExecReturn("Result is not a solid"); + + this->Shape.setValue(mkSolid.Shape()); return App::DocumentObject::StdReturn; return SketchBased::execute(); diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp index b227bc58a..1f822f34f 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp @@ -482,13 +482,7 @@ TaskPipeScaling::TaskPipeScaling(ViewProviderPipe* PipeView, bool newObj, QWidge this, SLOT(updateUI(int))); this->groupLayout()->addWidget(proxy); - -// ui->comboBoxTransition->clear(); -// ui->comboBoxTransition->insertItem(0, tr("Transformed")); -// ui->comboBoxTransition->insertItem(1, tr("Right Corner")); -// ui->comboBoxTransition->insertItem(2, tr("Round Corner")); -// ui->comboBoxTransition->setCurrentIndex(0); - + updateUI(0); }