How to take an input into a Ctype


#1

Hello,
I was looking at this forum post here:


And I would like to make a CType window that pops up at the end of my script run just like this post wants. However, I want it to include data from my script to tell the user a specific number. However I dont know how to do that. My Python skills are extremely limited but I would like to figure this out. Besides that I am already using data shapes at the begining of the script so therefore I cant use them at the end. Please let me know what I need to do. Here is what I have so far:


#2

You need to import some extras from the RevitAPIUI before this will work.
image

import clr

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

dataEnteringNode = IN[0]

b = TaskDialogCommonButtons.Ok

TaskDialog.Show('Title',dataEnteringNode,b)

OUT = "You just displayed " + dataEnteringNode

But there shouldnt be any reason to not use the Datashapes UI again.
You will just need to enforce the run order of the Graph so the last input waits before promptin with the UI.


#3

For example like this :

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

TaskDialog.Show("FYI",IN[0])

Taskdialog


#4

Thanks Ewan! So what does the b=TaskDialogCommonButtons.Ok line do? I dont see any reason for it. Likewise, the TaskDialog.Show(‘Title’, dataEnteringnode,b) makes sense right up until ‘b’. Because it doesnt show anything for ‘b’. So what is that for? I dont understand. Sorry I am just trying to learn. Alban’s makes a lot more sense to me, but I figure there has to be some reason for your extra code. What is it? Thanks!


#5

also,
Is there a way to take information from users like this below, i cant seem to figure out how to set info in these buttons or extract it once its clicked on. Any more info on this node would be most helpful!

import clr
clr.AddReference(‘RevitAPIUI’)
from Autodesk.Revit.UI import TaskDialog, TaskDialogCommonButtons, TaskDialogResult, TaskDialogCommandLinkId

mainDialog = TaskDialog("Hello, Revit!")
mainDialog.MainInstruction = "Hello, Revit!"
mainDialog.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."""

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

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

mainDialog.FooterText = "Click here for the Revit API Developer Center"

tResult = mainDialog.Show()
OUT = tResult


#6

This is the value I used to define a CommonButton for the dialogue.

You can have multiple buttons in your dialogues to be able to influence the progression of your workflow.
Here is how this can be used. :grinning:

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

dataEnteringNode = IN[0]

buttonlist = TaskDialogCommonButtons.None|TaskDialogCommonButtons.Ok|TaskDialogCommonButtons.Yes|TaskDialogCommonButtons.No|TaskDialogCommonButtons.Cancel|TaskDialogCommonButtons.Retry|TaskDialogCommonButtons.Close

result=TaskDialog.Show("Title",dataEnteringNode,buttonlist)

OUT = result

ezgif-4-89d37b5ae4