Macro Toggle Visibility/fr: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
mNo edit summary
Line 1: Line 1:
{{Macro/fr|Icon=Macro SelectVisible|Name=Macro_ToggleSelectedObjectVisibility|Name/fr=Macro_ToggleSelectedObjectVisibility|Description=Cache tous les objets qui ne sont pas sélectionnés.|Author=Mario52}}
{{Macro/fr|Icon=Macro SelectVisible|Name=Macro_ToggleSelectedObjectVisibility|Name/fr=Macro_ToggleSelectedObjectVisibility|Description=Cache tous les objets qui ne sont pas sélectionnés.|Author=Mario52}}
==Description==
==Description==
This is a set of four related macros for managing the visibility of objects in the Object Model:
Ceci est un ensemble de trois macros liées à la gestion de la visibilité des objets dans la vue 3D :
# objects that are selected in a document are made visible while objects that are not selected are made invisible
# Cache les objets qui ne sont pas sélectionnés
#*if no objects are selected then all objects are hidden;
#* s'il n'y a pas d'objet sélectionné tous les objets seront cachés
#*if all objects are selected then all objects are made visible
#* si les objets sont cachés et qu'aucun objet n'est sélectionné dans la Vue combinée tous les objets seront visibles.
# make all objects visible
# Affiche tous les objets.
# make all objects invisible
# Cache tous les objets.
# the object(s) selected then stay , all objects not selected are deleted


==Utilisation==
==Utilisation==

Revision as of 12:52, 21 June 2016

File:Macro SelectVisible Macro_ToggleSelectedObjectVisibility

Description
Cache tous les objets qui ne sont pas sélectionnés.

Auteur: Mario52
Auteur
Mario52
Téléchargement
None
Liens
Version Macro
1.0
Dernière modification
None
Version(s) FreeCAD
None
Raccourci clavier
None
Voir aussi
None

Description

This is a set of four 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
  4. the object(s) selected then stay , all objects not selected are deleted

Utilisation

Copiez les macros et les icônes dans votre répertoire de macros (voir Macro Install HowTo).

Macro_ToggleSelectedObjectVisibility

Cette macro cache tous les objets qui ne sont pas sélectionnés. Si vous sélectionnez un objet caché (dans la fenêtre Vue combinée) il sera visible et tous les objets non sélectionnés seront cachés.

Si aucun objet n'est sélectionné tous les objets seront cachés.

Si les objets sont cachés et qu'aucun objet n'est sélectionné dans la Vue combinée tous les objets seront visibles.

(Cette nouvelle version 00.02) inclus les trois macros en une seule.

Le code Macro_ToggleSelectedObjectVisibility.FCMacro l'icône pour la barre d'outils

import FreeCAD
# Macro_ToggleSelectedObjectVisibility
__title__="Macro_ToggleSelectedObjectVisibility"
__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

Macro_DisplayAllObjects

Cette macro affiche tous les objets.

Le code Macro_DisplayAllObjects l'icône pour la barre d'outils

import FreeCAD
#Macro_VisibleAlls
__title__="Macro_DisplayAllObjects"
__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_HideAllObjects

Cette macro cache tous les objets.

Le code Macro_HideAllObjects l'icône pour la barre d'outils Cache tous les objets

import FreeCAD
#Macro_HideAllObjects
__title__="Macro_HideAllObjects"
__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

Macro_If_Selected_Stay_If_Not_Then_Delete

This macro delete alls object not selected

The icon for the tool bar

import FreeCAD
# Macro_If_Selected_Stay_If_Not_Then_Delete
__title__="Macro_If_Selected_Stay_If_Not_Then_Delete"
__author__ = "Mario52"
__url__     = "http://www.freecadweb.org/index-fr.html"
__version__ = "00.00"
__date__    = "16/06/2016"

App = FreeCAD
try:
    for ShapeNameObj in FreeCAD.ActiveDocument.Objects:
        if Gui.Selection.isSelected(ShapeNameObj) == True:
            None
        else:
            App.ActiveDocument.removeObject(ShapeNameObj.Name)        # remove objects not selecteds
except Exception:
    None

Lien

La discussion sur le forum Proposal: select one or more pieces, hide the others.

Version

ver 00.02 12/11/2015 macro Macro_SelectVisible : Si aucun objet n'est sélectionné tous les objets seront cachés, si les objets sont cachés et qu'aucun objet n'est sélectionné dans la Vue combinée tous les objets seront visibles. Cette nouvelle version inclus les trois macros en une seule.


Other languages: