Python - Load family into project

Hello, I’m not a Python programmer but I’m trying to load a family from a folder into the project if it doesn’t exist, the test if it exists or not works but the import of the file doesn’t work. I only get the message false when I use the LoadFamily() command (it didn’t work), maybe someone has an idea or an example to help me.

Thank you for your help

Please see the python documentation on transactions.

There is a Load Component Family node.

Here’s a similar script from the PyRevit Forum.

Thanks, I know the node but it always starts the import even if a family already exists and then only stops when overriding has been disabled and I chose the Python way to start the import only when a family really doesn’t exist, because the families of the sheet piling of the manufacturer are based on Revit 2017 and should not be converted every time just because an existing family is selected and it would be too expensive to convert them yourself for each Revit version, even if the node itself is the easiest way.

Thank you, I will look at the link.

You could cull your list to remove the existing families…

Here’s a quick example. Regex would be better to get the names extracted.

something like this
re-importFamilies.gh (9.4 KB)