Another question that I’d rather not have the answer left to email
I have a project on which HVAC is using AutoCAD MEP for their ductwork (they don’t know Revit…yet). They’re designing in 3D based off my Revit-to-dwg exports. But the only way I can import their 3D ductwork from AutoCAD MEP into Revit, AND have it respect my cut planes in my sheet views, is to bring it into a Revit Generic Family first.
Any ideas on how to improve this workflow (aside from making HVAC work in Revit)? Maybe some sort of Dynamo script to help automate this process?
This is a workflow that I’ve only had to follow a few times when working with a bridge team that was still working in AutoCAD. I guess I’ve had the luxury entire project teams working in either Revit or ArchiCAD and working with this files is a straight forward process.
There is a Dynamo solution that works well, but my first iteration of this doesn’t automatically batch process all the files, but rather it’s run on an as-needed basis. This isn’t such a bad thing though as every DWG file usually isn’t issued all at the same time.
My Dynamo solution requires that you have
- Dynamo 2.x
- GeniusLoci package
- Excel list of families and their corresponding DWG files
First we start off with reading our Excel file, it provides the validation between our RFA names and the required DWG to be inserted to that RFA. I have a dummy list of files, but it shows how the concept works.
Our Excel file has headers included, so we split our our headers with a List.Deconstruct node and we transpose that list so we split out to a list of RFA files and a list of DWG files. Then using a List.GetItemAtIndex node we take the name of the RFA file from the list to validate that against our open document.
Next, we take the name of our open document. Sometimes this node won’t refresh to pick up the current document name, if this is the case, just close and re-open the graph.
The nodes are reporting back not just the file name, but the location that it is saved. To be able to break the string down into it’s separate pieces, we use a String.Split node and split by the string “\\”, once we’ve split the string the split elements will be provided in a list. We simply want to take the last list item as that will be our file name.
Now that we have our file name from our current document as well as the file names from our Excel list, we want to use a List.IndexOf to search our Excel list for the name of our currently open document (final node in the above screenshot)
From there, we can take the list of DWG files from our Excel sheet and using the value produced from our List.IndexOf node we can pull the corresponding DWG name from our Excel list.
We then need to put together a path string. You could hard code this into the code block or you can use the Directory Path node to feed into the code block.
Next is the bulk of the work, with the help of the GeniusLoci package we need to enumerate the DWG import settings available to us. We then take those lists of settings and using a List.GetItemAtIndex node we select our import settings to then feed into our Python script.
The Python script is a modification of the existing Import DWG node from the GeniusLoci package, we just need to change a single word within the script as although the existing node is called Import DWG it actually links the DWG files.
So on line 60 of the script we need to change doc.Link
doc.Link(filePaths[view], options, views[view], linkedElem)
doc.Import(filePaths[view], options, views[view], linkedElem)
Rather than modify the GeniusLoci node itself, I have created a new Python script node and put the modified code within that node.
And that is it. Once all the required data is fed into the Python script, the DWG is placed on the view and our job is done.
If you have a need to import DWGs into family files and want to get started a bit quicker, you can download my Dynamo graph below