diff --git a/src/Mod/PartDesign/App/Body.cpp b/src/Mod/PartDesign/App/Body.cpp index ff92107892..95e101d549 100644 --- a/src/Mod/PartDesign/App/Body.cpp +++ b/src/Mod/PartDesign/App/Body.cpp @@ -183,35 +183,22 @@ bool Body::isAfterInsertPoint(App::DocumentObject* feature) { } } -bool Body::isMemberOfMultiTransform(const App::DocumentObject* obj) -{ - if (!obj) - return false; - - // ORIGINAL COMMENT: - // This can be recognized because the Originals property is empty (it is contained - // in the MultiTransform instead) - // COMMENT ON THE COMMENT: - // This is wrong because at the creation (addObject) and before assigning the originals, that - // is when this code is executed, the originals property is indeed empty. - // - // However, for the purpose of setting the base feature, the transform feature has been modified - // to auto set it when the originals are not null. See: - // App::DocumentObjectExecReturn *Transformed::execute(void) - // - return (obj->isDerivedFrom() && - static_cast(obj)->Originals.getValues().empty()); -} - bool Body::isSolidFeature(const App::DocumentObject *obj) { - if (!obj) + if (!obj) { return false; + } - if (obj->isDerivedFrom() && - !PartDesign::Feature::isDatum(obj)) { - // Transformed Features inside a MultiTransform are not solid features - return !isMemberOfMultiTransform(obj); + if (obj->isDerivedFrom()) { + if (PartDesign::Feature::isDatum(obj)) { + // Datum objects are not solid + return false; + } + if (auto transFeature = Base::freecad_dynamic_cast(obj)) { + // Transformed Features inside a MultiTransform are not solid features + return !transFeature->isMultiTransformChild(); + } + return true; } return false;//DeepSOIC: work-in-progress? } diff --git a/src/Mod/PartDesign/App/Body.h b/src/Mod/PartDesign/App/Body.h index e36f751960..b905fd2997 100644 --- a/src/Mod/PartDesign/App/Body.h +++ b/src/Mod/PartDesign/App/Body.h @@ -91,9 +91,6 @@ public: */ bool isAfterInsertPoint(App::DocumentObject* feature); - /// Return true if the given feature is member of a MultiTransform feature - static bool isMemberOfMultiTransform(const App::DocumentObject *obj); - /** * Return true if the given feature is a solid feature allowed in a Body. Currently this is only valid * for features derived from PartDesign::Feature diff --git a/src/Mod/PartDesign/App/FeatureTransformed.h b/src/Mod/PartDesign/App/FeatureTransformed.h index a549b449bd..18c93e8194 100644 --- a/src/Mod/PartDesign/App/FeatureTransformed.h +++ b/src/Mod/PartDesign/App/FeatureTransformed.h @@ -70,6 +70,9 @@ public: /// Return the sketch of the first original App::DocumentObject* getSketchObject() const; + /// Return true if this feature is a child of a MultiTransform + bool isMultiTransformChild() const; + /// Get the list of transformations describing the members of the pattern // Note: Only the Scaled feature requires the originals virtual const std::list @@ -102,8 +105,6 @@ protected: const char* TypeName, App::Property* prop) override; - /// Return true if this feature is a child of a MultiTransform - bool isMultiTransformChild() const; virtual void positionBySupport(); TopoDS_Shape refineShapeIfActive(const TopoDS_Shape&) const; static TopoDS_Shape getRemainingSolids(const TopoDS_Shape&);