FIX: step model split COMPOUND and COMPOUNSOLID type (#8084)

JIRA:STUDIO-5632

GITHUB: #3153
Change-Id: I1b9b49321cc0da8bdd79e2beb4009283cfada287
(cherry picked from commit 6191a66441549b1cee8be8d7f740c2d466557691)
(cherry picked from commit 90f325792dc4910b80d69c9d6a5677f24b8fa259)

Co-authored-by: Mack <yongfang.bian@bambulab.com>
This commit is contained in:
Noisyfox 2025-01-22 10:03:43 +08:00 committed by GitHub
parent 6cdede8e10
commit 16340fd6b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -197,15 +197,19 @@ static void getNamedSolids(const TopLoc_Location& location, const std::string& p
}
} else {
TopoDS_Shape shape;
TopExp_Explorer explorer;
shapeTool->GetShape(referredLabel, shape);
TopAbs_ShapeEnum shape_type = shape.ShapeType();
BRepBuilderAPI_Transform transform(shape, localLocation, Standard_True);
int i = 0;
switch (shape_type) {
case TopAbs_COMPOUND:
namedSolids.emplace_back(TopoDS::Compound(transform.Shape()), fullName);
break;
case TopAbs_COMPSOLID:
namedSolids.emplace_back(TopoDS::CompSolid(transform.Shape()), fullName);
for (explorer.Init(transform.Shape(), TopAbs_SOLID); explorer.More(); explorer.Next()) {
i++;
const TopoDS_Shape& currentShape = explorer.Current();
namedSolids.emplace_back(TopoDS::Solid(currentShape), fullName + "-SOLID-" + std::to_string(i));
}
break;
case TopAbs_SOLID:
namedSolids.emplace_back(TopoDS::Solid(transform.Shape()), fullName);