def get_datafile(reverse): global append_mode datafile = script.get_document_data_file("pyApex_Constraints", "pym") saved_list = [] if os.path.exists(datafile): if reverse == False: td = TaskDialog("Constraints") td.MainInstruction = "File with elements saved after previous run found.\nHow to deal with it?" td.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "Remove it and replace") td.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "Append new data") td.AllowCancellation = True taskDialogResult = td.Show() if taskDialogResult == TaskDialogResult.Cancel: return None, None elif taskDialogResult == TaskDialogResult.CommandLink1: append_mode = False else: append_mode = True if append_mode: f = open(datafile, 'r') saved_list = pickle.load(f) f.close() # remove duplicates ids = list(set(saved_list)) return datafile, ids
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()
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
continue if ii == 0: print "None" if ii !=0: print "Total Details/Sections Modified: " + str(i) if i == ii == 0: __window__.Close() trans.RollBack() TaskDialog.Show("You are amazing! None of the Drafting Views or Sections on sheets were missing templates. You should celebrate.") sys.exit() # Get the application and document from external command data. # app = commandData.Application.Application; # activeDoc = commandData.Application.ActiveUIDocument.Document; # Creates a Revit task dialog to communicate information to the user. mainDialog = TaskDialog("SilmanApps") mainDialog.MainInstruction = "I recommend reviewing the results before keeping them." mainDialog.MainContent = "Click on the Revit icon on the taskbar and switch windows to view." # Add commmandLink options to task dialog mainDialog.AddCommandLink(Autodesk.Revit.UI.TaskDialogCommandLinkId.CommandLink1,"Undo changes?") mainDialog.AddCommandLink(Autodesk.Revit.UI.TaskDialogCommandLinkId.CommandLink2,"Keep Changes") # Set footer text. Footer text is usually used to link to the help document. mainDialog.FooterText = " " tResult = mainDialog.Show() # If the user clicks the second command link, a simple Task Dialog # created by static method shows information about the active document if Autodesk.Revit.UI.TaskDialogResult.CommandLink2 == tResult:
This file is shared on www.revitapidocs.com For more information visit http://github.com/gtalarico/revitapidocs License: http://github.com/gtalarico/revitapidocs/blob/master/LICENSE.md """ # Results here: https://imgur.com/4DiPYfe from Autodesk.Revit.UI import (TaskDialog, TaskDialogCommonButtons, TaskDialogCommandLinkId, TaskDialogResult) title = 'Task Dialog Title' dialog = TaskDialog(title) # Properties dialog.MainInstruction = 'Text Header' dialog.MainContent = 'Text Content' dialog.FooterText = 'Footer Text' dialog.VerificationText = 'Verification Text' # dialog.ExpandedContent = expanded_content # Settings dialog.TitleAutoPrefix = False dialog.AllowCancellation = True # Add Button dialog.CommonButtons = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Yes # Set Default Button dialog.DefaultButton = TaskDialogResult.None
# create an instance my_updater = MyRoomUpdater(app.ActiveAddInId) # registering state app_dmu = UpdaterRegistry.IsUpdaterRegistered(my_updater.GetUpdaterId()) doc_dmu = UpdaterRegistry.IsUpdaterRegistered(my_updater.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 ')
def window(): dialog = TaskDialog("Sheet Names to CSV") dialog.MainInstruction = 'Options' dialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, 'Sheet Name and Number','') dialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, 'Sheet Name Only', '') return dialog.Show()