@jacob.small
Dynamo does not include the default python/ironpython library into the script context (path
)
Just add it yourself:
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
import ctypes
I wish the dynamo team would include it by default, this question comes up very often
PS: not sure why you need ctypes, but if you only need it to create alerts/msg boxes, you are could always just use the default revit ui elements:
Alert
import clr
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import TaskDialog
TaskDialog.Show('Title', 'Message')
With Options
(python translated from https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/Revit-API/files/GUID-68BD5F44-972C-47CE-9D49-543B37C90561-htm.html)
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