PartDesign: Fix #20205 where Placement changes at Suppression

This commit is contained in:
Florian Foinant-Willig
2025-04-16 20:39:58 +02:00
committed by GitHub
parent 04db3175f3
commit 09ba446acd
2 changed files with 11 additions and 5 deletions

View File

@@ -98,12 +98,11 @@ App::DocumentObjectExecReturn* Feature::recompute()
FC_ERR("Failed to recompute suppressed feature " << getFullName());
}
Shape.setValue(getBaseTopoShape(true));
if (!failed) {
updateSuppressedShape();
}
else {
Shape.setValue(getBaseTopoShape(true));
}
return App::DocumentObject::StdReturn;
}
@@ -121,7 +120,6 @@ void Feature::setMaterialToBodyMaterial()
void Feature::updateSuppressedShape()
{
auto baseShape = getBaseTopoShape(true);
TopoShape res(getID());
TopoShape shape = Shape.getShape();
shape.setPlacement(Base::Placement());
@@ -139,7 +137,6 @@ void Feature::updateSuppressedShape()
res.makeElementCompound(generated);
res.setPlacement(Placement.getValue());
}
Shape.setValue(baseShape);
SuppressedShape.setValue(res);
}
@@ -196,6 +193,13 @@ void Feature::onChanged(const App::Property *prop)
body->ShapeMaterial.setValue(ShapeMaterial.getValue());
}
}
} else if (prop == &Suppressed){
if (Suppressed.getValue()) {
SuppressedPlacement = Placement.getValue();
} else {
Placement.setValue(SuppressedPlacement);
SuppressedPlacement = Base::Placement();
}
}
}
Part::Feature::onChanged(prop);

View File

@@ -60,6 +60,8 @@ public:
/// Keep a copy of suppressed shapes so that we can restore them (and maybe display them)
Part::PropertyPartShape SuppressedShape;
/// Keep a copy of the placement before suppression to restore it back when unsuppressed, fix #20205
Base::Placement SuppressedPlacement;
App::DocumentObjectExecReturn* recompute() override;
short mustExecute() const override;