Can you really save three days of work with one Revit Macro? Here’s how I did it using a Revit macro to automatically convert DWG details to Revit lines.
A while back, I was working with a client to convert some of their office standard wall types to Revit. I created new wall types to match their standard wall type details. I also had to convert these standard details to Revit. The details were drawn in AutoCAD so I had a few options:
- Import the details into a Revit Drafting View, explode them and convert the elements to Revit line styles.
- Link the details into a Revit Drafting View and change the visibility and line styles of the elements
- Trace the linked details in Revit using this method.
Since these details were going to become office standard details, I needed them to be really clean. I didn’t want to clutter up my Revit files with lots of extra line and text styles and I didn’t want to manage a whole lot of links. With this in mind, I choose option 3 and thus began several days of tracing line after line after line. It was really tedious, to say the least. A few days later, I had a clean set of Revit details.
At that time, I didn’t have a way to automate this process. I had to manually redraw the details, using the linked CAD file as an underlay. I had to do a similar exercise recently. However, this time I was determined to figure out a way to automate the process.
Convert DWG to Revit Macro
Who wants to manually trace lines when you can have Revit do it for you?
The “Convert DWG to Lines” macro prompts you to select a linked or imported DWG file. The link or import can be in any type of view. Below is a screenshot of an AutoCAD roof detail that’s been linked into a Revit drafting view.
The macro prompts you to select a linked or imported DWG file. Once you select the DWG file, the macro will access the geometry in the file and create a new Revit line or arc using that geometry. Once it completes the conversion, the macro will let you know how many elements from the CAD file were converted to Revit elements.
The macro creates detail lines so they are only visible in the current view. Also, the macro creates the lines using the “Medium Lines” line style. You can edit the macro code to use any line style you prefer. Just change the value of the “linestyleName” variable as highlighted below.
Just make sure you specify a line style that exists in the current project file. The macro checks that the line style exists and will give you an error if it doesn’t.
Below is a view of the converted AutoCAD file with the linked file removed.
As you can see, the macro does not convert AutoCAD text to Revit text. The ability to read AutoCAD text is currently not available in the Revit API. When you use the macro to convert your AutoCAD details, you will need to add the text manually. It will convert leaders and dimension strings, but not the text associated with those elements. The same goes for hatch patterns. The macro does not convert them to Revit fill patterns (at least not yet).
Download the Free Macro
You can download the macro from the ArchSmarter Revit Macro library. Don’t have access? Sign up for ArchSmarter updates in the form below and get immediate access to this and other time-saving Revit macros!
Need More Power?
Check out Power-Pack for Revit. This Revit add-in includes 7 of the most popular ArchSmarter macros, including a more advanced version DWG to RVT. Convert your DWG to detail lines, model lines, area boundaries, room separation lines or space separation lines. Read more about Power-Pack for Revit.
sounds good. where is the link to the macro ?
Krzystof – After you entered your email address into the form above, you should have received an email with the link to the Revit macro library. If you didn’t get the email, just enter your email address into the form again and you’ll be directed to the library page.
That is a really helpful tool for detailing in Revit..I usually import and explode them, ending with single line styles..Great macro!
So the macro is a .RVT file. Do I need to open it and Save As > Detail Name for each detail?
No, you don’t need to do a Save As. The macro will run on whatever is this active file. Just open the macro RVT file as well as the file containing the DWGs you want to convert. Make the drafting view active then go to Manage > Macro Manager. Select the macro file’s tab then select the macro from the list. Click the “Run” button to run the macro. The macro will prompt you to select a linked or imported DWG file.
Let me know if you have any problems running it.
Download the Marco and when I ran the macro, I was prompted with ‘Line Too Short’ issue during the conversion so I wasn’t able to delete the small line and continue with the conversion of the lines. Any ideas how I can continue with the conversion while removing the short lines?
Thanks
Anthony – Could you email the DWG file you’re trying to convert (michael at spacecmd dot com)? I’ll try it on my end. I should be able to check for that error while the macro is running.
Hi Michael,
thanks for the quick response.. I’ll email you the .dwg file per your request.
Cheers,
I am having the same issue with all the files I try to convert. Did you figureout the problem?
Yes. The current version (1.6) of the macro resolves the issue with lines that are too short. Did you download the macro within the last couple of weeks?
I had an earlier version. Using 1.6 works much better. It still sees lines that are too short but at least I can choose to delete these and maintain end up with usable detail.
-Thanks
A few years ago, we set up some scripts to clean up our AutoCAD details, to prep them for importing into Revit. As I recall, it was better practice to make as many changes as possible in AutoCAD, prior to importation. We ended up creating one script that re-named the layers in AutoCAD to be the same as the linestyles in Revit. There were also some AutoCAD script elements that adjusted the text, dimensions, hatch patterns, and drawing scale. We ended up converting several hundred details, which we still use today.
Would you be interested in sharing this? I’ve been trying to do somthing very similar if not the same thing.
The file doesn’t open because I’m still using Revit 2013. Is is possible to get the macro saved in an earlier version that I can open? Many thanks for your hard work!
I’m working on a earlier versions of the macro but I’ve run into some problems. There’s one function in the macro that only works in Revit 2015. The API changed from 2014 to 2015 so I have to find a work-around. I will let you know when I get this resolved!
I’ve been looking for a plugin like this for a while. But this one doesn’t look very handy…I feel like I can do what this macro does in just a few seconds anyway. If I knew how to code, I would have it prompt you to choose which layers go to which line style. assigning the various line styles and re-annotating is what slows me down the most.
Ross,
Thanks for downloading the macro. Check out DWG to RVT PRO. It reads the DWG layers and lets you select a specific Revit linestyle for each layer. You can convert the DWG to detail and model lines as well as area, room and space boundaries.
Hi Michael. Thanks for useful information and the macro, i’ve downloaded it and appears that it was created in Revit 2015, I’m using Revit 2014, is there a way I can open the macro in Revit 2014 without it having a compatability issue ? It’ll save me hours of time if it could be used in Revit 2014.
Cheers
Kyle
Hi Kyle. Thanks for downloading the macro. Unfortunately, there isn’t a way to run that macro in Revit 2014. The Revit API changed from 2014 to 2015 and I can’t get it to work in 2014. There’s one function that always throws an error and I haven’t found a work around yet. I will let you know if I manage to figure it out.
Hi Michael,
This looks great – however, can it be used in families? I’m trying to convert dwg details into Revit detail families so we can begin detailing in the best pratice way, your macro (or the pro version) would be amazingly useful as a tool for building a library of Revit detail components.
David – Yes, the macro works in families. Simply load the macro file then switch the active window over to your family file. Go to Manage > Macro Manager to run the macro. The Revit API creates family elements different model elements so the macro determines the file type then creates the lines using the appropriate method.
Hi Michael,
I stumbled across your web site looking for some Revit detail components. How great to find all of your macros and associated tips! Hope you are well.
– John
Hey John! Great to hear from you and I’m glad you found the site. Hopefully we’ll catch up soon.
Thanks for share, it a really useful information for me.
Michael:
Thanks for the Revit macro and information. I ran it on a linked cad file. After it was done, the linked cad stays as one block which can’t be exploded. I tried to Link the cad file, then explode it so then I can run your revit macro. If you run the macro with an exploded linked cad, you cannot pick the entire drawing.
Carlos,
The macro works by reading the geometry of the elements in the linked file and recreating them using Revit lines. The macro only works on linked CAD files so you definitely don’t want to explode the link. When you say “the linked CAD stays as one block”, do you mean the original CAD link or the recreated Revit lines?
Michael
I have a large number of .dwg files, originally done by an external supplier, that detail our mechanical expansion joint products and I’m being asked by clients and architects to provide them with revit files.
I have no knowledge of this process – who can convert them for me?
Dane,
I offer a “done for you” DWG to Revit conversion service. I will email you directly with more information. Thanks.
Michael
Hi Michael,
I also have a large number of .dwg files that need converted.
Could you email me details of your “done for you” DWG to Revit conversion service. Thank you.
Ryan
Ryan,
Thanks for your interest. I just sent you an email with some details.
Michael
I would like the link to the Macro.
Thanks
David,
I’m working on packaging up the macro. It’s a bit rough right now and not quite ready for primetime. I’ll let you know when it’s available.
Michael
Old thread I know, I used to have the 2014 marco and thru the years, have lost it. I have bought the power pack, but with a new job, I need the 2014 macro again, the only ones I can find to download are the 2015 – to newer ones. Where can I find the older one?
Hi Michael, some interesting info on your site. Is it still the case that the Revit API can’t read text?
Text is sometimes a big part in our details so in a way I then prefer to rename the layers in AutoCAD to Revit linestyles and then just explode it in a clean temporary Revit file. The biggest issue I found so far is actually the hatch areas, if the area is complex. Revit urgently need a hatch fill tool a la AutoCAD, can’t believe it hasn’t been implemented yet.
Yes, the Revit API still can’t read text in a linked or imported DWG file. I have a macro that reads the text from AutoCAD and recreates it in Revit. This method works pretty well. I have a similar macro for hatches but you’re right, they’re harder to recreate in Revit.
Interesting, are these macros part of your DWG to RVT converter?
Not yet. I’m still fine-tuning the process.
I’ve purchased the power pack for the converter from dwg to room separation lines, but is there a way to just have it a macro instead of an installation?
Thanks.
Francisco