Assembly: Property change from Object/Part to Reference
This commit is contained in:
committed by
Yorik van Havre
parent
828e85963e
commit
8d3e3acd11
@@ -529,22 +529,17 @@ 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:
|
||||
# Only objects within the assembly.
|
||||
objs_names, element_name = UtilsAssembly.getObjsNamesAndElement(sel.ObjectName, sub)
|
||||
if assembly.Name not in objs_names:
|
||||
continue
|
||||
ref = [sel.Object, [sub, sub]]
|
||||
moving_part = UtilsAssembly.getMovingPart(assembly, ref)
|
||||
|
||||
full_element_name = UtilsAssembly.getFullElementName(sel.ObjectName, sub)
|
||||
obj = UtilsAssembly.getObject(full_element_name)
|
||||
part_containing_obj = UtilsAssembly.getContainingPart(full_element_name, obj)
|
||||
# Only objects within the assembly.
|
||||
if moving_part is None:
|
||||
continue
|
||||
|
||||
# Check if part is grounded and if so delete the joint.
|
||||
ungrounded = False
|
||||
for joint in joint_group.Group:
|
||||
if (
|
||||
hasattr(joint, "ObjectToGround")
|
||||
and joint.ObjectToGround == part_containing_obj
|
||||
):
|
||||
if hasattr(joint, "ObjectToGround") and joint.ObjectToGround == moving_part:
|
||||
doc = App.ActiveDocument
|
||||
doc.removeObject(joint.Name)
|
||||
doc.recompute()
|
||||
@@ -554,7 +549,7 @@ class CommandToggleGrounded:
|
||||
continue
|
||||
|
||||
# Create groundedJoint.
|
||||
createGroundedJoint(part_containing_obj)
|
||||
createGroundedJoint(moving_part)
|
||||
App.closeActiveTransaction()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user