Assembly: Fixed joint should not be active if no part is grounded. Fixes #12544
This commit is contained in:
committed by
Yorik van Havre
parent
bf0146ca86
commit
f63abc1cf2
@@ -83,7 +83,7 @@ class CommandCreateJointFixed:
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
if UtilsAssembly.activePart:
|
||||
if UtilsAssembly.activePart() is not None:
|
||||
return UtilsAssembly.assembly_has_at_least_n_parts(2)
|
||||
|
||||
return UtilsAssembly.isAssemblyGrounded() and UtilsAssembly.assembly_has_at_least_n_parts(2)
|
||||
|
||||
@@ -38,29 +38,27 @@ __author__ = "Ondsel"
|
||||
__url__ = "https://www.freecad.org"
|
||||
|
||||
|
||||
def activeAssembly():
|
||||
def activePartOrAssembly():
|
||||
doc = Gui.ActiveDocument
|
||||
|
||||
if doc is None or doc.ActiveView is None:
|
||||
return None
|
||||
|
||||
active_assembly = doc.ActiveView.getActiveObject("part")
|
||||
return doc.ActiveView.getActiveObject("part")
|
||||
|
||||
if active_assembly is not None and active_assembly.Type == "Assembly":
|
||||
|
||||
def activeAssembly():
|
||||
active_assembly = activePartOrAssembly()
|
||||
if active_assembly is not None and active_assembly.isDerivedFrom("Assembly::AssemblyObject"):
|
||||
return active_assembly
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def activePart():
|
||||
doc = Gui.ActiveDocument
|
||||
active_part = activePartOrAssembly()
|
||||
|
||||
if doc is None or doc.ActiveView is None:
|
||||
return None
|
||||
|
||||
active_part = doc.ActiveView.getActiveObject("part")
|
||||
|
||||
if active_part is not None and active_part.Type != "Assembly":
|
||||
if active_part is not None and not active_part.isDerivedFrom("Assembly::AssemblyObject"):
|
||||
return active_part
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user