diff --git a/src/Mod/PartDesign/App/Feature.cpp b/src/Mod/PartDesign/App/Feature.cpp index 28d37c9c45..e61490b9e9 100644 --- a/src/Mod/PartDesign/App/Feature.cpp +++ b/src/Mod/PartDesign/App/Feature.cpp @@ -101,31 +101,14 @@ TopoDS_Shape Feature::getSolid(const TopoDS_Shape& shape) return {}; } -TopoShape Feature::getSolid(const TopoShape& shape, bool force) +TopoShape Feature::getSolid(const TopoShape& shape) { if (shape.isNull()) { throw Part::NullShapeException("Null shape"); } - int count = shape.countSubShapes(TopAbs_SOLID); - if (count > 1) { - if (getFeatureBody()) { - auto res = shape; - res.fixSolidOrientation(); - return res; - } - throw Base::RuntimeError( - "Result has multiple solids.\n" - "To allow multiple solids, please set 'SingleSolid' property of the body to false"); - } - if (count) { - auto res = shape.getSubTopoShape(TopAbs_SOLID, 1); - res.fixSolidOrientation(); - return res; - } - if (force) { - return TopoShape(); - } - return shape; + auto res = shape.getSubTopoShape(TopAbs_SOLID, 1); + res.fixSolidOrientation(); + return res; } int Feature::countSolids(const TopoDS_Shape& shape, TopAbs_ShapeEnum type) diff --git a/src/Mod/PartDesign/App/Feature.h b/src/Mod/PartDesign/App/Feature.h index 8f901f9eeb..8147024f49 100644 --- a/src/Mod/PartDesign/App/Feature.h +++ b/src/Mod/PartDesign/App/Feature.h @@ -96,7 +96,7 @@ protected: */ // TODO: Toponaming April 2024 Deprecated in favor of TopoShape method. Remove when possible. static TopoDS_Shape getSolid(const TopoDS_Shape&); - TopoShape getSolid(const TopoShape&, bool force = true); + TopoShape getSolid(const TopoShape&); static int countSolids(const TopoDS_Shape&, TopAbs_ShapeEnum type = TopAbs_SOLID); /// Grab any point from the given face