Created
July 20, 2017 14:01
-
-
Save cfobel/a74526d1762a22094e01cb18945103a2 to your computer and use it in GitHub Desktop.
Revisions
-
cfobel created this gist
Jul 20, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ # Isolate selected item(s): # - Save list of selected items # - Save list of visible items # - Hide non-selected items that are currently visible import FreeCAD selected_objects = set(object_i.Label for object_i in Gui.Selection.getSelection()) objects_by_label = {object_i.Label: object_i for object_i in Gui.ActiveDocument.Document.Objects if object_i.ViewObject.Visibility} [setattr(object_i.ViewObject, 'Visibility', False) for label_i, object_i in objects_by_label.iteritems()] [setattr(object_i.ViewObject, 'Visibility', True) for object_i in Gui.ActiveDocument.Document.Objects if object_i.Label in selected_objects] FreeCAD._isolated__objects_to_restore = objects_by_label 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ # Restore original visibility of each item. # Isolate selected item(s): # - Save list of selected items # - Save list of visible items # - Hide non-selected items that are currently visible import FreeCAD objects_by_label = FreeCAD._isolated__objects_to_restore [setattr(object_i.ViewObject, 'Visibility', True) for object_i in Gui.ActiveDocument.Document.Objects if object_i.Label in objects_by_label] [setattr(object_i.ViewObject, 'Visibility', False) for object_i in Gui.ActiveDocument.Document.Objects if object_i.Label not in objects_by_label] 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ # Hide: # - All sketches # - All objects that end with `- Draft` # # Show: # - All objects that end with `- Part` objects_by_label = {object_i.Label: object_i for object_i in Gui.ActiveDocument.Document.Objects} [setattr(object_i.ViewObject, 'Visibility', True) for label_i, object_i in objects_by_label.iteritems() if label_i.endswith('- Part')] [setattr(object_i.ViewObject, 'Visibility', False) for label_i, object_i in objects_by_label.iteritems() if (label_i.endswith('- Draft') or 'sketch' in object_i.TypeId.lower())]