From 3a93be7c44560f27df8d6e5b9ef859a470c0b954 Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Sun, 3 Feb 2019 02:39:01 +0300 Subject: [PATCH] PartDesign: Shapebinder: fix placement reported by koluna: https://forum.freecadweb.org/viewtopic.php?f=20&t=33794 --- src/Mod/PartDesign/App/ShapeBinder.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Mod/PartDesign/App/ShapeBinder.cpp b/src/Mod/PartDesign/App/ShapeBinder.cpp index bc01776e5b..a5fb4482f3 100644 --- a/src/Mod/PartDesign/App/ShapeBinder.cpp +++ b/src/Mod/PartDesign/App/ShapeBinder.cpp @@ -76,16 +76,20 @@ App::DocumentObjectExecReturn* ShapeBinder::execute(void) { //if we have a link we rebuild the shape, but we change nothing if we are a simple copy if (obj) { Part::TopoShape shape = ShapeBinder::buildShapeFromReferences(obj, subs); - Base::Placement placement(shape.getTransform()); - Shape.setValue(shape); + //now, shape is in object's CS, and includes local Placement of obj but nothing else. if (TraceSupport.getValue()) { - // this is the inverted global placement of the parent group ... - placement = this->globalPlacement() * Placement.getValue().inverse(); - // multiplied with the global placement of the support shape - placement = placement.inverse() * obj->globalPlacement(); + //compute the transform, and apply it to the shape. + Base::Placement sourceCS = //full placement of container of obj + obj->globalPlacement() * obj->Placement.getValue().inverse(); + Base::Placement targetCS = //full placement of container of this shapebinder + this->globalPlacement() * this->Placement.getValue().inverse(); + Base::Placement transform = targetCS.inverse() * sourceCS; + shape.setPlacement(transform * shape.getPlacement()); } - Placement.setValue(placement); + + this->Placement.setValue(shape.getTransform()); + this->Shape.setValue(shape); } }