diff --git a/src/Mod/PartDesign/App/FeaturePipe.cpp b/src/Mod/PartDesign/App/FeaturePipe.cpp index db29a6007..fa0050696 100644 --- a/src/Mod/PartDesign/App/FeaturePipe.cpp +++ b/src/Mod/PartDesign/App/FeaturePipe.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #endif #include @@ -65,7 +66,7 @@ using namespace PartDesign; const char* Pipe::TypeEnums[] = {"FullPath","UpToFace",NULL}; const char* Pipe::TransitionEnums[] = {"Transformed","Right corner", "Round corner",NULL}; -const char* Pipe::ModeEnums[] = {"Standart", "Fixed", "Binormal", "Frenet", "Auxillery", NULL}; +const char* Pipe::ModeEnums[] = {"Standart", "Fixed", "Frenet", "Auxillery", "Binormal", NULL}; const char* Pipe::TransformEnums[] = {"Constant", "Multisection", "Auxillery", NULL}; @@ -133,18 +134,91 @@ App::DocumentObjectExecReturn *Pipe::execute(void) } try { + //build the paths App::DocumentObject* spine = Spine.getValue(); if (!(spine && spine->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))) return new App::DocumentObjectExecReturn("No spine linked."); std::vector subedge = Spine.getSubValues(); - TopoDS_Shape path; const Part::TopoShape& shape = static_cast(spine)->Shape.getValue(); buildPipePath(shape, subedge, path); + + TopoDS_Shape auxpath; + if(Mode.getValue()==3) { + App::DocumentObject* auxspine = AuxillerySpine.getValue(); + if (!(auxspine && auxspine->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))) + return new App::DocumentObjectExecReturn("No auxillery spine linked."); + std::vector auxsubedge = AuxillerySpine.getSubValues(); + TopoDS_Shape path; + const Part::TopoShape& auxshape = static_cast(auxspine)->Shape.getValue(); + 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; iShape.setValue(cut.Shape()); + return App::DocumentObject::StdReturn; + + return SketchBased::execute(); + } + catch (Standard_Failure) { + Handle_Standard_Failure e = Standard_Failure::Caught(); + return new App::DocumentObjectExecReturn(e->GetMessageString()); + } + catch (...) { + return new App::DocumentObjectExecReturn("A fatal error occurred when making the sweep"); + } +} + +void Pipe::setupAlgorithm(BRepOffsetAPI_MakePipeShell& mkPipeShell, TopoDS_Shape& auxshape) { + mkPipeShell.SetTolerance(Precision::Confusion()); - //mkPipeShell.SetMode(isFrenet); + switch(Transition.getValue()) { case 0: mkPipeShell.SetTransitionMode(BRepBuilderAPI_Transformed); @@ -164,68 +238,25 @@ App::DocumentObjectExecReturn *Pipe::execute(void) mkPipeShell.SetMode(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1), gp_Dir(1,0,0))); break; case 2: - mkPipeShell.SetMode(gp_Dir(bVec.x,bVec.y,bVec.z)); - break; - case 3: mkPipeShell.SetMode(true); break; - case 4: + case 3: auxillery = true; + case 4: + mkPipeShell.SetMode(gp_Dir(bVec.x,bVec.y,bVec.z)); + break; } if(auxillery) { - TopoDS_Shape auxpath; - App::DocumentObject* auxspine = AuxillerySpine.getValue(); - if (!(auxspine && auxspine->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))) - return new App::DocumentObjectExecReturn("No auxillery spine linked."); - std::vector auxsubedge = AuxillerySpine.getSubValues(); - - TopoDS_Shape path; - const Part::TopoShape& auxshape = static_cast(auxspine)->Shape.getValue(); - buildPipePath(auxshape, auxsubedge, auxpath); if(Transformation.getValue()!=2) - mkPipeShell.SetMode(TopoDS::Wire(auxshape._Shape), AuxilleryCurvelinear.getValue()); + mkPipeShell.SetMode(TopoDS::Wire(auxshape), AuxilleryCurvelinear.getValue()); else - mkPipeShell.SetMode(TopoDS::Wire(auxshape._Shape), AuxilleryCurvelinear.getValue(), BRepFill_ContactOnBorder); + mkPipeShell.SetMode(TopoDS::Wire(auxshape), AuxilleryCurvelinear.getValue(), BRepFill_ContactOnBorder); } - - // TopTools_ListIteratorOfListOfShape iter; - // for (iter.Initialize(profiles); iter.More(); iter.Next()) { - // mkPipeShell.Add(TopoDS_Shape(iter.Value())); - // } - - mkPipeShell.Add(wires.front()); - - if (!mkPipeShell.IsReady()) - Standard_Failure::Raise("shape is not ready to build"); - mkPipeShell.Build(); - mkPipeShell.MakeSolid(); -/* - TopTools_ListOfShape sim; - mkPipeShell.Simulate(5, sim); - BRep_Builder builder; - TopoDS_Compound Comp; - builder.MakeCompound(Comp); - - TopTools_ListIteratorOfListOfShape simIt; - for (simIt.Initialize(sim); simIt.More(); simIt.Next()) - builder.Add(Comp, simIt.Value()) ; - */ - this->Shape.setValue(mkPipeShell.Shape()); - return App::DocumentObject::StdReturn; - - return SketchBased::execute(); - } - catch (Standard_Failure) { - Handle_Standard_Failure e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); - } - catch (...) { - return new App::DocumentObjectExecReturn("A fatal error occurred when making the sweep"); - } } + void Pipe::getContiniusEdges(Part::TopoShape TopShape, std::vector< std::string >& SubNames) { diff --git a/src/Mod/PartDesign/App/FeaturePipe.h b/src/Mod/PartDesign/App/FeaturePipe.h index 6e693a133..08907abfc 100644 --- a/src/Mod/PartDesign/App/FeaturePipe.h +++ b/src/Mod/PartDesign/App/FeaturePipe.h @@ -26,6 +26,7 @@ #include #include "FeatureSketchBased.h" +#include namespace PartDesign { @@ -61,6 +62,7 @@ protected: ///get the given edges and all their tangent ones void getContiniusEdges(Part::TopoShape TopShape, std::vector< std::string >& SubNames); void buildPipePath(const Part::TopoShape& input, const std::vector& edges, TopoDS_Shape& result); + void setupAlgorithm(BRepOffsetAPI_MakePipeShell& mkPipeShell, TopoDS_Shape& auxshape); private: static const char* TypeEnums[]; diff --git a/src/Mod/PartDesign/Gui/TaskPipeOrientation.ui b/src/Mod/PartDesign/Gui/TaskPipeOrientation.ui index c405a5730..3dba7524a 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeOrientation.ui +++ b/src/Mod/PartDesign/Gui/TaskPipeOrientation.ui @@ -41,11 +41,6 @@ Fixed - - - Binormal - - Frenet @@ -56,6 +51,11 @@ Auxillery + + + Binormal + + @@ -63,91 +63,10 @@ - 2 + 0 - - - - - - Set the constant binormal vector used to calculate the profiles orientation - - - true - - - - - - - QFormLayout::ExpandingFieldsGrow - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing - - - 20 - - - - - X - - - - - - - Y - - - - - - - Z - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - - - - @@ -238,6 +157,87 @@ + + + + + + Set the constant binormal vector used to calculate the profiles orientation + + + true + + + + + + + QFormLayout::ExpandingFieldsGrow + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + 20 + + + + + X + + + + + + + Y + + + + + + + Z + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + + +