From 5d9db07ddd4473e50adcac6ad509e6727fc4f2f8 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 6 Jan 2021 15:39:25 +0100 Subject: [PATCH] Part: [skip ci] in TopoShape::getMemSize() handle edges or faces with no attached geometry --- src/Mod/Part/App/TopoShape.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index a6cacd40b8..847e0207e0 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -1339,6 +1339,9 @@ unsigned int TopoShape::getMemSize (void) const TopExp::MapShapes(_Shape, M); for (int i=0; iDynamicType()->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: