Importing multiple DWG files into unique revit families

Goodday Dynamo users,

I’m currently using a python script to import a single DWG file into a family based on its filepath.
Now i’m working on a script which imports the DWG file, saves the family and deletes the dwg file. i’ve got everything working for a single run but i want to loop this so i can run the script once.

I got the SaveAs and delete function to loop for every family, the dwg import howerever is stuck on the first index it receives from the list.

Here is the script for the single import which needs to be looped by list of filePaths:

Any solutions?

Hi @Sven_de_leau,

You could use an updated version of the Genius Loci package with the Import DWG custom node.
The above script looks out of date.
import dwg

1 Like

@Alban_de_Chasteigner
Thanks for the answer! but i was looking for a python solution cause i need to loop it in another script. the script in itself works, just had to use it differently

The script already uses a list of filepaths and a list of views so I’m not sure I fully understand.
Maybe a nested list issue ?

@Alban_de_Chasteigner
I was calling the wrong list so it only took the first item.
i changed this code so it uses the whole list and creates multiple imports.
Hope the explanation makes sense. it works now so i’m happy :slight_smile:

image

1 Like

Hello, I am trying to do the same thing as you. Could you please post the dynamo script here? :slight_smile: