|
1 | 1 | """Selects elements with no associated dimensions in current view."""
|
2 |
| -#pylint: disable=import-error,invalid-name |
| 2 | + |
| 3 | +# pylint: disable=import-error,invalid-name |
3 | 4 | from pyrevit import revit, DB, HOST_APP
|
4 | 5 | from pyrevit import forms
|
5 | 6 |
|
6 | 7 | categories = {
|
7 |
| - 'Rooms': DB.BuiltInCategory.OST_Rooms, |
8 |
| - 'Areas': DB.BuiltInCategory.OST_Areas, |
9 |
| - 'Spaces': DB.BuiltInCategory.OST_MEPSpaces, |
10 |
| - 'Doors': DB.BuiltInCategory.OST_Doors, |
11 |
| - 'Windows': DB.BuiltInCategory.OST_Windows, |
12 |
| - 'Speciality Equipment': DB.BuiltInCategory.OST_SpecialityEquipment, |
13 |
| - 'Mechanical Equipment': DB.BuiltInCategory.OST_MechanicalEquipment, |
14 |
| - 'Electrical Equipment': DB.BuiltInCategory.OST_ElectricalEquipment, |
15 |
| - 'Walls': DB.BuiltInCategory.OST_Walls, |
16 |
| - 'Curtain Walls': DB.BuiltInCategory.OST_CurtainWallPanels, |
17 |
| - 'Ceilings': DB.BuiltInCategory.OST_Ceilings, |
18 |
| - 'Columns': DB.BuiltInCategory.OST_StructuralColumns, |
19 |
| - } |
| 8 | + "Rooms": DB.BuiltInCategory.OST_Rooms, |
| 9 | + "Areas": DB.BuiltInCategory.OST_Areas, |
| 10 | + "Spaces": DB.BuiltInCategory.OST_MEPSpaces, |
| 11 | + "Doors": DB.BuiltInCategory.OST_Doors, |
| 12 | + "Windows": DB.BuiltInCategory.OST_Windows, |
| 13 | + "Speciality Equipment": DB.BuiltInCategory.OST_SpecialityEquipment, |
| 14 | + "Mechanical Equipment": DB.BuiltInCategory.OST_MechanicalEquipment, |
| 15 | + "Electrical Equipment": DB.BuiltInCategory.OST_ElectricalEquipment, |
| 16 | + "Walls": DB.BuiltInCategory.OST_Walls, |
| 17 | + "Curtain Walls": DB.BuiltInCategory.OST_CurtainWallPanels, |
| 18 | + "Ceilings": DB.BuiltInCategory.OST_Ceilings, |
| 19 | + "Columns": DB.BuiltInCategory.OST_StructuralColumns, |
| 20 | +} |
20 | 21 |
|
21 | 22 | # make sure active view is not a sheet
|
22 | 23 | if isinstance(revit.active_view, DB.ViewSheet):
|
23 |
| - forms.alert("You're on a Sheet. Activate a model view please.", |
24 |
| - exitscript=True) |
| 24 | + forms.alert("You're on a Sheet. Activate a model view please.", exitscript=True) |
25 | 25 |
|
26 |
| -selected_switch = \ |
27 |
| - forms.CommandSwitchWindow.show( |
28 |
| - sorted(categories), |
29 |
| - message='Find undimmed elements of category:') |
| 26 | +selected_switch = forms.CommandSwitchWindow.show( |
| 27 | + sorted(categories), message="Find undimmed elements of category:" |
| 28 | +) |
30 | 29 |
|
31 | 30 | if selected_switch:
|
32 | 31 | target = categories[selected_switch]
|
33 | 32 | selection = revit.get_selection()
|
34 |
| - all_elements = DB.FilteredElementCollector(revit.doc, revit.active_view.Id)\ |
35 |
| - .OfCategory(target)\ |
36 |
| - .WhereElementIsNotElementType() |
| 33 | + all_elements = ( |
| 34 | + DB.FilteredElementCollector(revit.doc, revit.active_view.Id) |
| 35 | + .OfCategory(target) |
| 36 | + .WhereElementIsNotElementType() |
| 37 | + ) |
| 38 | + |
37 | 39 | all_ids = set(x.Id.IntegerValue for x in all_elements)
|
38 | 40 |
|
39 |
| - all_dims = \ |
40 |
| - DB.FilteredElementCollector(revit.doc, revit.active_view.Id)\ |
41 |
| - .OfClass(DB.Dimension)\ |
42 |
| - .WhereElementIsNotElementType() |
| 41 | + all_dims = ( |
| 42 | + DB.FilteredElementCollector(revit.doc, revit.active_view.Id) |
| 43 | + .OfClass(DB.Dimension) |
| 44 | + .WhereElementIsNotElementType() |
| 45 | + ) |
43 | 46 |
|
44 | 47 | dimmed_ids = set()
|
45 | 48 | for dim in all_dims:
|
|
54 | 57 | if not_dimmed_ids:
|
55 | 58 | selection.set_to(not_dimmed_ids)
|
56 | 59 | else:
|
57 |
| - forms.alert('All %s have associated dimensions.' % selected_switch) |
| 60 | + forms.alert("All %s have associated dimensions." % selected_switch) |
0 commit comments