From 2954cfa2b6c61fb32689ef21d12449cffe72aead Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sat, 4 Nov 2023 09:44:25 -0400 Subject: [PATCH] [TD]trap null 2d shape in ShapeExtractor --- src/Mod/TechDraw/App/ShapeExtractor.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Mod/TechDraw/App/ShapeExtractor.cpp b/src/Mod/TechDraw/App/ShapeExtractor.cpp index e981826e7d..f647ccea48 100644 --- a/src/Mod/TechDraw/App/ShapeExtractor.cpp +++ b/src/Mod/TechDraw/App/ShapeExtractor.cpp @@ -57,7 +57,7 @@ using SU = ShapeUtils; std::vector ShapeExtractor::getShapes2d(const std::vector links, bool overridePref) { -// Base::Console().Message("SE::getShapes2d()\n"); +// Base::Console().Message("SE::getShapes2d() - links: %d\n", links.size()); std::vector shapes2d; if (!prefAdd2d() && !overridePref) { @@ -66,19 +66,25 @@ std::vector ShapeExtractor::getShapes2d(const std::vector(l); if (gex) { - std::vector objs = gex->Group.getValues(); - for (auto& d: objs) { - if (is2dObject(d)) { - if (d->isDerivedFrom()) { - shapes2d.push_back(getLocatedShape(d)); + std::vector groupAll = gex->Group.getValues(); + for (auto& item : groupAll) { + if (is2dObject(item)) { + if (item->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { + TopoDS_Shape temp = getLocatedShape(item); + if (!temp.IsNull()) { + shapes2d.push_back(temp); + } } } } } else { if (is2dObject(l)) { - if (l->isDerivedFrom()) { - shapes2d.push_back(getLocatedShape(l)); - } // other 2d objects would go here - Draft objects? + if (l->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { + TopoDS_Shape temp = getLocatedShape(l); + if (!temp.IsNull()) { + shapes2d.push_back(temp); + } + } // other 2d objects would go here - Draft objects? Arch Axis? } } }