Toponaming/Part: Fix review items

This commit is contained in:
bgbsww
2024-04-10 12:14:01 -04:00
parent 942ebd58f0
commit 239c3e6f78
2 changed files with 5 additions and 22 deletions

View File

@@ -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)

View File

@@ -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