Big messy Dynamo graph? Can’t see through the jungle?
- View – Connectors – Show Connectors OFF
- View – Background 3D Preview – Show Grid OFF
I came across this link to a Dynamo seminar by Sol Amour delivered in Wellington about a month ago. I have had a bit of contact with Sol over the years and he is a Dynamo pro. Cool to see that Dynamo Nodes got mentioned too.
Check out the seminar here.
As you can tell by his headshot, he means business 🙂
There is some more information about the event at this link.
The official build of Dynamo 2.0 is here. There are some big changes, so here are my key takeaways:
Download at this link
Read the official post at this link
The Revit API is actually something pretty special. People will go on and on about how Revit needs this feature or that feature, but the fact is that you can build almost any feature you like with the API. Recently, I have been running quite a few batch operations from the scope of a federated Revit model: so I will have one RVT file, with hundreds of Revit links, and I will process them from that main federated model.
On one recent project, we had to deliver to a Client a linked dataset, with Revit link file paths resolving correctly. As you know, people work in many different IT environments, and the pathing of Revit links may vary widely.
I set up an ‘approved’ list of Revit file paths, that looked something like this:
I knew that in Dynamo with Python I could get a lot of information about linked files using the ExternalFileReference class. What I discovered during this process is that there is a TransmissionData API class that let’s you do some pretty interesting things…
You see, I was thinking I would have to set up a batch method to open this files, change the file paths, and close them. But the TransmissionData class is basically what is implemented in eTransmit for Revit – it allows you to ‘lightly touch’ the Revit file and simply change the Revit link paths, and also set a switch saying ‘this file has been transmitted’. This puts the file in an appropriate state for re-opening in the new path environment. Pretty cool huh?
Once I figured out how to implement those TransmissionData actions in Python, I just had to build a node that, running from the federated model:
I did this in the hacky way of a “counter with List.Map” in Dynamo. In the future I’ll probably fix it up to be a ‘proper’ Python script but this works for now. In about an hour it fixed the linked file paths of 600 Revit links, all with the click of a single button 🙂
You can download the main definition here:
You can get the supporting nodes from GitHub here:
As usual, please use with care. And it is probably worth backing up your files before running something like this.
It is kinda more Python than Dynamo but hey, you get the picture 🙂
In fact, here is the Python code:
import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * # Import RevitAPI clr.AddReference("RevitAPI") import Autodesk from Autodesk.Revit.DB import * clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager from System.Collections.Generic import * clr.AddReference('RevitNodes') import Revit clr.ImportExtensions(Revit.Elements) clr.ImportExtensions(Revit.GeometryConversion) from System import Guid import System import sys pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib' sys.path.append(pyt_path) import os.path doc = DocumentManager.Instance.CurrentDBDocument uiapp = DocumentManager.Instance.CurrentUIApplication app = uiapp.Application tempvalue = IN approvedFilenames = IN approvedFilepaths = IN targetfilepath = IN def stripquotes(string): string = string[1:-1] return string transData = TransmissionData.ReadTransmissionData(tempvalue) erefids = transData.GetAllExternalFileReferenceIds() refdata =  for x in erefids: refdata.append(transData.GetDesiredReferenceData(x)) currentpaths, currenterefType, currenterefPath, pstr = , , ,  for e in refdata: currentpaths.append(ExternalFileReference.GetAbsolutePath(e)) currenterefType.append(e.ExternalFileReferenceType) currenterefPath.append(e.PathType) for s in currentpaths: pstr.append(ModelPathUtils.ConvertModelPathToUserVisiblePath(s)) filenames =  for p in pstr: templist = os.path.split(p) filenames.append(templist) newpath =  indices =  failpath =  origcounter = 0 matchrefs =  newpathtypes, newbools = ,  pathtypevar = IN for f in filenames: tempindex = approvedFilenames.index(f) if f in approvedFilenames else -1 indices.append(tempindex) if tempindex == -1: failpath.append(origcounter) pass else: newpath.append(ModelPathUtils.ConvertUserVisiblePathToModelPath(stripquotes(approvedFilepaths[tempindex]))) matchrefs.append(erefids[origcounter]) newpathtypes.append(pathtypevar) newbools.append(True) origcounter = origcounter + 1 currentfilepathstring=ModelPathUtils.ConvertModelPathToUserVisiblePath(targetfilepath) elementcount = len(erefids) hostfile = currentfilepathstring * elementcount currentdata =  #currentdata.append(transData) currentdata.append(hostfile) currentdata.append(erefids) currentdata.append(refdata) currentdata.append(currentpaths) currentdata.append(currenterefType) currentdata.append(currenterefPath) currentdata.append(pstr) currentdata.append(filenames) newdata =  newdata.append(indices) newdata.append(newpath) newdata.append(matchrefs) newdata.append(newpathtypes) newdata.append(newbools) setlength = len(newpath) setcounter = range(setlength) successreport =  setdata = IN if setdata: for s in setcounter: try: transData.SetDesiredReferenceData(matchrefs[s], newpath[s], newpathtypes[s], newbools[s]) successreport.append("Success setting data") except: successreport.append("Failure setting data") else: successreport.append("You need to set the switch to True") if setdata: try: transData.IsTransmitted = True transData.WriteTransmissionData(targetfilepath, transData) successreport.append("Success WRITING data") except: successreport.append("Failure WRITING data") #Assign your output to the OUT variable. OUT = successreport, currentdata, newdata
If you want to read more about the API methods used:
So, you are modelling this awesome conceptual design with Dynamo and Revit, and you realise “hey, what we need is access to the Star Wars API in here…”
Yes? Well, thanks to Jostein Berger Olsen, you can just open up your Package Manager and install SWAPI package:
Nice work @jos_ols 🙂
Check out the original post:
Revit Dynamite and Ammo: Star Wars API and Dynamo
Heaps of presentation and sample file goodness at each link from here, thanks to Håvard Vasshaug:
Workshops | Havard Vasshaug
I had a good time at RTC back in 2016, it was awesome to catch up with the usual BIM crew and see what they are all up to. Hopefully I’ll get a chance to post in more detail about a few things I learned this time around… but for now, here are my 2016 presentations for you to check out.
My keynote presentation slides (why BIM is broken and how to fix it…)
My Dynamo presentation slides:
And the Revizto session that I ran with Michael Clothier:
Presentation and handout resources (including Dynamo dataset) are available in the folder here:
Quite a momentous day!
You can download it at:
(or you can wait for the auto update 🙂
### 1.0.0 ###
– API Stabilization: 1.0.0 is a commitment to stable code that allows for smoother and more reliable movements from one version to another. To more clearly express this, we have been moving to “semantic versioning” to illustrate the nature of changes in each release. We will be using the fairly standard version naming with an x.y.z system, where x incrementing represents breaks to the API (requiring developer refactors), y indicates changes that are still backwards compatible, and z are smaller bug fixes. Package creators and maintainers are encouraged to assess changes to the previous code, which can be found here
– Graphics performance enhancements: see this post for details
– Documentation: Along with new sections of the DynamoPrimer (http://DynamoPrimer.com), we have started an online documentation of the Dynamo API with a searchable index of public API calls for core functionality. This will be expanded to include regular nodes and Revit functionality. http://dynamods.github.io/DynamoAPI/
– Licensing: Dynamo Studio is now using a new version of the Autodesk installer that allows for easier access to network and token flex licensing tools
– Install: we have created a separate installation for “core” Dynamo functionality, those tools used by all implementations of Dynamo, and Revit, and Studio installations. This allows for the sharing of a common core of Dynamo code and packages.
– List Management: Changes to “replication” or automated matching of different data streams in nodes and Code Block nodes eliminates the need for List.Map and List.Combine in many situations
– Send to Web: formerly known as Share Workspace, we have improved the ability to view and interact with Dynamo online with Customizers
– File Export: Users can now author DWG files in the Translation section of Dynamo Studio.
– Direct Shape: Dynamo in Revit 2017 can now take advantage of faster and more sophisticated direct shape creation. In most cases, solid and surface geometry can be sent directly into the Revit environment as smooth (rather than tesselated) surfaces and solids, categorized to whatever is needed. In the cases where a smooth element cannot be created, a tesselated (mesh) object is created, as was the case previously.
– An extensive list can be found here: http://dynamobim.org/incoming-bug-fixes-for-dynamo-1-0-0
– Listed here: https://github.com/DynamoDS/Dynamo/wiki/Known-Issues
It can be pretty hard to track what is visible in a big federated model, and even harder to figure out when something has been changed or updated. Until now…
Check this little node out:
This gets five pieces of information and writes each of them to a View instance parameter. Currently, it works in the context of the currently active view in Revit. The information acquired is as follows:
The ‘list items’ are converted to a string with line breaks. Then when it is referenced in a Label in a View Title family (on the far right of image above), it basically shows up as a list.
Future applications of this can easily include reading the link status from the view parameter (by converting the string back to a list), comparing it to current link status, and then immediately showing what models have been updated and need to be reloaded…
One of the biggest challenges for many long-time Revit users is that initial ‘starting point’ of getting into Dynamo. It takes a bit of time and effort to make that transition…
Happily, as with Revit, the community is the key. The community is full of people who are providing free packages, definitions, and code, and free advice to new users. But where can we find all of this info? Check out this post on Kyle Martin’s blog. He gives some great tips on how to integrate Dynamo learning into your daily work.
Here are a couple of comments I enjoyed:
I added some of the feeds he mentioned to my super aggregator feed at:
Full post at:
Getting Started with Dynamo — Kyle C Martin
… there are many blogs produced by pure Dynamo enthusiasts that have helped me in my journey. I highly recommend that you check them out if you are looking for answers or inspiration:
Proving Ground (io) & The Proving Ground (org)
Havard Vasshaug’s blog
What Revit Wants
Sixty Second Revit
AEC, You and Me
Jostein Olsen’s blog
Revit beyond BIM
Kyle Morin’s blog
The Revit Kid
The Revit Saver
SolAmour’s extensive list of resources
Listen to the Dynamo Team explain the history and recent popularity of Dynamo on the Designalyze Podcast.