PartDesign: Shapebinder: fix placement

reported by koluna:
https://forum.freecadweb.org/viewtopic.php?f=20&t=33794
This commit is contained in:
DeepSOIC
2019-02-03 02:39:01 +03:00
committed by Yorik van Havre
parent e49a45a46d
commit 3a93be7c44

View File

@@ -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);
}
}