-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pick: works with non-english Revit, consistently
- Loading branch information
1 parent
a0d0440
commit bcd15dd
Showing
1 changed file
with
31 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,11 @@ | |
Pick from all available categories. | ||
""" | ||
|
||
#pylint: disable=E0401,W0703,C0103 | ||
from pyrevit import revit, UI | ||
# pylint: disable=E0401,W0703,C0103 | ||
from pyrevit import revit, UI, DB | ||
from pyrevit import forms | ||
from pyrevit import script | ||
|
||
|
||
logger = script.get_logger() | ||
|
||
|
||
|
@@ -19,13 +18,13 @@ def __init__(self, catname): | |
|
||
# standard API override function | ||
def AllowElement(self, element): | ||
if self.category in element.Category.Name: | ||
if self.category == element.Category.Name: | ||
This comment has been minimized.
Sorry, something went wrong. |
||
return True | ||
else: | ||
return False | ||
|
||
# standard API override function | ||
def AllowReference(self, refer, point): #pylint: disable=W0613 | ||
def AllowReference(self, refer, point): # pylint: disable=W0613 | ||
return False | ||
|
||
|
||
|
@@ -42,28 +41,35 @@ def pickbycategory(catname): | |
logger.debug(err) | ||
|
||
|
||
|
||
if __shiftclick__: #pylint: disable=E0602 | ||
if __shiftclick__: # pylint: disable=E0602 | ||
options = sorted([x.Name for x in revit.doc.Settings.Categories]) | ||
else: | ||
options = sorted(['Area', | ||
'Area Boundary', | ||
'Column', | ||
'Dimension', | ||
'Door', | ||
'Floor', | ||
'Framing', | ||
'Furniture', | ||
'Grid', | ||
'Rooms', | ||
'Room Tag', | ||
'Truss', | ||
'Wall', | ||
'Window', | ||
'Ceiling', | ||
'Section Box', | ||
'Elevation Mark', | ||
'Parking']) | ||
categories_shortlist = [ | ||
This comment has been minimized.
Sorry, something went wrong.
melnikovalex
Author
Contributor
|
||
DB.BuiltInCategory.OST_Areas, | ||
DB.BuiltInCategory.OST_AreaSchemeLines, | ||
DB.BuiltInCategory.OST_Columns, | ||
DB.BuiltInCategory.OST_StructuralColumns, | ||
DB.BuiltInCategory.OST_Dimensions, | ||
DB.BuiltInCategory.OST_Doors, | ||
DB.BuiltInCategory.OST_Floors, | ||
DB.BuiltInCategory.OST_StructuralFraming, | ||
DB.BuiltInCategory.OST_Furniture, | ||
DB.BuiltInCategory.OST_Grids, | ||
DB.BuiltInCategory.OST_Rooms, | ||
DB.BuiltInCategory.OST_RoomTags, | ||
DB.BuiltInCategory.OST_Truss, | ||
DB.BuiltInCategory.OST_Walls, | ||
DB.BuiltInCategory.OST_Windows, | ||
DB.BuiltInCategory.OST_Ceilings, | ||
DB.BuiltInCategory.OST_SectionBox, | ||
DB.BuiltInCategory.OST_ElevationMarks, | ||
DB.BuiltInCategory.OST_Parking | ||
] | ||
categories_shortlist_ids = [int(x) for x in categories_shortlist] | ||
categories_filtered = [ | ||
x for x in revit.doc.Settings.Categories if ( | ||
x.Id.IntegerValue in categories_shortlist_ids)] | ||
options = sorted([x.Name for x in categories_filtered]) | ||
|
||
selected_switch = \ | ||
forms.CommandSwitchWindow.show(options, | ||
|
Please check: before it wasn't strict
Another question: maybe it would be better to pick using BuiltInCategory here instead of category name