Esempio n. 1
0
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:
    trans.Commit()
else:
    trans.RollBack()
Esempio n. 2
0
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

# Add Command Link
dialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1,