Toponaming: Missing shape hasher line; fixed cleaned Transformed

This commit is contained in:
bgbsww
2024-08-12 17:31:17 -04:00
committed by Chris Hennes
parent aef3bdfe67
commit a1ce983035
6 changed files with 64 additions and 41 deletions

View File

@@ -214,22 +214,22 @@ App::DocumentObjectExecReturn* Transformed::execute()
return App::DocumentObject::StdReturn;
}
std::vector<App::DocumentObject*> originals;
auto const mode = static_cast<Mode>(TransformMode.getValue());
if (mode == Mode::TransformBody) {
Originals.setValues({});
Originals.setStatus(App::Property::Status::Hidden, true);
} else {
Originals.setStatus(App::Property::Status::Hidden, false);
originals = Originals.getValues();
}
std::vector<App::DocumentObject*> originals = Originals.getValues();
// Remove suppressed features from the list so the transformations behave as if they are not
// there
{
auto eraseIter =
std::remove_if(originals.begin(), originals.end(), [](App::DocumentObject const* obj) {
auto feature = Base::freecad_dynamic_cast<PartDesign::Feature>(obj);
return feature != nullptr && feature->Suppressed.getValue();
});
originals.erase(eraseIter, originals.end());
}
auto eraseIter =
std::remove_if(originals.begin(), originals.end(), [](App::DocumentObject const* obj) {
auto feature = Base::freecad_dynamic_cast<PartDesign::Feature>(obj);
return feature != nullptr && feature->Suppressed.getValue();
});
originals.erase(eraseIter, originals.end());
if (mode == Mode::TransformToolShapes && originals.empty()) {
return App::DocumentObject::StdReturn;
@@ -284,14 +284,15 @@ App::DocumentObjectExecReturn* Transformed::execute()
supportShape.setTransform(Base::Matrix4D());
auto getTransformedCompShape = [&](const auto& origShape) {
std::vector<TopoShape> shapes;
auto getTransformedCompShape = [&](const auto& supportShape, const auto& origShape) {
std::vector<TopoShape> shapes = {supportShape};
TopoShape shape (origShape);
int idx=1;
for ( const auto& transformIter : transformations ) {
auto transformIter = transformations.cbegin();
transformIter++;
for ( ; transformIter != transformations.end(); transformIter++) {
auto opName = Data::indexSuffix(idx++);
auto transformed = shape.makeElementTransform(transformIter, opName.c_str());
shapes.emplace_back(transformed);
shapes.emplace_back(shape.makeElementTransform(*transformIter, opName.c_str()));
}
return shapes;
};
@@ -339,17 +340,16 @@ App::DocumentObjectExecReturn* Transformed::execute()
}
#endif
if (!fuseShape.isNull()) {
supportShape.makeElementFuse(getTransformedCompShape(fuseShape.getShape()));
supportShape.makeElementFuse(getTransformedCompShape(supportShape, fuseShape));
}
if (!cutShape.isNull()) {
supportShape.makeElementFuse(getTransformedCompShape(cutShape.getShape()));
supportShape.makeElementCut(getTransformedCompShape(supportShape, cutShape));
}
}
break;
case Mode::TransformBody: {
supportShape.makeElementFuse(getTransformedCompShape(supportShape));
supportShape.makeElementFuse(getTransformedCompShape(supportShape, supportShape));
break;
}
}