From 25c7e389a9d4892ec43f7957cf99652c816f8975 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Tue, 11 Apr 2023 20:01:29 -0400 Subject: [PATCH] [TD]fix ShapeExtractor error - recent changes caused ShapeExtractor to return only the first source shape encountered instead of gathering all source shapes. --- src/Mod/TechDraw/App/ShapeExtractor.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Mod/TechDraw/App/ShapeExtractor.cpp b/src/Mod/TechDraw/App/ShapeExtractor.cpp index 005c8a8938..6306688342 100644 --- a/src/Mod/TechDraw/App/ShapeExtractor.cpp +++ b/src/Mod/TechDraw/App/ShapeExtractor.cpp @@ -115,6 +115,7 @@ TopoDS_Shape ShapeExtractor::getShapes(const std::vector l BRep_Builder builder; TopoDS_Compound comp; builder.MakeCompound(comp); + bool found = false; for (auto& s:sourceShapes) { if (s.IsNull()) { continue; @@ -123,21 +124,24 @@ TopoDS_Shape ShapeExtractor::getShapes(const std::vector l TopoDS_Shape cleanShape = stripInfiniteShapes(s); if (!cleanShape.IsNull()) { builder.Add(comp, cleanShape); - return comp; + found = true; } } else if (Part::TopoShape(s).isInfinite()) { continue; //simple shape is infinite } else { //a simple shape - add to compound builder.Add(comp, s); - return comp; + found = true; } } //it appears that an empty compound is !IsNull(), so we need to check a different way //if we added anything to the compound. - //Nothing found + if (found) { +// BRepTools::Write(comp, "SEResult.brep"); //debug + return comp; + } + Base::Console().Error("ShapeExtractor failed to get shape.\n"); -// BRepTools::Write(result, "SEresult.brep"); //debug return TopoDS_Shape(); }