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.

3 Likes

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