App::DocumentObjectExecReturn* ShapeBinder::execute(void) { if (!this->isRestoring()) { Part::Feature* obj = nullptr; std::vector<std::string> subs; ShapeBinder::getFilteredReferences(&Support, obj, subs); //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); //now, shape is in object's CS, and includes local Placement of obj but nothing else. if (TraceSupport.getValue()) { //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()); } this->Placement.setValue(shape.getTransform()); this->Shape.setValue(shape); } } return Part::Feature::execute(); }
TopoDS_Shape Datum::getShape() const { Part::TopoShape sh = Shape.getShape(); sh.setPlacement(Placement.getValue()); return sh._Shape; }