FreeCAD-Doc/localwiki/Macro_Toggle_Visibility-it.html
2018-07-19 18:47:02 -05:00

185 lines
11 KiB
HTML

<html><head><title>Macro Toggle Visibility/it</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type='text/css' href='wiki.css' rel='stylesheet'></head><body><h1>Macro Toggle Visibility/it</h1></div>
<div id="mw-content-text" lang="it" dir="ltr" class="mw-content-ltr"><hr/><div class="mw-parser-output"><table class="fcinfobox wikitable ct" width="100%" style="float: right; width: 230px; margin-left: 10px;">
<tr>
<td class="ctTitle">
<h3><span class="mw-headline" id="Visibilit.C3.A0_oggetti"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_SelectVisible.png" class="image"><img alt="Macro SelectVisible.png" src="32px-Macro_SelectVisible.png" width="32" height="32" srcset="48px-Macro_SelectVisible.png 1.5x, /wiki/images/thumb/4/42/Macro_SelectVisible.png/64px-Macro_SelectVisible.png 2x" /></a> Visibilità oggetti</span></h3>
</td></tr>
<tr>
<th class="ctOdd">Descrizione
</th></tr>
<tr>
<td class="ctEven left">Nasconde gli oggetti non selezionati.
</td></tr>
<tr>
<th class="ctOdd">Autore
</th></tr>
<tr>
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=User:Mario52" title="User:Mario52">Mario52</a>
</td></tr>
<tr>
<th class="ctOdd">Link
</th></tr>
<tr>
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=Macros_recipes/it" title="Macros recipes/it">Esempi di macro</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/it" title="How to install macros/it">Come installare le Macro</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=Customize_Toolbars/it" title="Customize Toolbars/it">Personalizzare la barra degli strumenti</a>
</td></tr>
<tr>
<th class="ctOdd">Versione
</th></tr>
<tr>
<td class="ctEven macro-version">00.02
</td></tr>
<tr>
<th class="ctOdd">Data ultima modifica
</th></tr>
<tr>
<td class="ctEven macro-date">2015-11-12
</td></tr>
<tr>
<th class="ctOdd">
</th></tr>
<tr>
<td class="ctToc"><br /><div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1"><a href="#Visibilit.C3.A0_oggetti"><span class="tocnumber">1</span> <span class="toctext">Visibilità oggetti</span></a></li>
<li class="toclevel-1 tocsection-1"><a href="#Descrizione"><span class="tocnumber">2</span> <span class="toctext">Descrizione</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Uso"><span class="tocnumber">3</span> <span class="toctext">Uso</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#ToggleVisibility"><span class="tocnumber">4</span> <span class="toctext">ToggleVisibility</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#DisplayAll"><span class="tocnumber">5</span> <span class="toctext">DisplayAll</span></a></li>
<li class="toclevel-1 tocsection-5"><a href="#HideAll"><span class="tocnumber">6</span> <span class="toctext">HideAll</span></a></li>
<li class="toclevel-1 tocsection-6"><a href="#SelectedStay"><span class="tocnumber">7</span> <span class="toctext">SelectedStay</span></a></li>
<li class="toclevel-1 tocsection-7"><a href="#Link"><span class="tocnumber">8</span> <span class="toctext">Link</span></a></li>
<li class="toclevel-1 tocsection-8"><a href="#Version"><span class="tocnumber">9</span> <span class="toctext">Version</span></a></li>
</ul>
</div>
</td></tr>
</table>
<p><br />
</p>
<h2><span class="mw-headline" id="Descrizione">Descrizione</span></h2>
<p>Questo è un insieme di tre macro correlate che servono per gestire la visibilità degli oggetti nella scheda Modello:
</p>
<ol><li> gli oggetti selezionati in un documento sono resi visibili, mentre gli oggetti che non sono stati selezionati vengono resi invisibili
<ul><li> se non ci sono oggetti selezionati allora tutti gli oggetti sono nascosti</li>
<li> se vengono selezionati tutti gli oggetti allora tutti gli oggetti vengono resi visibili</li></ul></li>
<li> rende visibili tutti gli oggetti</li>
<li> rende invisibili tutti gli oggetti</li></ol>
<h2><span class="mw-headline" id="Uso">Uso</span></h2>
<p>Copiare le macro e le icone nella cartella delle macro ed eseguirle (vedere <a href="https://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/it" title="How to install macros/it">Come installare le macro</a>)
</p>
<h2><span class="mw-headline" id="ToggleVisibility">ToggleVisibility</span></h2>
<p>Selezionare gli oggetti in una delle viste di FreeCAD. Questa macro rende visibili tutti gli oggetti selezionati e nasconde tutti gli oggetti non selezionati.
</p><p>Se non ci sono oggetti selezionati tutti gli oggetti vengono nascosti
</p><p>Se tutti gli oggetti sono nascosti e nella Vista Combinata non ci sono oggetti selezionati, rende visibili tutti gli oggetti
</p><p>La nuova versione (00.02) comprende le tre macro in una
</p><p>Il codice <b>Macro_ToggleSelectedObjectVisibility.FCMacro</b> e l'icona <a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_SelectVisible.png" class="image"><img alt="Macro SelectVisible.png" src="48px-Macro_SelectVisible.png" width="48" height="48" srcset="/wiki/images/thumb/4/42/Macro_SelectVisible.png/72px-Macro_SelectVisible.png 1.5x, /wiki/images/thumb/4/42/Macro_SelectVisible.png/96px-Macro_SelectVisible.png 2x" /></a>
</p>
<pre>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&#160;: compt += 1
#print "False&#160;: ",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 &#160;: ",ShapeNameObj.Name
compt = 0
else&#160;:
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&#160;: ",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 &#160;: ",ShapeNameObj.Name
except Exception:
None </pre>
<h2><span class="mw-headline" id="DisplayAll">DisplayAll</span></h2>
<p>Questa macro rende visibili tutti gli oggetti.
</p><p>Il codice <b>Macro_DisplayAllObjects</b> e l'icona <a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_VisibleAlls.png" class="image"><img alt="Macro VisibleAlls.png" src="48px-Macro_VisibleAlls.png" width="48" height="48" srcset="/wiki/images/thumb/1/19/Macro_VisibleAlls.png/72px-Macro_VisibleAlls.png 1.5x, /wiki/images/thumb/1/19/Macro_VisibleAlls.png/96px-Macro_VisibleAlls.png 2x" /></a>
</p>
<pre>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 </pre>
<h2><span class="mw-headline" id="HideAll">HideAll</span></h2>
<p>Questa macro nasconde tutti gli oggetti.
</p><p>Il codice <b>Macro_HideAllObjects</b> e l'icona <a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_HiddenAlls.png" class="image"><img alt="Macro HiddenAlls.png" src="48px-Macro_HiddenAlls.png" width="48" height="48" srcset="/wiki/images/thumb/d/d6/Macro_HiddenAlls.png/72px-Macro_HiddenAlls.png 1.5x, /wiki/images/thumb/d/d6/Macro_HiddenAlls.png/96px-Macro_HiddenAlls.png 2x" /></a>
</p>
<pre>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 </pre>
<h2><span class="mw-headline" id="SelectedStay">SelectedStay</span></h2>
<p>Questa macro eliminare tutti gli oggetti non selezionati
</p><p>L'icona per la barra degli strumenti <a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_If_Selected_Stay_If_Not_Then_Delete.png" class="image"><img alt="Macro If Selected Stay If Not Then Delete.png" src="48px-Macro_If_Selected_Stay_If_Not_Then_Delete.png" width="48" height="48" srcset="/wiki/images/thumb/6/62/Macro_If_Selected_Stay_If_Not_Then_Delete.png/72px-Macro_If_Selected_Stay_If_Not_Then_Delete.png 1.5x, /wiki/images/thumb/6/62/Macro_If_Selected_Stay_If_Not_Then_Delete.png/96px-Macro_If_Selected_Stay_If_Not_Then_Delete.png 2x" /></a>
</p>
<pre>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 </pre>
<h2><span class="mw-headline" id="Link">Link</span></h2>
<p>La discussione nel forum <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewtopic.php?f=8&amp;t=13152">Proposal: select one or more pieces, hide the others.</a>
</p>
<h2><span class="mw-headline" id="Version">Version</span></h2>
<p>ver 00.02 12/11/2015 <b>macro Macro_SelectVisible</b>&#160;: hidden the objects not selected, if not object selected displayed all objects, hidden all objects. This version include the tree macro in one
</p><p><br />
</p>
</div>
</div>
</div><div class="printfooter">
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=Macro_Toggle_Visibility/it&amp;oldid=239918">http://www.freecadweb.org/wiki/index.php?title=Macro_Toggle_Visibility/it&amp;oldid=239918</a>"</div>
<div id="catlinks" class="catlinks" data-mw="interface"></div><div class="visualClear"></div>
</div>
</div>
<div id="mw-navigation">
<h2>Navigation menu</h2>
</body></html>