Hi there! I’m running a version of the pyRevit tool to find all revision tags of a selected revision and its standard output is a text window. I’m seeing no way currently to display the printed output of the script being run like there is when running a Dynamo script via Orkestra. Is there a feature I can enable or something I’m missing with OkPy’s current user interface to allow for visibility of the output window without downloading some external libraries or programs?
Thanks in advance!
Hey there @jblanchard !
Do you need a specific interaction with the output ? Or do yu just want to visualize the list ?
Hi @m.elayoubi, my first thought is to display a pop-up window with the output but even just visualizing the printed output in the same way as is possible when running Dynamo Orkestra scripts would reach the same end goal. No need to interact with the output as of yet but let me know if you think it would be desirable to do so!
Alright then! There’s a way to do so using Revit’s TaskDialog. Here’s a very basic example showing it in action:
This is the code running behind:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import TaskDialog
#The current uidoc, doc, uiapp, and app are stored in the following variables
doc = __currentdoc__
app = __app__
uidoc = __uidoc__
uiapp = __uiapp__
#The inputs are stored in the __inputs__ dictionray
#The key for each input can be set through the UI
inputs = __inputs__
#Showing dialog with title and content
TaskDialog.Show("My OkPy Tool", str(len(inputs["selection"])) + " Elements Selected!")
The TaskDialog class also offers more customization with the settings of buttons and associated commands : ApiDocs.co
We’re working on more advanced outputs that let you click on elements to view them in Revit etc. , but that’s not available yet.
Got it! That’s a huge help, thank you so much!
Awesome ! Sure thing @jblanchard !