PartDesign: Add preview TaskBox to all feature task dialogs

This commit is contained in:
Kacper Donat
2025-07-06 16:31:42 +02:00
parent 6caceacb95
commit 802af4c464
27 changed files with 242 additions and 41 deletions

View File

@@ -222,6 +222,45 @@ short Transformed::mustExecute() const
}
return PartDesign::Feature::mustExecute();
}
App::DocumentObjectExecReturn* Transformed::recomputePreview()
{
const auto mode = static_cast<Mode>(TransformMode.getValue());
const auto makeCompoundOfToolShapes = [this]() {
BRep_Builder builder;
TopoDS_Compound compound;
builder.MakeCompound(compound);
for (const auto& original : getOriginals()) {
if (auto* feature = freecad_cast<FeatureAddSub*>(original)) {
const auto& shape = feature->AddSubShape.getShape();
if (shape.isNull()) {
continue;
}
builder.Add(compound, shape.getShape());
}
}
return compound;
};
switch (mode) {
case Mode::TransformToolShapes:
PreviewShape.setValue(makeCompoundOfToolShapes());
return StdReturn;
case Mode::TransformBody:
PreviewShape.setValue(getBaseShape());
return StdReturn;
default:
return FeatureRefine::recomputePreview();
}
}
void Transformed::onChanged(const App::Property* prop)
{
if (prop == &TransformMode) {