How to construct a TaskDialog?


#1

I am wanting to construct a Taskdialog.

This seems straight forward when constructing single line commands. I’m more intrigued as a general python / class question.

I would have thought as a class I could construct a more complex TaskDialog, however I’m getting a TypeError: NoneType is not callable.

Could someone explain why this is the case ?

import clr
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import *

# Method 1 - this works
#TaskDialog.Show("Title", "Main Content")

#Method 2 - TypeError : NoneType is not callable
dialog = TaskDialog("Header")
dialog.MainContent("Content") 
dialog.FooterText("Footer Text")

dialog.Show()

Many thanks all

J-P


#2

You are calling it wrong. Try this:

import clr
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import *

dialog = TaskDialog("Header")
dialog.MainInstruction = "Hello, Revit!"
dialog.MainContent = "This sample shows how to use a Revit task dialog to communicate with the user." "The command links below open additional task dialogs with more information."

dialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "View information about the Revit installation")
dialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "View information about the active document")

dialog.CommonButtons = TaskDialogCommonButtons.Close;
dialog.DefaultButton = TaskDialogResult.Close;

dialog.FooterText = "<a href=\"http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975 \"> Click here for the Revit API Developer Center</a>"

dialog.Show()

#Assign your output to the OUT variable.
OUT = dialog

Cheers!


#3

Thank you Konrad