From 03d7b83adb37cc2288acef280ab7b99d79b453fe Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Sun, 3 Feb 2019 02:37:10 +0300 Subject: [PATCH] PartDesign: Shapebinder: use compound instead of fusion --- src/Mod/PartDesign/App/ShapeBinder.cpp | 29 +++++++++++++------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Mod/PartDesign/App/ShapeBinder.cpp b/src/Mod/PartDesign/App/ShapeBinder.cpp index 05f382aa1a..bc01776e5b 100644 --- a/src/Mod/PartDesign/App/ShapeBinder.cpp +++ b/src/Mod/PartDesign/App/ShapeBinder.cpp @@ -25,6 +25,7 @@ #ifndef _PreComp_ #include #include +#include #include #endif @@ -145,24 +146,24 @@ Part::TopoShape ShapeBinder::buildShapeFromReferences( Part::Feature* obj, std:: if (subs.empty()) return obj->Shape.getShape(); - //if we use multiple subshapes we build a shape from them by fusing them together - Part::TopoShape base; - std::vector operators; + std::vector shapes; for (std::string sub : subs) { - if (base.isNull()) - base = obj->Shape.getShape().getSubShape(sub.c_str()); - else - operators.push_back(obj->Shape.getShape().getSubShape(sub.c_str())); + shapes.push_back(obj->Shape.getShape().getSubShape(sub.c_str())); } - try { - if (!operators.empty() && !base.isNull()) - return base.fuse(operators); + if (shapes.size() == 1){ + //single subshape. Return directly. + return shapes[0]; + } else { + //multiple subshapes. Make a compound. + BRep_Builder builder; + TopoDS_Compound cmp; + builder.MakeCompound(cmp); + for(const TopoDS_Shape& sh : shapes){ + builder.Add(cmp, sh); + } + return cmp; } - catch (...) { - return base; - } - return base; } void ShapeBinder::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)