[TD]trap null 2d shape in ShapeExtractor

This commit is contained in:
wandererfan
2023-11-04 09:44:25 -04:00
committed by WandererFan
parent b8278718e9
commit 2954cfa2b6

View File

@@ -57,7 +57,7 @@ using SU = ShapeUtils;
std::vector<TopoDS_Shape> ShapeExtractor::getShapes2d(const std::vector<App::DocumentObject*> links, bool overridePref)
{
// Base::Console().Message("SE::getShapes2d()\n");
// Base::Console().Message("SE::getShapes2d() - links: %d\n", links.size());
std::vector<TopoDS_Shape> shapes2d;
if (!prefAdd2d() && !overridePref) {
@@ -66,19 +66,25 @@ std::vector<TopoDS_Shape> ShapeExtractor::getShapes2d(const std::vector<App::Doc
for (auto& l:links) {
const App::GroupExtension* gex = dynamic_cast<const App::GroupExtension*>(l);
if (gex) {
std::vector<App::DocumentObject*> objs = gex->Group.getValues();
for (auto& d: objs) {
if (is2dObject(d)) {
if (d->isDerivedFrom<Part::Feature>()) {
shapes2d.push_back(getLocatedShape(d));
std::vector<App::DocumentObject*> 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<Part::Feature>()) {
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?
}
}
}