Advertisement

Sunday, August 6, 2017

Free Dynamo Progress Bar

From the DesignTech website:

July 25th, 2017
Posted by Deyan Nenov

This is a short post about a Progress Bar Form that you can implement in Dynamo. It only works with a Python Script Node, as you need to embed it within the process you are tracking. Normally you would use it when you want to visualise the progress of a lengthy process. This is also my first post after joining designtech, which is quite exciting!

First of all, I’d like to make it abundantly clear that this is pretty much the exact Progress Bar created by Jeremy Tammik as described here:

http://thebuildingcoder.typepad.com/blog/2013/01/implement-a-progress-bar-and-abort-a-lengthy-process.html

Once you’ve gone through the few simple steps of making it part of your own definition, you should end up with something like this:


MAKING IT WORK

The form is written and compiled as a library in C#. You can load the .dll file the same way you are loading any external library in Python.

It is important not to confuse that with loading a Custom Node or a stand-alone Zero-Touch Node, which process goes through the Dynamo ‘Import’ function. Instead the import statement happens within the Python Node. This should become clear when you go through the definition and the python code below.


#Copyright(c) 2017, designtech
# twitter @designtech_io, http://designtech.io
# @didonenov
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
_path = IN[0]
import sys
sys.path.append(_path)
clr.AddReference(‘ProgressBar’)
from AdnRme import ProgressForm
rooms = IN[1]
results = []
iterations = len(rooms)
def Main():
with ProgressForm(‘Assigning Room Data’, ‘Processing {0} elements …’, iterations) as form:
for room in rooms:
if form.getAbortFlag():
return “Aborted by user. \n(Freeze/Run/Unfreeze node to proceed)”
form.Increment()
message = Main()
if message:
OUT = message
else:
OUT = “Successfully populated %s elements” % str(iterations)

You can download both the dynamo definition and the progress bar library file here or from the super cool button below (still new to WordPress). One important thing to know – when you unzip the .dll file, make sure you Unblock it before using it in Dynamo. That’s as simple as right-clicking the file and unblocking it from the Properties menu. Windows will try to protect you from harmful software and a lot of times .dll files will be blocked when brought in from external sources, which is the case here.

FINAL THOUGHTS

You will not be able to use the Progress Bar in conjunction with any regular Dynamo Node. In this sense, you won’t be able to wire the Form to any node and expect it to work. I’m hopeful that a more knowledgeable  person will eventually come along and think of a way to get this functionality working, as a stand-alone Progress Bar Node can be really helpful.
I hope you will find this Progress Bar useful! It certainly gives a nice quality-of-life boost to the more complex and computationally heavy definitions. You can always message me on twitter if you have any issues getting this little buddy to work.




There's more information available on the DesignTech website.

1 comment:

Unknown said...

Thank you for the great effort, well done