Ejemplo n.º 1
0
def checkUpdater(sender, args):
    '''event type function to check if updater is needed,
    if the specific parameter is found -> registering '''
    doc = args.Document

    paramHx2 = False
    params_proj = doc.ParameterBindings.GetEnumerator()
    params_proj.Reset()
    while params_proj.MoveNext():
        if params_proj.Key.Name == 'DoubleHeight':
            paramHx2 = True
            break

    if paramHx2:
        #register the updater
        UpdaterRegistry.RegisterUpdater(my_updater, doc)
        filter = RoomFilter()
        UpdaterRegistry.AddTrigger(my_updater.GetUpdaterId(), filter,
                                   Element.GetChangeTypeGeometry())

        UpdaterRegistry.AddTrigger(my_updater.GetUpdaterId(), filter,
                                   Element.GetChangeTypeElementAddition())

        # only for the test :
        TaskDialog.Show("MyRoomUpdater",
                        'MyRoomUpdater is enabled for this project')
    else:
        TaskDialog.Show("MyRoomUpdater",
                        'MyRoomUpdater is disabled for this project')
Ejemplo n.º 2
0
def doc_register(proj):
    UpdaterRegistry.RegisterUpdater(myroomupdater, proj)
    filter = RoomFilter()
    UpdaterRegistry.AddTrigger(myroomupdater.GetUpdaterId(), filter,
                               Element.GetChangeTypeGeometry())
    UpdaterRegistry.AddTrigger(myroomupdater.GetUpdaterId(), filter,
                               Element.GetChangeTypeElementAddition())
Ejemplo n.º 3
0
def select_room_height(height):
    '''Select rooms where unbounded height < param'''
    uidoc = __revit__.ActiveUIDocument
    doc = uidoc.Document
    view = uidoc.ActiveGraphicalView
    roomfilter = RoomFilter()
    rooms = FilteredElementCollector(
        doc, view.Id).WherePasses(roomfilter).ToElements()
    select = [room.Id for room in rooms if room.UnboundedHeight <= height]
    uidoc.Selection.SetElementIds(List[ElementId](select))
    TaskDialog.Show(
        'Select Rooms',
        '{0} Rooms where UnboundedHeight < "{1}":'.format(len(select), height))
Ejemplo n.º 4
0
def select_room_name(text):
    '''Select rooms where unbounded height < param'''
    uidoc = __revit__.ActiveUIDocument
    doc = uidoc.Document
    view = uidoc.ActiveGraphicalView
    roomfilter = RoomFilter()
    rooms = FilteredElementCollector(
        doc, view.Id).WherePasses(roomfilter).ToElements()
    select = [
        room.Id for room in rooms
        if text.lower() in Element.Name.GetValue(room).lower()
    ]
    uidoc.Selection.SetElementIds(List[ElementId](select))
    TaskDialog.Show('Select Room', 'Rooms containing "{0}":'.format(text))
Ejemplo n.º 5
0
def selectRoomByNameHeight(text, height,bool1,int1, date1):
    '''Select all Rooms in this view containing 'Name' and the given limited height \
(only the two first parameters matter in this example) :'''
    uidoc = __revit__.ActiveUIDocument
    doc = uidoc.Document
    view = uidoc.ActiveGraphicalView
    roomfilter = RoomFilter()
    rooms = FilteredElementCollector(doc, view.Id).WherePasses(roomfilter).ToElements()
    select = [room.Id for room in rooms if room.UnboundedHeight <= height and \
         text.lower() in Element.Name.GetValue(room).lower()]
         
    uidoc.Selection.SetElementIds(List[ElementId](select))
    
    #feedback test
    TaskDialog.Show('Test feedback', 
        '{0} Rooms named "{1}" UnboundedHeight < "{2}":\
            \nbool: {3}\n number{4}\n date :{5}'.format(
                len(select), text, height, bool1, int1, date1))
Ejemplo n.º 6
0
    
if app_dmu:
    box.AddCommandLink(TaskDialogCommandLinkId.CommandLink3, 'Disable all documents Updater ')

# box.FooterText = 'Add comments in the footer'

# close button to abort 
box.CommonButtons = TaskDialogCommonButtons.Close

# show the dialogbox and capture the answer
answer = box.Show()


# 1st option : disable updater for current document
if answer == TaskDialogResult.CommandLink1:
    
    UpdaterRegistry.UnregisterUpdater(my_updater.GetUpdaterId(), doc)
    
# 2nd option : register the current doc
elif answer == TaskDialogResult.CommandLink2:
    
    UpdaterRegistry.RegisterUpdater(my_updater, doc)
    roomfilter = RoomFilter()
    UpdaterRegistry.AddTrigger(my_updater.GetUpdaterId(), roomfilter, Element.GetChangeTypeGeometry())
    UpdaterRegistry.AddTrigger(my_updater.GetUpdaterId(), roomfilter, Element.GetChangeTypeElementAddition())
    
# 3rd option : disable updater for all opened documents
elif answer == TaskDialogResult.CommandLink3:
    
    UpdaterRegistry.UnregisterUpdater(my_updater.GetUpdaterId())
doc = __revit__.ActiveUIDocument.Document
component = [
    Label('Enter Parameter Name:'),
    TextBox('textbox1', Text="CheckBalcony"),
    Label('Enter Room Name:'),
    TextBox('textbox2', Text="Balcony"),
    Separator(),
    Label('Nguyen Khanh Tien - [email protected]'),
    Button('Select')
]
form = FlexForm('Check Parameter Value', component)
form.show()
paraname = form.values['textbox1']
name = form.values['textbox2']
RmFilter = RoomFilter()
collector = FilteredElementCollector(doc)
collector.WherePasses(RmFilter)
roomIdItr = collector.GetElementIdIterator()
roomIdItr.Reset()

t = Transaction(doc, "Check Parameter Value")
t.Start()
print("Checking...")
while (roomIdItr.MoveNext()):
    roomId = roomIdItr.Current
    room = doc.GetElement(roomId)
    rmname = room.LookupParameter("Name").AsString()
    checkbal = room.LookupParameter(paraname)
    if (name in rmname):
        checkbal.Set(True)