PartDesign: Add preview TaskBox to all feature task dialogs
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user