From 2501296c95f10ce14a2ec3de68eb88dc9beba00a Mon Sep 17 00:00:00 2001 From: Alexey Chernov <4ernov@gmail.com> Date: Tue, 9 Jul 2024 23:18:57 +0300 Subject: [PATCH] Apply result of copy on change properties Copy on change properties propagated to SubShapeBinder can be changed there and then updated in the base body (support). On the other hand, they might be used in calculation of some other properties in the base body which could also be copy on change and propagated to the same SubShapeBinder. It looks natural that these latter properties should be updated with the calculation results as well. Example: Body has copy on change properties A = 200 mm and B = 3 * A = 600 mm. SubShapeBinder with support of Body has A changed to 300 mm and expects B = 3 * 300 mm = 900 mm. Without this change B is not updated and equals to 600 mm in SubShapeBinder as well. --- src/Mod/PartDesign/App/ShapeBinder.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Mod/PartDesign/App/ShapeBinder.cpp b/src/Mod/PartDesign/App/ShapeBinder.cpp index 3bd829afab..020526b221 100644 --- a/src/Mod/PartDesign/App/ShapeBinder.cpp +++ b/src/Mod/PartDesign/App/ShapeBinder.cpp @@ -620,6 +620,20 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) { } if (recomputeCopy && !copied->recomputeFeature(true)) copyerror = 2; + if (!copyerror) { + for (auto prop : props) { + if (!App::LinkBaseExtension::isCopyOnChangeProperty(this, *prop)) + continue; + auto p = copied->getPropertyByName(prop->getName()); + if (p && p->getContainer() == copied + && p->getTypeId() == prop->getTypeId() + && !p->isSame(*prop)) + { + std::unique_ptr pcopy(p->Copy()); + prop->Paste(*pcopy); + } + } + } } obj = copied; _CopiedLink.setValue(copied, l.getSubValues(false));