diff --git a/assembly.py b/assembly.py index 620b8e9..d0f0439 100644 --- a/assembly.py +++ b/assembly.py @@ -561,8 +561,7 @@ class ViewProviderAsmElement(ViewProviderAsmOnTop): def attach(self,vobj): super(ViewProviderAsmElement,self).attach(vobj) - if gui.AsmCmdManager.AutoElementVis: - vobj.OnTopWhenSelected = 2 + vobj.OnTopWhenSelected = 2 def getDefaultColor(self): return (60.0/255.0,1.0,1.0) @@ -956,7 +955,7 @@ class AsmElementLink(AsmBase): ViewProviderAsmElementLink(link.ViewObject) info.Constraint.setLink({-1:link}) link.Proxy.setLink(info.Owner,info.Subname) - if not gui.AsmCmdManager.AutoElementVis: + if gui.AsmCmdManager.AutoElementVis: info.Constraint.setElementVisible(link.Name,False) return link @@ -974,8 +973,7 @@ class ViewProviderAsmElementLink(ViewProviderAsmOnTop): def attach(self,vobj): super(ViewProviderAsmElementLink,self).attach(vobj) - if gui.AsmCmdManager.AutoElementVis: - vobj.OnTopWhenSelected = 2 + vobj.OnTopWhenSelected = 2 def getDefaultColor(self): return (1.0,60.0/255.0,60.0/255.0) @@ -1248,8 +1246,7 @@ class AsmConstraint(AsmGroup): class ViewProviderAsmConstraint(ViewProviderAsmGroup): def attach(self,vobj): super(ViewProviderAsmConstraint,self).attach(vobj) - if gui.AsmCmdManager.AutoElementVis: - vobj.OnTopWhenSelected = 2 + vobj.OnTopWhenSelected = 2 def getIcon(self): return Constraint.getIcon(self.ViewObject.Object) diff --git a/gui.py b/gui.py index 1972735..27d5305 100644 --- a/gui.py +++ b/gui.py @@ -431,19 +431,19 @@ class AsmCmdAutoElementVis(AsmCmdCheckable): super(AsmCmdAutoElementVis,cls).Activated(checked) from .assembly import isTypeOf,AsmConstraint,\ AsmElement,AsmElementLink,AsmElementGroup - visible = not checked for doc in FreeCAD.listDocuments().values(): for obj in doc.Objects: if isTypeOf(obj,(AsmConstraint,AsmElementGroup)): obj.Visibility = False if isTypeOf(obj,AsmConstraint): - obj.ViewObject.OnTopWhenSelected = 2 if checked else 0 + obj.ViewObject.OnTopWhenSelected = 2 obj.setPropertyStatus('VisibilityList', 'NoModify' if checked else '-NoModify') elif isTypeOf(obj,(AsmElementLink,AsmElement)): + if checked: + obj.Proxy.parent.Object.setElementVisible( + obj.Name,False) obj.Visibility = False - vis = visible and not isTypeOf(obj,AsmElement) - obj.Proxy.parent.Object.setElementVisible(obj.Name,vis) obj.ViewObject.OnTopWhenSelected = 2