Created
January 2, 2016 18:41
-
-
Save mario52a/2c6fcaca6ee3dac88578 to your computer and use it in GitHub Desktop.
This macro hidden all objects not selected if you selected one object hidden the hidden object are displayed and all objects not selected are hidden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FreeCAD | |
# Macro_SelectVisible | |
__title__="Macro_SelectVisible" | |
__author__ = "Mario52" | |
__url__ = "http://www.freecadweb.org/index-fr.html" | |
__version__ = "00.02" | |
__date__ = "12/11/2015" | |
try: | |
compt = 0 | |
for ShapeNameObj in FreeCAD.ActiveDocument.Objects: # list alls objet for test if alls hidden | |
if (FreeCADGui.ActiveDocument.getObject(ShapeNameObj.Name).Visibility == False) and (Gui.Selection.isSelected(ShapeNameObj) == False): | |
compt += 1 # if hidden : compt += 1 | |
#print "False : ",ShapeNameObj.Name | |
if compt == len(FreeCAD.ActiveDocument.Objects): # if (compt = Alls objects hidden) then Visibility = True | |
for ShapeNameObj in FreeCAD.ActiveDocument.Objects: | |
FreeCADGui.ActiveDocument.getObject(ShapeNameObj.Name).Visibility = True # Visibility = True | |
#print "True : ",ShapeNameObj.Name | |
compt = 0 | |
else : | |
for ShapeNameObj in FreeCAD.ActiveDocument.Objects: # hidde objects not selecteds | |
if Gui.Selection.isSelected(ShapeNameObj) == False: | |
FreeCADGui.ActiveDocument.getObject(ShapeNameObj.Name).Visibility = False # if objects is not selected then Visibility = False (Hidden) | |
#print "False : ",ShapeNameObj.Name | |
else: | |
FreeCADGui.ActiveDocument.getObject(ShapeNameObj.Name).Visibility = True # if objects are hidden and selected then Visibility = True and hidden alls objects visibles | |
#print "True : ",ShapeNameObj.Name | |
except Exception: | |
None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This macro utility is intended for the use of the program FreeCAD http://www.freecadweb.org/
rename in Macro_SelectVisible.png
The icon for your toolbar, it is to place in your macros directory (in the same location of the macro)