Assembly: toggle grounded: handle case of grounded joint selection.

This commit is contained in:
PaddleStroke
2025-08-20 12:34:27 +02:00
committed by Chris Hennes
parent 7ca8fac3fa
commit 59b01f6802

View File

@@ -516,6 +516,19 @@ class CommandToggleGrounded:
# If you select 2 solids (bodies for example) within an assembly.
# There'll be a single sel but 2 SubElementNames.
for sub in sel.SubElementNames:
# First check if selection is a grounded object
resolved = sel.Object.resolveSubElement(sub)
if resolved:
obj = resolved[0]
if hasattr(obj, "ObjectToGround"):
commands = (
"doc = App.ActiveDocument\n"
f'doc.removeObject("{obj.Name}")\n'
"doc.recompute()\n"
)
Gui.doCommand(commands)
continue
ref = [sel.Object, [sub, sub]]
moving_part = UtilsAssembly.getMovingPart(assembly, ref)