Macro Toggle Visibility

From FreeCAD Documentation
Revision as of 22:46, 4 February 2016 by Galou breizh (talk | contribs) (restore the icon)

File:Macro SelectVisible Macro_SelectVisible

Description
Hidden all object not selected.

Author: Mario52
Author
Mario52
Download
None
Links
Macro Version
1.0
Date last modified
None
FreeCAD Version(s)
None
Default shortcut
None
See also
None

Description

This is a set of three related macros for managing the visibility of objects in the Object Model:

  1. objects that are selected in a document are made visible while objects that are not selected are made invisible
    • if no objects are selected then all objects are hidden;
    • if all objects are selected then all objects are made visible
  2. make all objects visible
  3. make all objects invisible

How To Use

Copy the macros and the icons in your folder macros and run (see Macro Install HowTo)

Macro SelectVisible

This macro selects all visible objects and deselect others in the active document.

The code SelectVisible.FCMacro is here: https://github.com/FreeCAD/FreeCAD-macros/blob/master/Utility/SelectVisible.FCMacro.

Its icon is .


Macro VisibleAlls

This macro makes all objects visible.

The code Macro VisibleAlls.FCMacro the icon

import FreeCAD
#Macro_VisibleAlls
__title__="Macro_VisibleAlls"
__author__ = "Mario52"
__url__     = "http://www.freecadweb.org/index-fr.html"
__version__ = "00.00"
__date__    = "11/11/2015"

try:
    for ShapeNameObj in FreeCAD.ActiveDocument.Objects:   # displyed alls objects
        #print ShapeNameObj.Name
        FreeCADGui.ActiveDocument.getObject(ShapeNameObj.Name).Visibility = True
except Exception:
    None

Macro HiddenAlls

This macro hides all objects.

The code Macro HiddenAlls.FCMacro the icon

import FreeCAD
#Macro_HiddenAlls
__title__="Macro_HiddenAlls"
__author__ = "Mario52"
__url__     = "http://www.freecadweb.org/index-fr.html"
__version__ = "00.00"
__date__    = "11/11/2015"

try:
    for ShapeNameObj in FreeCAD.ActiveDocument.Objects:   # hidden alls objects
        #print ShapeNameObj.Name
        FreeCADGui.ActiveDocument.getObject(ShapeNameObj.Name).Visibility = False
except Exception:
    None

Link

The discussion on the forum Proposal: select one or more pieces, hide the others.

Version

ver 00.02 12/11/2015 macro Macro_SelectVisible : hidden the objects not selected, if not object selected displayed all objects, hidden all objects. This version include the tree macro in one


Other languages: