I have a lengthy script that goes through 100+ files to get elements, does calculations, and exports to excel. I need to provide a message to the user after each process is done but they don’t need to interact with the messages, currently Rhythm’s UI SimpleUserMessage needs to click close to continue and also Revit Api UI’s python script also needs that interaction. Does anybody know how to just show messages without blocking the dynamo script or needing user interaction ?
Why not just write this information to the Excel file as you build the dataset? If each file has its own Sheet then it’s fairly obvious when a file finishes exporting.
Because I’m working with one excel file that will be updating a sheet for each Revit file. The excel file doesn’t get updated as the script is running, I have to close and reopen it. Is WriteExcel suppose to do that ? I see BumbleBee is suppose to have a LiveWriteEcel is that what you were referring to ?
I may be wrong, but I thought I had seen this done some may or another. You may have to dig into the Excel API yourself if LiveWrite doesn’t do what you want.
The problem with posting a message to Revit is that I don’t think you can idle during a transaction. Or you otherwise have to hack at it to get a similar effect. You could maybe have python automate the button sender when a sheet is finished but I’m not sure.
@Nick_Boyts Was able to solve it using System.Windows.Forms, Form.Show doesn’t block the Thread like MessageBox or TaskDialog, it could if you use Application.Run(form). I would want the Live excel updates in the future, do you know what happened BumbleBee’s LiveExcelWrite ? I may need to go in and modified the node again, I already tweaked it to make it work with macro sheets.
Code below
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')
from System.Drawing import *
from System.Windows.Forms import *
from System import Array, Object
runMe = IN[0]
captionMsg = IN[1]
labelMsg = IN[2]
class SimpleForm(Form):
def __init__(self):
# The text to show in the top bar
self.Text = captionMsg
# The width of the form in pixels
self.Width = 240
# The height of the form in pixels
self.Height = 80
# Make the form a fixed size
self.FormBorderStyle = FormBorderStyle.FixedDialog
# Position the form in the center of the screen
self.StartPosition = FormStartPosition.CenterScreen
# Bring the form to the front of all windows
self.TopMost = True
# Show top bar controls....
self.ControlBox = True
self.MaximizeBox = False
self.MinimiseBox = False
if runMe:
form = SimpleForm()
label = Label()
label.Width = 240
label.Height = 120
label.Text = labelMsg
form.Controls.Add(label)
form.Show()
else:
OUT = 'Set RunMe to True'
Looks like @Konrad_K_Sobon said “was right. In version 1.0 I have combined these two nodes into a single Write Excel node. It will write in “Live” mode when you have Excel file open, and you DO NOT connect File Path”. I’ll just keep the messages actually, seems to add a bit more instructions if we do go the Live route.