def window(numberoftags): """Result Window""" dialog = TaskDialog("Header") dialog.MainInstruction = "Results" dialog.MainContent = "{0} tags were switched to {1}".format( numberoftags, 'halftone') dialog.CommonButtons = TaskDialogCommonButtons.Close return dialog.Show()
def dialogManager(): '''dialogbox to manage updater state from a ribbon button''' #scope when dialogManager is called doc = __revit__.ActiveUIDocument.Document # registering state app_dmu = UpdaterRegistry.IsUpdaterRegistered(myroomupdater.GetUpdaterId()) doc_dmu = UpdaterRegistry.IsUpdaterRegistered(myroomupdater.GetUpdaterId(), doc) # note : the global will be unregistered when the last document is unregistered # note2 : look at IsUpdaterEnabled and EnableUpdater/DisableUpdater too # note3 : enabled or not, an updater may be suspended by Revit for misbehaving # build the dialog box box = TaskDialog('Dynamic Model Updaters') box.MainInstruction = 'DoubleHeight Updater Manager' box.MainContent = '- Document Updater is :{0} Registered'.format( ' NOT' * (not doc_dmu)) box.MainContent += '\n- Global Updater is :{0} Registered'.format( ' NOT' * (not app_dmu)) # add command options if doc_dmu: box.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, 'Disable document Updater') else: box.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, 'Enable document Updater') 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: doc_unregister(doc) # 2nd option : register the current doc elif answer == TaskDialogResult.CommandLink2: doc_register(doc) # 3rd option : disable updater for all opened documents elif answer == TaskDialogResult.CommandLink3: global_unregister()
def dialogManager(): '''dialogbox to manage updater state from a ribbon button''' #scope when dialogManager is called doc = __revit__.ActiveUIDocument.Document # registering state app_dmu = UpdaterRegistry.IsUpdaterRegistered(myroomupdater.GetUpdaterId()) doc_dmu = UpdaterRegistry.IsUpdaterRegistered(myroomupdater.GetUpdaterId(), doc) # note : the global will be unregistered when the last document is unregistered # note2 : look at IsUpdaterEnabled and EnableUpdater/DisableUpdater too # note3 : enabled or not, an updater may be suspended by Revit for misbehaving # build the dialog box box = TaskDialog('Dynamic Model Updaters') box.MainInstruction = 'DoubleHeight Updater Manager' box.MainContent = '- Document Updater is :{0} Registered'.format(' NOT' * (not doc_dmu)) box.MainContent += '\n- Global Updater is :{0} Registered'.format(' NOT' * (not app_dmu)) # add command options if doc_dmu: box.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, 'Disable document Updater') else : box.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, 'Enable document Updater') 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: doc_unregister(doc) # 2nd option : register the current doc elif answer == TaskDialogResult.CommandLink2: doc_register(doc) # 3rd option : disable updater for all opened documents elif answer == TaskDialogResult.CommandLink3: global_unregister()
def AppDialogShowing(sender, args): dialogId = args.DialogId promptInfo = "A Revit dialog will be opened.\n" promptInfo += "The DialogId of this dialog is " + dialogId + "\n" promptInfo += "If you don't want the dialog to open, please press cancel button" taskDialog = TaskDialog("Revit") taskDialog.Id = "Customer DialogId" taskDialog.MainContent = promptInfo buttons = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Cancel taskDialog.CommonButtons = buttons result = taskDialog.Show() if TaskDialogResult.Cancel == result: args.OverrideResult(1) else: args.OverrideResult(0)
fRule = FilterStringRule(pvp, fnrv, values[count], True) elif 'Interger' in str(i.StorageType): fnrv = FilterNumericEquals() fRule = FilterIntegerRule(pvp, fnrv, int(values[count])) elif 'Double' in str(i.StorageType): fnrv = FilterNumericEquals() fRule = FilterDoubleRule(pvp, fnrv, float(values[count]), 0.001) elif 'ElementId' in str(i.StorageType): fnrv = FilterNumericEquals() fRule = FilterElementIdRule(pvp, fnrv, ElementId(int(values[count]))) fRules.append(fRule) count += 1 # Filter all elements based on parameter values selected paramFilters = ElementParameterFilter(fRules) ele = filter.WherePasses(paramFilters).ToElements() elements = [] for i in ele: elements.append(i) # Task Dialogue Creation dialog = TaskDialog('Warning') dialog.CommonButtons = TaskDialogCommonButtons.Ok dialog.DefaultButton = TaskDialogResult.Ok dialog.Title = 'Warning' dialog.MainInstruction = 'You are about to select ' + str( len(elements)) + ' elements' bool = dialog.Show() if str(bool) == 'Ok': revit.get_selection().set_to(elements) else: pass
# add command options if doc_dmu: box.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, 'Disable document Updater') else : box.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, 'Enable document Updater') 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()
collPipeSystems = FilteredElementCollector(doc).\ OfCategory(BuiltInCategory.OST_PipingSystem).ToElements() # DS now and late = Duct System collDuctSystems = FilteredElementCollector(doc).\ OfCategory(BuiltInCategory.OST_DuctSystem).WhereElementIsNotElementType().ToElements() DSNameList = [i.Name for i in collDuctSystems] newDialog = TaskDialog("Warning!") newDialog.MainContent = "Найдено " + DSNameList.Count.ToString( ) + " систем воздуховодов.\ \nПродолжить?" buttons = TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No newDialog.CommonButtons = buttons result = newDialog.Show() if result == TaskDialogResult.No: TaskDialog.Show("Warning!", "Отменено") raise SystemExit vfType = [i for i in FilteredElementCollector(doc).\ OfClass(ViewFamilyType).ToElements() if i.ViewFamily.ToString() == "ThreeDimensional"] vfType = vfType[0].Id #view template ID for 200 try: vt200 = [i for i in FilteredElementCollector(doc).\ OfClass(View).ToElements() if i.IsTemplate and i.Name == "P-A-200"][0].Id
# add command options if doc_dmu: box.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, 'Disable document Updater') else : box.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, 'Enable document Updater') 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) filter = RoomFilter()