diff --git a/src/Mod/TechDraw/App/ShapeExtractor.cpp b/src/Mod/TechDraw/App/ShapeExtractor.cpp index f28fb98c9c..e1073298d3 100644 --- a/src/Mod/TechDraw/App/ShapeExtractor.cpp +++ b/src/Mod/TechDraw/App/ShapeExtractor.cpp @@ -115,7 +115,6 @@ TopoDS_Shape ShapeExtractor::getShapes(const std::vector l } else { auto shape = Part::Feature::getShape(l); if(!shape.IsNull()) { - // BRepTools::Write(shape, "DVPgetShape.brep"); //debug sourceShapes.push_back(shape); } else { std::vector shapeList = getShapesFromObject(l); @@ -129,21 +128,31 @@ TopoDS_Shape ShapeExtractor::getShapes(const std::vector l builder.MakeCompound(comp); bool found = false; for (auto& s:sourceShapes) { - if (s.IsNull() || Part::TopoShape(s).isInfinite()) { - continue; // has no shape or the shape is infinite + if (s.ShapeType() < TopAbs_SOLID) { + //clean up composite shapes + TopoDS_Shape cleanShape = stripInfiniteShapes(s); + if (!cleanShape.IsNull()) { + builder.Add(comp, cleanShape); + found = true; + } + } else if (s.IsNull()) { + continue; // has no shape + } else if (Part::TopoShape(s).isInfinite()) { + continue; //shape is infinite + } else { + //a simple shape - add to compound + builder.Add(comp, s); + found = true; } - found = true; - BRepBuilderAPI_Copy BuilderCopy(s); - TopoDS_Shape shape = BuilderCopy.Shape(); - builder.Add(comp, shape); } //it appears that an empty compound is !IsNull(), so we need to check a different way //if we added anything to the compound. if (!found) { - Base::Console().Error("SE::getSourceShapes - source shape is empty!\n"); + Base::Console().Error("SE::getShapes - source shape is empty!\n"); } else { result = comp; } +// BRepTools::Write(result, "SEresult.brep"); //debug return result; } @@ -293,6 +302,32 @@ TopoDS_Shape ShapeExtractor::getShapesFused(const std::vectorgetNameInDocument()); bool result = false; - Base::Type t = obj->getTypeId(); - if (t.isDerivedFrom(Part::Vertex::getClassTypeId())) { - result = true; - } else if (isDraftPoint(obj)) { - result = true; + if (obj) { + Base::Type t = obj->getTypeId(); + if (t.isDerivedFrom(Part::Vertex::getClassTypeId())) { + result = true; + } else if (isDraftPoint(obj)) { + result = true; + } } return result; } diff --git a/src/Mod/TechDraw/App/ShapeExtractor.h b/src/Mod/TechDraw/App/ShapeExtractor.h index 23e09717ae..e2c9462ac7 100644 --- a/src/Mod/TechDraw/App/ShapeExtractor.h +++ b/src/Mod/TechDraw/App/ShapeExtractor.h @@ -52,6 +52,8 @@ public: static Base::Vector3d getLocation3dFromFeat(App::DocumentObject* obj); static bool prefAdd2d(void); + static TopoDS_Shape stripInfiniteShapes(TopoDS_Shape inShape); + protected: private: