Is there any way to batch create families by cad block with dynamo?

Hi, I have too many CAD blocks need to make as revit families! Is there any way to batch create families by cad block with dynamo? Thank you very much first !
Usually, I need to create a new family file, then import the cad block, then explode the imported CAD block, and finally save it as a completed family file.
Now I want to know how to use Dynamo to complete batch family file creation.
This’re CAD files of furniture(Change ‘dwg’ format to ‘zip’ please).dwg (2.0 MB)


I’m sure there are other ways to do this, but I used this approach when I had to convert 100s of .objs to .rfas. This should work with dwgs as well.

@echo off
SETLOCAL EnableDelayedExpansion

SET FILEEXT=DWG
SET TEMPLATEFILENAME=template

for /R "%~dp0" %%f in (*.%FILEEXT%) do (
    echo processing: %%f
        
    copy "%~dp0\%TEMPLATEFILENAME%.rfa" "%~dp0%%~nf.rfa"
    echo "%~dp0%%~nf.rfa">> "%~dp0filelist.txt"
)

Maybe you can also do this in dynamo, I like to do file manipulations in batch or bash, they are quicker.

This workflow doesn’t create true revit geometry from the imported dwgs, they will be only imports. You just have to figure out what you really want, add it to the script, and cycle through the script with BatchProcessor.

5 Likes

Thank you for helping me!!!
I try it first

Apologies for bringing this post back to life. I am using your process above and came across an issue. The imported 3D CAD only shows up on the ref. level. I understand you have to specify a view in the Import DWG node, so I’m wondering if there’s a way to have the import show up on all views?

Hello, and welcome to the forum!

This is a limitation in the GeniusLoci Import Dwg node. You can change this behavior manually: open the node and edit the python code manually. Change line 29 from True to False:

options.ThisViewOnly = False

This line: GeniusLociForDynamo/Import DWG.dyf at 63c11774ebb281ae5e0ed073e7c64ec5e45eb03d · albandechasteigner/GeniusLociForDynamo · GitHub

Now imported dwgs will become 3D elements.

1 Like

Hi Nick,

You will find the updated Import Dwg node in the Genius Loci package version 2021.6.3.
import DWG

2 Likes

Thanks Alban, it has worked for me! Cheers!