Macro If Selected Stay If Not Then Delete/it: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
No edit summary
 
Line 1: Line 1:
<languages/>
<languages/>


<div class="mw-translate-fuzzy">
{{Macro/it
{{Macro/it
|Name=Macro If Selected Stay If Not Then Delete
|Name=Macro If Selected Stay If Not Then Delete
Line 7: Line 6:
|Description=Questa macro cancella gli obietti non selezionati.
|Description=Questa macro cancella gli obietti non selezionati.
|Author=Mario52
|Author=Mario52
|Version=00.03
|Version=00.03b
|Date=2023-09-22
|Date=2023-09-24
|FCVersion=All
|FCVersion=All
|Download=[https://www.freecadweb.org/wiki/images/6/62/Macro_If_Selected_Stay_If_Not_Then_Delete.png ToolBar Icon]
|Download=[https://www.freecadweb.org/wiki/images/6/62/Macro_If_Selected_Stay_If_Not_Then_Delete.png ToolBar Icon]
|SeeAlso=[[Macro_Toggle_Visibility2_1-2/it|Macro Toggle Visibility2 1-2]]<br>[[Macro_Toggle_Visibility2_2-2/it|Macro Toggle Visibility2 2-2]]<br>[[Macro_Toggle_Visibility/it|Macro_Toggle_Visibility]]<br>[[Macro_HiddenAlls/it|Macro HiddenAlls]]<br>[[Macro_VisibleAlls/it|Macro_VisibleAlls]]
|SeeAlso=[[Macro_Toggle_Visibility2_1-2/it|Macro Toggle Visibility2 1-2]]<br>[[Macro_Toggle_Visibility2_2-2/it|Macro Toggle Visibility2 2-2]]<br>[[Macro_Toggle_Visibility/it|Macro_Toggle_Visibility]]<br>[[Macro_HiddenAlls/it|Macro HiddenAlls]]<br>[[Macro_VisibleAlls/it|Macro_VisibleAlls]]
}}
}}
</div>


<span id="Description"></span>
<span id="Description"></span>

Latest revision as of 22:21, 24 September 2023

Other languages:

Macro If Selected Stay If Not Then Delete

Descrizione
Questa macro cancella gli obietti non selezionati.

Versione macro: 00.03b
Ultima modifica: 2023-09-24
Versione FreeCAD: All
Download: ToolBar Icon
Autore: Mario52
Autore
Mario52
Download
ToolBar Icon
Link
Versione macro
00.03b
Data ultima modifica
2023-09-24
Versioni di FreeCAD
All
Scorciatoia
Nessuna
Vedere anche
Macro Toggle Visibility2 1-2
Macro Toggle Visibility2 2-2
Macro_Toggle_Visibility
Macro HiddenAlls
Macro_VisibleAlls

Descrizione

Questa macro cancella gli obietti non selezionati.

Script

Icona barra strumenti

Macro_If_Selected_Stay_If_Not_Then_Delete.FCMacro

import FreeCAD
import Draft
# 16/06/2016, 21/02/2018, 22/09/2023, 24/09/2023
# Macro_SelectVisible series
__title__   = "Macro_If_Selected_Stay_If_Not_Then_Delete"
__author__  = "Mario52"
__url__     = "http://www.freecadweb.org/index-fr.html"
__version__ = "00.03b"
__date__    = "24/09/2023"

App = FreeCAD
try:
    for ShapeNameObj in FreeCAD.ActiveDocument.Objects:
        if str(ShapeNameObj) == "<group object>":
            if len(Draft.get_group_contents(ShapeNameObj)) == 0:
                App.ActiveDocument.removeObject(ShapeNameObj.Name)        # remove group not selecteds
        else:
            if Gui.Selection.isSelected(ShapeNameObj):
                None
            else:
                App.ActiveDocument.removeObject(ShapeNameObj.Name)        # remove objects not selecteds
    
    for ShapeNameGroup in FreeCAD.ActiveDocument.Objects:
        if (str(ShapeNameGroup) == "<group object>"):
            if len(Draft.get_group_contents(ShapeNameGroup)) == 0:
                App.ActiveDocument.removeObject(ShapeNameGroup.Name)      # remove group emptied
except Exception:
    None