diff --git a/src/Mod/PartDesign/App/AppPartDesign.cpp b/src/Mod/PartDesign/App/AppPartDesign.cpp index 16620762f..5628cc809 100644 --- a/src/Mod/PartDesign/App/AppPartDesign.cpp +++ b/src/Mod/PartDesign/App/AppPartDesign.cpp @@ -83,7 +83,7 @@ void PartDesignExport initPartDesign() PartDesign::Pocket ::init(); PartDesign::Fillet ::init(); PartDesign::Revolution ::init(); - PartDesign::Groove ::init(); + PartDesign::Groove ::init(); PartDesign::Chamfer ::init(); PartDesign::Face ::init(); } diff --git a/src/Mod/PartDesign/App/FeatureChamfer.cpp b/src/Mod/PartDesign/App/FeatureChamfer.cpp index e14406e92..42d82b923 100644 --- a/src/Mod/PartDesign/App/FeatureChamfer.cpp +++ b/src/Mod/PartDesign/App/FeatureChamfer.cpp @@ -52,11 +52,9 @@ Chamfer::Chamfer() short Chamfer::mustExecute() const { - if (Placement.isTouched() || Base.isTouched() || Size.isTouched()) + if (Placement.isTouched() || Size.isTouched()) return 1; - if (Base.getValue() && Base.getValue()->isTouched()) - return 1; - return 0; + return DressUp::mustExecute(); } App::DocumentObjectExecReturn *Chamfer::execute(void) diff --git a/src/Mod/PartDesign/App/FeatureDressUp.cpp b/src/Mod/PartDesign/App/FeatureDressUp.cpp index da69c80ed..b957fedfc 100644 --- a/src/Mod/PartDesign/App/FeatureDressUp.cpp +++ b/src/Mod/PartDesign/App/FeatureDressUp.cpp @@ -41,6 +41,14 @@ DressUp::DressUp() ADD_PROPERTY(Base,(0)); } +short DressUp::mustExecute() const +{ + if (Base.getValue() && Base.getValue()->isTouched()) + return 1; + return PartDesign::Feature::mustExecute(); +} + + void DressUp::positionByBase(void) { Part::Feature *base = static_cast(Base.getValue()); diff --git a/src/Mod/PartDesign/App/FeatureDressUp.h b/src/Mod/PartDesign/App/FeatureDressUp.h index 44236f26a..52aa6b335 100644 --- a/src/Mod/PartDesign/App/FeatureDressUp.h +++ b/src/Mod/PartDesign/App/FeatureDressUp.h @@ -39,6 +39,7 @@ public: App::PropertyLinkSub Base; + short mustExecute() const; /// updates the Placement property from the Placement of Base void positionByBase(void); diff --git a/src/Mod/PartDesign/App/FeatureFace.cpp b/src/Mod/PartDesign/App/FeatureFace.cpp index e2786b069..5bf37da33 100644 --- a/src/Mod/PartDesign/App/FeatureFace.cpp +++ b/src/Mod/PartDesign/App/FeatureFace.cpp @@ -62,7 +62,7 @@ short Face::mustExecute() const { if (Sources.isTouched()) return 1; - return 0; + return Part::Part2DObject::mustExecute(); } App::DocumentObjectExecReturn *Face::execute(void) diff --git a/src/Mod/PartDesign/App/FeatureFillet.cpp b/src/Mod/PartDesign/App/FeatureFillet.cpp index 3b9470c51..8f9d8d3e8 100644 --- a/src/Mod/PartDesign/App/FeatureFillet.cpp +++ b/src/Mod/PartDesign/App/FeatureFillet.cpp @@ -49,11 +49,9 @@ Fillet::Fillet() short Fillet::mustExecute() const { - if (Placement.isTouched() || Base.isTouched() || Radius.isTouched()) + if (Placement.isTouched() || Radius.isTouched()) return 1; - if (Base.getValue() && Base.getValue()->isTouched()) - return 1; - return 0; + return DressUp::mustExecute(); } App::DocumentObjectExecReturn *Fillet::execute(void) diff --git a/src/Mod/PartDesign/App/FeatureGroove.cpp b/src/Mod/PartDesign/App/FeatureGroove.cpp index 1cf17541d..baa60683e 100644 --- a/src/Mod/PartDesign/App/FeatureGroove.cpp +++ b/src/Mod/PartDesign/App/FeatureGroove.cpp @@ -48,7 +48,7 @@ using namespace PartDesign; namespace PartDesign { -PROPERTY_SOURCE(PartDesign::Groove, PartDesign::SketchBased) +PROPERTY_SOURCE(PartDesign::Groove, PartDesign::Subtractive) Groove::Groove() { @@ -63,7 +63,6 @@ Groove::Groove() short Groove::mustExecute() const { if (Placement.isTouched() || - Sketch.isTouched() || ReferenceAxis.isTouched() || Axis.isTouched() || Base.isTouched() || @@ -71,7 +70,7 @@ short Groove::mustExecute() const Midplane.isTouched() || Reversed.isTouched()) return 1; - return 0; + return Subtractive::mustExecute(); } App::DocumentObjectExecReturn *Groove::execute(void) diff --git a/src/Mod/PartDesign/App/FeatureGroove.h b/src/Mod/PartDesign/App/FeatureGroove.h index 5f17ce092..ec13362d3 100644 --- a/src/Mod/PartDesign/App/FeatureGroove.h +++ b/src/Mod/PartDesign/App/FeatureGroove.h @@ -25,12 +25,12 @@ #define PARTDESIGN_Groove_H #include -#include "FeatureSketchBased.h" +#include "FeatureSubtractive.h" namespace PartDesign { -class PartDesignExport Groove : public SketchBased +class PartDesignExport Groove : public Subtractive { PROPERTY_HEADER(PartDesign::Groove); diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index 25c7483e0..c16d6a7f7 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -53,7 +53,7 @@ const char* Hole::TypeEnums[] = {"Dimension","UpToLast","UpToFirst",NULL}; const char* Hole::HoleTypeEnums[]= {"Simple","Counterbore","Countersunk",NULL}; const char* Hole::ThreadEnums[] = {"None","Metric","MetricFine",NULL}; -PROPERTY_SOURCE(PartDesign::Hole, PartDesign::SketchBased) +PROPERTY_SOURCE(PartDesign::Hole, PartDesign::Subtractive) Hole::Hole() { @@ -72,7 +72,7 @@ Hole::Hole() // if (Sketch.isTouched() || // Length.isTouched()) // return 1; -// return 0; +// return Subtractive::mustExecute(); //} App::DocumentObjectExecReturn *Hole::execute(void) @@ -134,6 +134,8 @@ App::DocumentObjectExecReturn *Hole::execute(void) //if (PrismMaker.IsDone()) { // // if the sketch has a support fuse them to get one result object (PAD!) // if (SupportObject) { + // // Set the subtractive shape property for later usage in e.g. pattern + // this->SubShape.setValue(PrismMaker.Shape()); // const TopoDS_Shape& support = SupportObject->Shape.getValue(); // if (support.IsNull()) // return new App::DocumentObjectExecReturn("Support shape is invalid"); diff --git a/src/Mod/PartDesign/App/FeaturePad.cpp b/src/Mod/PartDesign/App/FeaturePad.cpp index 8335668ae..cc7f18ebe 100644 --- a/src/Mod/PartDesign/App/FeaturePad.cpp +++ b/src/Mod/PartDesign/App/FeaturePad.cpp @@ -68,14 +68,13 @@ Pad::Pad() short Pad::mustExecute() const { if (Placement.isTouched() || - Sketch.isTouched() || Length.isTouched() || Midplane.isTouched() || Reversed.isTouched() || Length2.isTouched() || FaceName.isTouched()) return 1; - return 0; + return Additive::mustExecute(); } App::DocumentObjectExecReturn *Pad::execute(void) diff --git a/src/Mod/PartDesign/App/FeaturePocket.cpp b/src/Mod/PartDesign/App/FeaturePocket.cpp index beec62191..074c7b00f 100644 --- a/src/Mod/PartDesign/App/FeaturePocket.cpp +++ b/src/Mod/PartDesign/App/FeaturePocket.cpp @@ -56,7 +56,7 @@ using namespace PartDesign; const char* Pocket::TypeEnums[]= {"Length","UpToLast","UpToFirst","ThroughAll","UpToFace",NULL}; -PROPERTY_SOURCE(PartDesign::Pocket, PartDesign::SketchBased) +PROPERTY_SOURCE(PartDesign::Pocket, PartDesign::Subtractive) Pocket::Pocket() { @@ -69,11 +69,10 @@ Pocket::Pocket() short Pocket::mustExecute() const { if (Placement.isTouched() || - Sketch.isTouched() || Length.isTouched() || FaceName.isTouched()) return 1; - return 0; + return Subtractive::mustExecute(); } App::DocumentObjectExecReturn *Pocket::execute(void) @@ -255,8 +254,7 @@ App::DocumentObjectExecReturn *Pocket::execute(void) return new App::DocumentObjectExecReturn("Internal error: Unknown type for Pocket feature"); } - // TODO: Set the subtractive shape property for later usage in e.g. pattern - //this->SubShape.setValue(prism); // This crashes with "Illegal storage access". Why? + this->SubShape.setValue(prism); // Cut out the pocket BRepAlgoAPI_Cut mkCut(support.Moved(invObjLoc), prism); diff --git a/src/Mod/PartDesign/App/FeatureRevolution.cpp b/src/Mod/PartDesign/App/FeatureRevolution.cpp index a31bebf43..32acdb705 100644 --- a/src/Mod/PartDesign/App/FeatureRevolution.cpp +++ b/src/Mod/PartDesign/App/FeatureRevolution.cpp @@ -48,7 +48,7 @@ using namespace PartDesign; namespace PartDesign { -PROPERTY_SOURCE(PartDesign::Revolution, PartDesign::SketchBased) +PROPERTY_SOURCE(PartDesign::Revolution, PartDesign::Additive) Revolution::Revolution() { @@ -63,7 +63,6 @@ Revolution::Revolution() short Revolution::mustExecute() const { if (Placement.isTouched() || - Sketch.isTouched() || ReferenceAxis.isTouched() || Axis.isTouched() || Base.isTouched() || @@ -71,7 +70,7 @@ short Revolution::mustExecute() const Midplane.isTouched() || Reversed.isTouched()) return 1; - return 0; + return Additive::mustExecute(); } App::DocumentObjectExecReturn *Revolution::execute(void) @@ -183,6 +182,8 @@ App::DocumentObjectExecReturn *Revolution::execute(void) if (SupportObject) { const TopoDS_Shape& support = SupportObject->Shape.getValue(); if (!support.IsNull() && support.ShapeType() == TopAbs_SOLID) { + // set the additive shape property for later usage in e.g. pattern + this->AddShape.setValue(result); // Let's call algorithm computing a fuse operation: BRepAlgoAPI_Fuse mkFuse(support.Moved(invObjLoc), result); // Let's check if the fusion has been successful diff --git a/src/Mod/PartDesign/App/FeatureRevolution.h b/src/Mod/PartDesign/App/FeatureRevolution.h index 19166e2d5..976f473d2 100644 --- a/src/Mod/PartDesign/App/FeatureRevolution.h +++ b/src/Mod/PartDesign/App/FeatureRevolution.h @@ -25,12 +25,12 @@ #define PARTDESIGN_Revolution_H #include -#include "FeatureSketchBased.h" +#include "FeatureAdditive.h" namespace PartDesign { -class PartDesignExport Revolution : public SketchBased +class PartDesignExport Revolution : public Additive { PROPERTY_HEADER(PartDesign::Revolution); diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index ce6323632..3d1bcd092 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -77,6 +77,13 @@ SketchBased::SketchBased() ADD_PROPERTY(Sketch,(0)); } +short SketchBased::mustExecute() const +{ + if (Sketch.isTouched()) + return 1; + return 0; // PartDesign::Feature::mustExecute(); +} + void SketchBased::positionBySketch(void) { Part::Part2DObject *sketch = static_cast(Sketch.getValue()); diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.h b/src/Mod/PartDesign/App/FeatureSketchBased.h index 8fab20939..b99d6a15a 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.h +++ b/src/Mod/PartDesign/App/FeatureSketchBased.h @@ -42,6 +42,8 @@ public: App::PropertyLink Sketch; + short mustExecute() const; + /** calculates and updates the Placement property based on the Sketch * or its support if it has one */