Part: [skip ci] in TopoShape::getMemSize() handle edges or faces with no attached geometry

This commit is contained in:
wmayer
2021-01-06 15:39:25 +01:00
parent ec73869d1c
commit 5d9db07ddd

View File

@@ -1339,6 +1339,9 @@ unsigned int TopoShape::getMemSize (void) const
TopExp::MapShapes(_Shape, M);
for (int i=0; i<M.Extent(); i++) {
const TopoDS_Shape& shape = M(i+1);
if (shape.IsNull())
continue;
// add the size of the underlying geomtric data
Handle(TopoDS_TShape) tshape = shape.TShape();
memsize += tshape->DynamicType()->Size();
@@ -1350,7 +1353,15 @@ unsigned int TopoShape::getMemSize (void) const
// first, last, tolerance
memsize += 5*sizeof(Standard_Real);
const TopoDS_Face& face = TopoDS::Face(shape);
BRepAdaptor_Surface surface(face);
// if no geometry is attached to a face an exception is raised
BRepAdaptor_Surface surface;
try {
surface.Initialize(face);
}
catch (const Standard_Failure&) {
continue;
}
switch (surface.GetType())
{
case GeomAbs_Plane:
@@ -1398,7 +1409,15 @@ unsigned int TopoShape::getMemSize (void) const
// first, last, tolerance
memsize += 3*sizeof(Standard_Real);
const TopoDS_Edge& edge = TopoDS::Edge(shape);
BRepAdaptor_Curve curve(edge);
// if no geometry is attached to an edge an exception is raised
BRepAdaptor_Curve curve;
try {
curve.Initialize(edge);
}
catch (const Standard_Failure&) {
continue;
}
switch (curve.GetType())
{
case GeomAbs_Line: