Skip to content

Commit

Permalink
Pick: works with non-english Revit, consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
melnikovalex committed May 30, 2019
1 parent a0d0440 commit bcd15dd
Showing 1 changed file with 31 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand All @@ -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.

Copy link
@melnikovalex

melnikovalex May 31, 2019

Author Contributor

Please check: before it wasn't strict

Another question: maybe it would be better to pick using BuiltInCategory here instead of category name

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


Expand All @@ -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.

Copy link
@melnikovalex

melnikovalex May 31, 2019

Author Contributor

Now Architectural and Structural columns should be chosen separately

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,
Expand Down

0 comments on commit bcd15dd

Please sign in to comment.