Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem] Adding a transformation to a MultiTransform will not work correctly in all cases #12491

Closed
2 tasks done
NomAnor opened this issue Feb 18, 2024 · 2 comments · Fixed by #12538
Closed
2 tasks done
Labels
Bug This issue or PR is related to a bug Solution proposed The issue has a solution proposed WB Part Design Related to the Part Design Workbench

Comments

@NomAnor
Copy link
Contributor

NomAnor commented Feb 18, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

I can douple click on a PartDesign feature and edit its parameters even if the Body is not active.

Clicking on Add * transformation in the context menu of a MultiTransform when the Body is not active will not add a new feature.

When a different Body is active than the one of the MultiTransform, the added transformation will reference the wrong Body (in its _Body property) and the transformation will fail with the message:

PartDesign::MultiTransform: Link(s) to object(s) 'Mirrored' go out of the allowed scope 'MultiTransform'. Instead, the linked object(s) reside within 'Body'.

Full version info

OS: Arch Linux (XFCE/xfce)
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.36005 (Git)
Build type: Unknown
Branch: main
Hash: c4daf256b2eb41fd75f8344d27890c14e1bcae08
Python 3.11.7, Qt 5.15.12, Coin 4.0.2, Vtk 9.3.0, OCC 7.7.2
Locale: German/Germany (de_DE)
Installed mods: 
  * Manipulator 1.5.7
  * ThreadProfile 1.84.0
  * DynamicData 2.60.0
  * lattice2 1.0.0
  * 3D_Printing_Tools
  * freecad.gears 1.0.0
  * Assembly3 0.11.3
  * fasteners 0.4.21

Subproject(s) affected?

PartDesign

Anything else?

The action handler function is aborted when there is no active Body. And the wrong body is obvisusly used when a different one is active.

auto pcActiveBody = PartDesignGui::getBody(false);
if (!pcActiveBody)
return;
if (isEnabledTransaction())
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Mirrored"));
FCMD_OBJ_CMD(pcActiveBody, "newObject('PartDesign::Mirrored','"<<newFeatName<<"')");
auto Feat = pcActiveBody->getDocument()->getObject(newFeatName.c_str());

It is probably enough to replace the active body with the body of the MultiTransform.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@maxwxyz maxwxyz added Bug This issue or PR is related to a bug WB Part Design Related to the Part Design Workbench Solution proposed The issue has a solution proposed labels Feb 19, 2024
@WandererFan
Copy link
Contributor

Wouldn't it make sense to issue a message saying "you are trying to change an inactive body. please make the body active and try again."

@NomAnor
Copy link
Contributor Author

NomAnor commented Mar 18, 2024

There is no message if you edit a sketch or other feature of an inactive body. I think such a message would be annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This issue or PR is related to a bug Solution proposed The issue has a solution proposed WB Part Design Related to the Part Design Workbench
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants