diff --git a/src/Mod/PartDesign/App/FeatureGroove.cpp b/src/Mod/PartDesign/App/FeatureGroove.cpp index 2b4ffc00ba60..c06aa4338e33 100644 --- a/src/Mod/PartDesign/App/FeatureGroove.cpp +++ b/src/Mod/PartDesign/App/FeatureGroove.cpp @@ -32,6 +32,7 @@ # include # include # include +# include # include # include #endif @@ -66,6 +67,7 @@ Groove::Groove() ADD_PROPERTY_TYPE(Angle,(360.0),"Groove", App::Prop_None, "Angle"); Angle.setConstraints(&floatAngle); ADD_PROPERTY_TYPE(ReferenceAxis,(0),"Groove",(App::PropertyType)(App::Prop_None),"Reference axis of Groove"); + ADD_PROPERTY_TYPE(Outside,(false),"Groove",App::Prop_None,"Remove outside of profile"); } short Groove::mustExecute() const @@ -158,14 +160,23 @@ App::DocumentObjectExecReturn *Groove::execute(void) result = refineShapeIfActive(result); this->AddSubShape.setValue(result); - // cut out groove to get one result object - BRepAlgoAPI_Cut mkCut(base, result); - // Let's check if the fusion has been successful - if (!mkCut.IsDone()) - throw Base::CADKernelError("Cut out of base feature failed"); + TopoDS_Shape solRes; + if (!Outside.getValue()) { + // cut out groove to get one result object + BRepAlgoAPI_Cut mkCut(base, result); + // Let's check if the cut has been successful + if (!mkCut.IsDone()) + throw Base::CADKernelError("Cut out of base feature failed"); + + // we have to get the solids (fuse sometimes creates compounds) + solRes = this->getSolid(mkCut.Shape()); + } else { + BRepAlgoAPI_Common mkCommon(base, result); + if (!mkCommon.IsDone()) + throw Base::CADKernelError("Groove outside of profile failed"); + solRes = this->getSolid(mkCommon.Shape()); + } - // we have to get the solids (fuse sometimes creates compounds) - TopoDS_Shape solRes = this->getSolid(mkCut.Shape()); if (solRes.IsNull()) return new App::DocumentObjectExecReturn("Resulting shape is not a solid"); diff --git a/src/Mod/PartDesign/App/FeatureGroove.h b/src/Mod/PartDesign/App/FeatureGroove.h index e60f791c7323..5f3b31803832 100644 --- a/src/Mod/PartDesign/App/FeatureGroove.h +++ b/src/Mod/PartDesign/App/FeatureGroove.h @@ -40,6 +40,7 @@ class PartDesignExport Groove : public ProfileBased App::PropertyVector Base; App::PropertyVector Axis; App::PropertyAngle Angle; + App::PropertyBool Outside; /** if this property is set to a valid link, both Axis and Base properties * are calculated according to the linked line diff --git a/src/Mod/PartDesign/App/FeatureHelix.cpp b/src/Mod/PartDesign/App/FeatureHelix.cpp index f2ec1b78fe38..607b80bd52f3 100644 --- a/src/Mod/PartDesign/App/FeatureHelix.cpp +++ b/src/Mod/PartDesign/App/FeatureHelix.cpp @@ -92,7 +92,7 @@ Helix::Helix() Angle.setConstraints(&floatAngle); ADD_PROPERTY_TYPE(ReferenceAxis, (0), "Helix", App::Prop_None, "Reference axis of revolution"); ADD_PROPERTY_TYPE(Mode, (long(0)), "Helix", App::Prop_None, "Helix input mode"); - ADD_PROPERTY_TYPE(Outside, (long(0)), "Helix", App::Prop_None, "Outside"); + ADD_PROPERTY_TYPE(Outside, (long(0)), "Helix", App::Prop_None, "Remove outside of profile"); ADD_PROPERTY_TYPE(HasBeenEdited, (long(0)), "Helix", App::Prop_None, "HasBeenEdited"); Mode.setEnums(ModeEnums); } diff --git a/src/Mod/PartDesign/App/FeatureLoft.cpp b/src/Mod/PartDesign/App/FeatureLoft.cpp index f1d0c6215840..548f1ba7192a 100644 --- a/src/Mod/PartDesign/App/FeatureLoft.cpp +++ b/src/Mod/PartDesign/App/FeatureLoft.cpp @@ -58,6 +58,7 @@ Loft::Loft() Sections.setSize(0); ADD_PROPERTY_TYPE(Ruled,(false),"Loft",App::Prop_None,"Create ruled surface"); ADD_PROPERTY_TYPE(Closed,(false),"Loft",App::Prop_None,"Close Last to First Profile"); + ADD_PROPERTY_TYPE(Outside,(false),"Loft",App::Prop_None,"Remove outside of Loft"); } short Loft::mustExecute() const @@ -206,11 +207,19 @@ App::DocumentObjectExecReturn *Loft::execute(void) } else if(getAddSubType() == FeatureAddSub::Subtractive) { - BRepAlgoAPI_Cut mkCut(base, result); - if (!mkCut.IsDone()) - return new App::DocumentObjectExecReturn("Loft: Subtracting the loft failed"); - // we have to get the solids (fuse sometimes creates compounds) - TopoDS_Shape boolOp = this->getSolid(mkCut.Shape()); + TopoDS_Shape boolOp; + if (!Outside.getValue()) { + BRepAlgoAPI_Cut mkCut(base, result); + if (!mkCut.IsDone()) + return new App::DocumentObjectExecReturn("Loft: Subtracting the loft failed"); + // we have to get the solids (fuse sometimes creates compounds) + boolOp = this->getSolid(mkCut.Shape()); + } else { + BRepAlgoAPI_Common mkCommon(base, result); + if (!mkCommon.IsDone()) + return new App::DocumentObjectExecReturn("Loft: Subtracting outside the loft failed"); + boolOp = this->getSolid(mkCommon.Shape()); + } // lets check if the result is a solid if (boolOp.IsNull()) return new App::DocumentObjectExecReturn("Loft: Resulting shape is not a solid"); diff --git a/src/Mod/PartDesign/App/FeatureLoft.h b/src/Mod/PartDesign/App/FeatureLoft.h index cc4798e356ae..ac38fc3dd686 100644 --- a/src/Mod/PartDesign/App/FeatureLoft.h +++ b/src/Mod/PartDesign/App/FeatureLoft.h @@ -42,7 +42,8 @@ class PartDesignExport Loft : public ProfileBased App::PropertyLinkList Sections; App::PropertyBool Ruled; - App::PropertyBool Closed; + App::PropertyBool Closed; + App::PropertyBool Outside; /** @name methods override feature */ //@{ diff --git a/src/Mod/PartDesign/App/FeaturePipe.cpp b/src/Mod/PartDesign/App/FeaturePipe.cpp index fa25ac00eb45..fe4b088b43d8 100644 --- a/src/Mod/PartDesign/App/FeaturePipe.cpp +++ b/src/Mod/PartDesign/App/FeaturePipe.cpp @@ -92,6 +92,7 @@ Pipe::Pipe() ADD_PROPERTY_TYPE(Binormal,(Base::Vector3d()),"Sweep",App::Prop_None,"Binormal vector for corresponding orientation mode"); ADD_PROPERTY_TYPE(Transition,(long(0)),"Sweep",App::Prop_None,"Transition mode"); ADD_PROPERTY_TYPE(Transformation,(long(0)),"Sweep",App::Prop_None,"Section transformation mode"); + ADD_PROPERTY_TYPE(Outside,(false),"Sweep",App::Prop_None,"Remove outside of sweep"); Mode.setEnums(ModeEnums); Transition.setEnums(TransitionEnums); Transformation.setEnums(TransformEnums); @@ -332,11 +333,19 @@ App::DocumentObjectExecReturn *Pipe::execute(void) } else if(getAddSubType() == FeatureAddSub::Subtractive) { - BRepAlgoAPI_Cut mkCut(base, result); - if (!mkCut.IsDone()) - return new App::DocumentObjectExecReturn("Subtracting the pipe failed"); - // we have to get the solids (fuse sometimes creates compounds) - TopoDS_Shape boolOp = this->getSolid(mkCut.Shape()); + TopoDS_Shape boolOp; + if (!Outside.getValue()) { + BRepAlgoAPI_Cut mkCut(base, result); + if (!mkCut.IsDone()) + return new App::DocumentObjectExecReturn("Subtracting the pipe failed"); + // we have to get the solids (fuse sometimes creates compounds) + boolOp = this->getSolid(mkCut.Shape()); + } else { + BRepAlgoAPI_Common mkCommon(base, result); + if (!mkCommon.IsDone()) + return new App::DocumentObjectExecReturn("Subtracting outside the pipe failed"); + boolOp = this->getSolid(mkCommon.Shape()); + } // lets check if the result is a solid if (boolOp.IsNull()) return new App::DocumentObjectExecReturn("Resulting shape is not a solid"); diff --git a/src/Mod/PartDesign/App/FeaturePipe.h b/src/Mod/PartDesign/App/FeaturePipe.h index 9fbf90df01e7..626512b2c8e7 100644 --- a/src/Mod/PartDesign/App/FeaturePipe.h +++ b/src/Mod/PartDesign/App/FeaturePipe.h @@ -49,6 +49,7 @@ class PartDesignExport Pipe : public ProfileBased App::PropertyEnumeration Transition; App::PropertyEnumeration Transformation; App::PropertyLinkList Sections; + App::PropertyBool Outside; App::DocumentObjectExecReturn *execute(void); short mustExecute() const; diff --git a/src/Mod/PartDesign/App/FeaturePocket.cpp b/src/Mod/PartDesign/App/FeaturePocket.cpp index 3c248d768389..c8d1b8de42f0 100644 --- a/src/Mod/PartDesign/App/FeaturePocket.cpp +++ b/src/Mod/PartDesign/App/FeaturePocket.cpp @@ -69,6 +69,7 @@ Pocket::Pocket() ADD_PROPERTY_TYPE(Length2,(100.0),"Pocket",App::Prop_None,"P"); ADD_PROPERTY_TYPE(UpToFace,(0),"Pocket",App::Prop_None,"Face where pocket will end"); ADD_PROPERTY_TYPE(Offset,(0.0),"Pocket",App::Prop_None,"Offset from face in which pocket will end"); + ADD_PROPERTY_TYPE(Outside,(false),"Pocket",App::Prop_None,"Remove outside of profile"); static const App::PropertyQuantityConstraint::Constraints signedLengthConstraint = {-DBL_MAX, DBL_MAX, 1.0}; Offset.setConstraints ( &signedLengthConstraint ); @@ -219,11 +220,20 @@ App::DocumentObjectExecReturn *Pocket::execute(void) prism = refineShapeIfActive(prism); this->AddSubShape.setValue(prism); - // Cut the SubShape out of the base feature - BRepAlgoAPI_Cut mkCut(base, prism); - if (!mkCut.IsDone()) - return new App::DocumentObjectExecReturn("Pocket: Cut out of base feature failed"); - TopoDS_Shape result = mkCut.Shape(); + TopoDS_Shape result; + if (!Outside.getValue()) { + // Cut the SubShape out of the base feature + BRepAlgoAPI_Cut mkCut(base, prism); + if (!mkCut.IsDone()) + return new App::DocumentObjectExecReturn("Pocket: Cut out of base feature failed"); + result = mkCut.Shape(); + } else { + // Cut the base feature to SubShape + BRepAlgoAPI_Common mkCommon(base, prism); + if (!mkCommon.IsDone()) + return new App::DocumentObjectExecReturn("Pocket: Cut out of base feature failed"); + result = mkCommon.Shape(); + } // we have to get the solids (fuse sometimes creates compounds) TopoDS_Shape solRes = this->getSolid(result); if (solRes.IsNull()) diff --git a/src/Mod/PartDesign/App/FeaturePocket.h b/src/Mod/PartDesign/App/FeaturePocket.h index 36b494d21c38..9d71d3a5bf2f 100644 --- a/src/Mod/PartDesign/App/FeaturePocket.h +++ b/src/Mod/PartDesign/App/FeaturePocket.h @@ -41,6 +41,7 @@ class PartDesignExport Pocket : public ProfileBased App::PropertyLength Length; App::PropertyLength Length2; App::PropertyLength Offset; + App::PropertyBool Outside; /** @name methods override feature */ //@{ diff --git a/src/Mod/PartDesign/App/FeaturePrimitive.cpp b/src/Mod/PartDesign/App/FeaturePrimitive.cpp index 93ae307c8036..43332aac65a9 100644 --- a/src/Mod/PartDesign/App/FeaturePrimitive.cpp +++ b/src/Mod/PartDesign/App/FeaturePrimitive.cpp @@ -27,6 +27,7 @@ # include # include # include +# include # include # include # include @@ -119,12 +120,19 @@ App::DocumentObjectExecReturn* FeaturePrimitive::execute(const TopoDS_Shape& pri AddSubShape.setValue(primitiveShape); } else if (getAddSubType() == FeatureAddSub::Subtractive) { - - BRepAlgoAPI_Cut mkCut(base, primitiveShape); - if (!mkCut.IsDone()) - return new App::DocumentObjectExecReturn("Subtracting the primitive failed"); - // we have to get the solids (fuse sometimes creates compounds) - TopoDS_Shape boolOp = this->getSolid(mkCut.Shape()); + TopoDS_Shape boolOp; + if (!Outside.getValue()) { + BRepAlgoAPI_Cut mkCut(base, primitiveShape); + if (!mkCut.IsDone()) + return new App::DocumentObjectExecReturn("Subtracting the primitive failed"); + // we have to get the solids (fuse sometimes creates compounds) + boolOp = this->getSolid(mkCut.Shape()); + } else { + BRepAlgoAPI_Common mkCommon(base, primitiveShape); + if (!mkCommon.IsDone()) + return new App::DocumentObjectExecReturn("Subtracting outside the primitive failed"); + boolOp = this->getSolid(mkCommon.Shape()); + } // lets check if the result is a solid if (boolOp.IsNull()) return new App::DocumentObjectExecReturn("Resulting shape is not a solid"); @@ -188,6 +196,7 @@ Box::Box() ADD_PROPERTY_TYPE(Length,(10.0f),"Box",App::Prop_None,"The length of the box"); ADD_PROPERTY_TYPE(Width ,(10.0f),"Box",App::Prop_None,"The width of the box"); ADD_PROPERTY_TYPE(Height,(10.0f),"Box",App::Prop_None,"The height of the box"); + ADD_PROPERTY_TYPE(Outside,(false),"Box",App::Prop_None,"Remove outside of primitive"); Length.setConstraints(&quantityRange); Width.setConstraints(&quantityRange); Height.setConstraints(&quantityRange); @@ -239,6 +248,7 @@ Cylinder::Cylinder() ADD_PROPERTY_TYPE(Radius,(10.0f),"Cylinder",App::Prop_None,"The radius of the cylinder"); ADD_PROPERTY_TYPE(Angle,(360.0f),"Cylinder",App::Prop_None,"The closing angle of the cylinder "); ADD_PROPERTY_TYPE(Height,(10.0f),"Cylinder",App::Prop_None,"The height of the cylinder"); + ADD_PROPERTY_TYPE(Outside,(false),"Cylinder",App::Prop_None,"Remove outside of primitive"); Angle.setConstraints(&angleRangeU); Radius.setConstraints(&quantityRange); Height.setConstraints(&quantityRange); @@ -301,6 +311,7 @@ Sphere::Sphere() Angle2.setConstraints(&angleRangeV); ADD_PROPERTY_TYPE(Angle3,(360.0f),"Sphere",App::Prop_None,"The angle of the sphere"); Angle3.setConstraints(&angleRangeU); + ADD_PROPERTY_TYPE(Outside,(false),"Sphere",App::Prop_None,"Remove outside of primitive"); primitiveType = FeaturePrimitive::Sphere; } @@ -347,6 +358,7 @@ Cone::Cone() ADD_PROPERTY_TYPE(Radius2,(4.0),"Cone",App::Prop_None,"The radius of the cone"); ADD_PROPERTY_TYPE(Height,(10.0),"Cone",App::Prop_None,"The height of the cone"); ADD_PROPERTY_TYPE(Angle,(360.0),"Cone",App::Prop_None,"The angle of the cone"); + ADD_PROPERTY_TYPE(Outside,(false),"Cone",App::Prop_None,"Remove outside of primitive"); Angle.setConstraints(&angleRangeU); Radius1.setConstraints(&quantityRangeZero); Radius2.setConstraints(&quantityRangeZero); @@ -413,6 +425,7 @@ Ellipsoid::Ellipsoid() Angle2.setConstraints(&angleRangeV); ADD_PROPERTY_TYPE(Angle3,(360.0f),"Ellipsoid",App::Prop_None,"The angle of the ellipsoid"); Angle3.setConstraints(&angleRangeU); + ADD_PROPERTY_TYPE(Outside,(false),"Ellipsoid",App::Prop_None,"Remove outside of primitive"); primitiveType = FeaturePrimitive::Ellipsoid; } @@ -498,6 +511,7 @@ Torus::Torus() Angle2.setConstraints(&torusRangeV); ADD_PROPERTY_TYPE(Angle3,(360.0),"Torus",App::Prop_None,"The angle of the torus"); Angle3.setConstraints(&angleRangeU); + ADD_PROPERTY_TYPE(Outside,(false),"Torus",App::Prop_None,"Remove outside of primitive"); primitiveType = FeaturePrimitive::Torus; } @@ -560,6 +574,7 @@ Prism::Prism() ADD_PROPERTY_TYPE(Polygon, (6.0), "Prism", App::Prop_None, "Number of sides in the polygon, of the prism"); ADD_PROPERTY_TYPE(Circumradius, (2.0), "Prism", App::Prop_None, "Circumradius (centre to vertex) of the polygon, of the prism"); ADD_PROPERTY_TYPE(Height, (10.0f), "Prism", App::Prop_None, "The height of the prism"); + ADD_PROPERTY_TYPE(Outside,(false),"Prism",App::Prop_None,"Remove outside of primitive"); Part::PrismExtension::initExtension(this); @@ -631,6 +646,7 @@ Wedge::Wedge() ADD_PROPERTY_TYPE(Zmax,(10.0f),"Wedge",App::Prop_None,"Zmax of the wedge"); ADD_PROPERTY_TYPE(X2max,(8.0f),"Wedge",App::Prop_None,"X2max of the wedge"); ADD_PROPERTY_TYPE(Z2max,(8.0f),"Wedge",App::Prop_None,"Z2max of the wedge"); + ADD_PROPERTY_TYPE(Outside,(false),"Wedge",App::Prop_None,"Remove outside of primitive"); primitiveType = FeaturePrimitive::Wedge; } diff --git a/src/Mod/PartDesign/App/FeaturePrimitive.h b/src/Mod/PartDesign/App/FeaturePrimitive.h index 1c8a65636927..c93765f8aeb5 100644 --- a/src/Mod/PartDesign/App/FeaturePrimitive.h +++ b/src/Mod/PartDesign/App/FeaturePrimitive.h @@ -52,6 +52,7 @@ class PartDesignExport FeaturePrimitive : public PartDesign::FeatureAddSub, publ FeaturePrimitive(); + App::PropertyBool Outside; virtual const char* getViewProviderName(void) const override { return "PartDesignGui::ViewProviderPrimitive"; } diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp index 36cab259a2c8..f2ebb3eabdb2 100644 --- a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp @@ -76,6 +76,8 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft *LoftView,bool /*newObj* this, SLOT(onClosed(bool))); connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)), this, SLOT(onUpdateView(bool))); + connect(ui->checkBoxOutside, SIGNAL(toggled(bool)), + this, SLOT(onOutsideChanged(bool))); // Create context menu QAction* remove = new QAction(tr("Remove"), this); @@ -117,9 +119,12 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft *LoftView,bool /*newObj* ui->listWidgetReferences->addItem(item); } + ui->checkBoxOutside->setVisible(loft->getAddSubType() == PartDesign::FeatureAddSub::Subtractive); + // get options ui->checkBoxRuled->setChecked(loft->Ruled.getValue()); ui->checkBoxClosed->setChecked(loft->Closed.getValue()); + ui->checkBoxOutside->setChecked(loft->Outside.getValue()); if (!loft->Sections.getValues().empty()) { LoftView->makeTemporaryVisible(true); @@ -297,6 +302,12 @@ void TaskLoftParameters::changeEvent(QEvent * /*e*/) { } +void TaskLoftParameters::onOutsideChanged(bool val) +{ + static_cast(vp->getObject())->Outside.setValue(val); + recomputeFeature(); +} + void TaskLoftParameters::onClosed(bool val) { static_cast(vp->getObject())->Closed.setValue(val); recomputeFeature(); diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.h b/src/Mod/PartDesign/Gui/TaskLoftParameters.h index b99a771edfda..f8ac052a5f43 100644 --- a/src/Mod/PartDesign/Gui/TaskLoftParameters.h +++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.h @@ -61,6 +61,7 @@ private Q_SLOTS: void onRuled(bool); void onDeleteSection(); void indexesMoved(); + void onOutsideChanged(bool); protected: void changeEvent(QEvent *e); diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.ui b/src/Mod/PartDesign/Gui/TaskLoftParameters.ui index 8e0d0b3fa680..6cb62a82999d 100644 --- a/src/Mod/PartDesign/Gui/TaskLoftParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.ui @@ -7,7 +7,7 @@ 0 0 262 - 270 + 337 @@ -28,6 +28,13 @@ + + + + Remove outside of loft + + + diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp index 66465f38149f..76df0086f531 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp @@ -90,6 +90,8 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView, bool /*newObj this, SLOT(onButtonRefRemove(bool))); connect(ui->buttonSpineBase, SIGNAL(toggled(bool)), this, SLOT(onBaseButton(bool))); + connect(ui->checkBoxOutside, SIGNAL(toggled(bool)), + this, SLOT(onOutsideChanged(bool))); // Create context menu QAction* remove = new QAction(tr("Remove"), this); @@ -136,6 +138,9 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView, bool /*newObj ui->comboBoxTransition->setCurrentIndex(pipe->Transition.getValue()); + ui->checkBoxOutside->setVisible(pipe->getAddSubType() == PartDesign::FeatureAddSub::Subtractive); + ui->checkBoxOutside->setChecked(pipe->Outside.getValue()); + updateUI(); } @@ -234,6 +239,12 @@ void TaskPipeParameters::onSelectionChanged(const Gui::SelectionChanges& msg) } } +void TaskPipeParameters::onOutsideChanged(bool on) +{ + static_cast(vp->getObject())->Outside.setValue(on); + recomputeFeature(); +} + void TaskPipeParameters::onTransitionChanged(int idx) { static_cast(vp->getObject())->Transition.setValue(idx); diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.h b/src/Mod/PartDesign/Gui/TaskPipeParameters.h index 16b4ffeea2b7..ce88c778a3fd 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeParameters.h +++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.h @@ -66,6 +66,7 @@ private Q_SLOTS: void onBaseButton(bool checked); void onProfileButton(bool checked); void onDeleteEdge(); + void onOutsideChanged(bool); protected: enum selectionModes { none, refAdd, refRemove, refObjAdd, refProfile }; diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.ui b/src/Mod/PartDesign/Gui/TaskPipeParameters.ui index b2d49fd60e8b..5cb1de1d0277 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.ui @@ -14,6 +14,13 @@ Form + + + + Remove outside of sweep + + + diff --git a/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp b/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp index 6f491c5d1557..e00a3d261dd7 100644 --- a/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp @@ -78,6 +78,7 @@ TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidge Base::Quantity off = pcPocket->Offset.getQuantityValue(); bool midplane = pcPocket->Midplane.getValue(); bool reversed = pcPocket->Reversed.getValue(); + bool outside = pcPocket->Outside.getValue(); int index = pcPocket->Type.getValue(); // must extract value here, clear() kills it! App::DocumentObject* obj = pcPocket->UpToFace.getValue(); std::vector subStrings = pcPocket->UpToFace.getSubValues(); @@ -95,6 +96,7 @@ TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidge ui->offsetEdit->setValue(off); ui->checkBoxMidplane->setChecked(midplane); ui->checkBoxReversed->setChecked(reversed); + ui->checkBoxOutside->setChecked(outside); // Set object labels if (obj && PartDesign::Feature::isDatum(obj)) { @@ -140,6 +142,8 @@ TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidge this, SLOT(onMidplaneChanged(bool))); connect(ui->checkBoxReversed, SIGNAL(toggled(bool)), this, SLOT(onReversedChanged(bool))); + connect(ui->checkBoxOutside, SIGNAL(toggled(bool)), + this, SLOT(onOutsideChanged(bool))); connect(ui->changeMode, SIGNAL(currentIndexChanged(int)), this, SLOT(onModeChanged(int))); connect(ui->buttonFace, SIGNAL(clicked()), @@ -168,11 +172,12 @@ void TaskPocketParameters::updateUI(int index) { // disable/hide everything unless we are sure we don't need it bool isLengthEditVisable = false; - bool isLengthEdit2Visable = false; + bool isLengthEdit2Visable = false; bool isOffsetEditVisable = false; bool isOffsetEditEnabled = true; bool isMidplateEnabled = false; bool isReversedEnabled = false; + bool isOutsideEnabled = false; bool isFaceEditEnabled = false; // dimension @@ -186,6 +191,7 @@ void TaskPocketParameters::updateUI(int index) isMidplateEnabled = true; // Reverse only makes sense if Midplane is not true isReversedEnabled = !ui->checkBoxMidplane->isChecked(); + isOutsideEnabled = true; } // through all else if (index == 1) { @@ -193,6 +199,7 @@ void TaskPocketParameters::updateUI(int index) isOffsetEditEnabled = false; // offset may have some meaning for through all but it doesn't work isMidplateEnabled = true; isReversedEnabled = !ui->checkBoxMidplane->isChecked(); + isOutsideEnabled = true; } // up to first else if (index == 2) { @@ -201,6 +208,7 @@ void TaskPocketParameters::updateUI(int index) // It may work not quite as expected but useful if sketch oriented upside-down. // (may happen in bodies) // FIXME: Fix probably lies somewhere in IF block on line 125 of FeaturePocket.cpp + isOutsideEnabled = false; } // up to face else if (index == 3) { @@ -210,12 +218,14 @@ void TaskPocketParameters::updateUI(int index) // Go into reference selection mode if no face has been selected yet if (ui->lineFaceName->property("FeatureName").isNull()) onButtonFace(true); + isOutsideEnabled = false; } // two dimensions else { isLengthEditVisable = true; isLengthEdit2Visable = true; - } + isOutsideEnabled = true; + } ui->lengthEdit->setVisible( isLengthEditVisable ); ui->lengthEdit->setEnabled( isLengthEditVisable ); @@ -233,6 +243,8 @@ void TaskPocketParameters::updateUI(int index) ui->checkBoxReversed->setEnabled( isReversedEnabled ); + ui->checkBoxOutside->setEnabled( isOutsideEnabled ); + ui->buttonFace->setEnabled( isFaceEditEnabled ); ui->lineFaceName->setEnabled( isFaceEditEnabled ); if (!isFaceEditEnabled) { @@ -304,6 +316,13 @@ void TaskPocketParameters::onReversedChanged(bool on) recomputeFeature(); } +void TaskPocketParameters::onOutsideChanged(bool on) +{ + PartDesign::Pocket* pcPocket = static_cast(vp->getObject()); + pcPocket->Outside.setValue(on); + recomputeFeature(); +} + void TaskPocketParameters::onModeChanged(int index) { PartDesign::Pocket* pcPocket = static_cast(vp->getObject()); @@ -333,7 +352,7 @@ void TaskPocketParameters::onModeChanged(int index) pcPocket->Length.setValue(0.0); ui->lengthEdit->setValue(0.0); break; - default: + default: oldLength = pcPocket->Length.getValue(); pcPocket->Type.setValue("TwoLengths"); } @@ -402,6 +421,11 @@ bool TaskPocketParameters::getMidplane(void) const return ui->checkBoxMidplane->isChecked(); } +bool TaskPocketParameters::getOutside(void) const +{ + return ui->checkBoxOutside->isChecked(); +} + int TaskPocketParameters::getMode(void) const { return ui->changeMode->currentIndex(); @@ -495,6 +519,7 @@ void TaskPocketParameters::apply() FCMD_OBJ_CMD(obj,"UpToFace = " << facename.toLatin1().data()); FCMD_OBJ_CMD(obj,"Reversed = " << (getReversed()?1:0)); FCMD_OBJ_CMD(obj,"Midplane = " << (getMidplane()?1:0)); + FCMD_OBJ_CMD(obj,"Outside = " << (getOutside()?1:0)); FCMD_OBJ_CMD(obj,"Offset = " << getOffset()); } diff --git a/src/Mod/PartDesign/Gui/TaskPocketParameters.h b/src/Mod/PartDesign/Gui/TaskPocketParameters.h index 397b545d16e7..ce484182cab5 100644 --- a/src/Mod/PartDesign/Gui/TaskPocketParameters.h +++ b/src/Mod/PartDesign/Gui/TaskPocketParameters.h @@ -61,6 +61,7 @@ private Q_SLOTS: void onOffsetChanged(double); void onMidplaneChanged(bool); void onReversedChanged(bool); + void onOutsideChanged(bool); void onButtonFace(const bool pressed = true); void onFaceName(const QString& text); void onModeChanged(int); @@ -75,6 +76,7 @@ private Q_SLOTS: int getMode(void) const; bool getMidplane(void) const; bool getReversed(void) const; + bool getOutside(void) const; QString getFaceName(void) const; void onSelectionChanged(const Gui::SelectionChanges& msg) override; diff --git a/src/Mod/PartDesign/Gui/TaskPocketParameters.ui b/src/Mod/PartDesign/Gui/TaskPocketParameters.ui index cf487e40ebe2..079ec9b959e4 100644 --- a/src/Mod/PartDesign/Gui/TaskPocketParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskPocketParameters.ui @@ -6,8 +6,8 @@ 0 0 - 193 - 272 + 282 + 354 @@ -82,6 +82,13 @@ + + + + Remove outside of profile + + + @@ -151,6 +158,7 @@ offsetEdit checkBoxMidplane checkBoxReversed + checkBoxOutside lengthEdit2 buttonFace lineFaceName diff --git a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp index 9563e773cf36..c87e2299ccd7 100644 --- a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp @@ -275,6 +275,12 @@ TaskBoxPrimitives::TaskBoxPrimitives(ViewProviderPrimitive* vp, QWidget* parent) } } + PartDesign::FeaturePrimitive* prim = static_cast(vp->getObject()); + ui->checkBoxOutside->setVisible(prim->getAddSubType() == PartDesign::FeatureAddSub::Subtractive); + ui->checkBoxOutside->setChecked(prim->Outside.getValue()); + + connect(ui->checkBoxOutside, SIGNAL(toggled(bool)), this, SLOT(onOutsideChanged(bool))); + // box connect(ui->boxLength, SIGNAL(valueChanged(double)), this, SLOT(onBoxLengthChanged(double))); connect(ui->boxWidth, SIGNAL(valueChanged(double)), this, SLOT(onBoxWidthChanged(double))); @@ -359,6 +365,13 @@ void TaskBoxPrimitives::slotDeletedObject(const Gui::ViewProviderDocumentObject& this->vp = nullptr; } +void TaskBoxPrimitives::onOutsideChanged(bool on) +{ + PartDesign::FeaturePrimitive* prim = static_cast(vp->getObject()); + prim->Outside.setValue(on); + vp->getObject()->getDocument()->recomputeFeature(vp->getObject()); +} + void TaskBoxPrimitives::onBoxHeightChanged(double v) { PartDesign::Box* box = static_cast(vp->getObject()); box->Height.setValue(v); diff --git a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.h b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.h index b6f49a0e8691..79c7651c21d0 100644 --- a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.h +++ b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.h @@ -100,6 +100,7 @@ public Q_SLOTS: void onWedgeX2minChanged(double); void onWedgeZ2maxChanged(double); void onWedgeZ2minChanged(double); + void onOutsideChanged(bool); private: /** Notifies when the object is about to be removed. */ diff --git a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.ui b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.ui index 70e89795fb5f..11bd4b3d8fd7 100644 --- a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.ui @@ -2346,6 +2346,13 @@ If zero, it is equal to Radius2 + + + + Remove outside of primitive + + + diff --git a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp index 892ad00ffa0e..4634945bb932 100644 --- a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp @@ -84,8 +84,11 @@ TaskRevolutionParameters::TaskRevolutionParameters(PartDesignGui::ViewProvider* this->propReferenceAxis = &(rev->ReferenceAxis); this->propReversed = &(rev->Reversed); ui->revolveAngle->bind(rev->Angle); + ui->checkBoxOutside->setChecked(rev->Outside.getValue()); } + ui->checkBoxOutside->setVisible(pcFeat->isDerivedFrom(PartDesign::Groove::getClassTypeId())); + ui->checkBoxMidplane->setChecked(propMidPlane->getValue()); ui->checkBoxReversed->setChecked(propReversed->getValue()); @@ -207,6 +210,8 @@ void TaskRevolutionParameters::connectSignals() this, SLOT(onReversed(bool))); connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)), this, SLOT(onUpdateView(bool))); + connect(ui->checkBoxOutside, SIGNAL(toggled(bool)), + this, SLOT(onOutsideChanged(bool))); } void TaskRevolutionParameters::updateUI() @@ -315,6 +320,13 @@ void TaskRevolutionParameters::onReversed(bool on) recomputeFeature(); } +void TaskRevolutionParameters::onOutsideChanged(bool on) +{ + PartDesign::Groove* rev = static_cast(vp->getObject()); + rev->Outside.setValue(on); + recomputeFeature(); +} + double TaskRevolutionParameters::getAngle(void) const { return ui->revolveAngle->value().getValue(); diff --git a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.h b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.h index 73f8a17cca68..289790c80e5b 100644 --- a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.h +++ b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.h @@ -70,6 +70,7 @@ private Q_SLOTS: void onAxisChanged(int); void onMidplane(bool); void onReversed(bool); + void onOutsideChanged(bool); protected: void onSelectionChanged(const Gui::SelectionChanges& msg) override; diff --git a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.ui b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.ui index 3fbebd6f6b61..24f7fc44a444 100644 --- a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.ui @@ -109,6 +109,13 @@ + + + + Remove outside profile + + +