Automatically Convert DWG Details to Revit Lines

automation macros revit Feb 18, 2015

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:

  1. Import the details into a Revit Drafting View, explode them, and convert the elements to Revit line styles.
  2. Link the details into a Revit Drafting View and change the visibility and line styles of the elements
  3. 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!

Join ArchSmarter!

Sign up for ArchSmarter updates and get access to the ArchSmarter Toolbox, a collection of time-saving Revit macros, Dynamo scripts, and other resources. Plus you'll get weekly productivity tips, webinar invitations and more! Don't worry, your information will not be shared.

We hate SPAM. We will never sell your information, for any reason.