TopoDS_Shape anOcctShape = myShape->GetShape();
- if (anOcctShape.ShapeType() == TopAbs_COMPOUND)
+ if (anOcctShape.ShapeType() == TopAbs_COMPOUND && anOcctShape.NbChildren() == 0)
{
- TopoDS_Iterator anExplor (anOcctShape);
- if (!anExplor.More()) // Shape empty -> go away
- {
- return;
- }
+ // Shape empty -> go away
+ return;
}
TopAbs_ShapeEnum aTypeOfSel = AIS_Shape::SelectionType (theMode);
TopoDS_Shape anOcctShape = myShape->GetShape();
- if (anOcctShape.ShapeType() == TopAbs_COMPOUND)
+ if (anOcctShape.ShapeType() == TopAbs_COMPOUND && anOcctShape.NbChildren() == 0)
{
- TopoDS_Iterator anExplor (anOcctShape);
- if (!anExplor.More())
- { // Shape empty -> nothing to do
- myBndBox.SetVoid();
- return myBndBox;
- }
+ // Shape empty -> nothing to do
+ myBndBox.SetVoid ();
+ return myBndBox;
}
if (myBndBox.IsVoid())
{
- // Add only edges and vertices, in case of troubles this should work anyway
- BRepBndLib::AddClose (anOcctShape, myBndBox);
+ BRepBndLib::Add (anOcctShape, myBndBox, true);
}
return myBndBox;