Import model group with Dynamo

Translated by moderator. See below the line for original post


Hello

I have a REVIT project template that will contain far too many model groups.
I want to remove them from the template and store them in a Windows file.
I want to create a dynamo script that would allow me to import model groups into my project that would be stored in a file outside of Revit (Windows type).

I don’t really see how to do it.

Are there people who have already made this type of dynamo or who see how to do it?


Original post below.


Bonjour

J’ai un gabarit de projet REVIT qui va comporter beaucoup trop de groupe de model.
Je souhaite les enlever du gabarit et les stokers dans un fichiers Windows.
Je souhaite réaliser un script dynamo qui me permettrait d’importer dans un mon projet des groupes de model qui serait stocker dans un fichier hors revit (type windows).

Je ne vois pas bien comment faire.

Il y a t’il des personnes qui aurait déjà fait ce type de dynamo ou qui voit comment faire?

Welcome to the forum @julien.avril. The official language here is English, which is a technical requirement to make search work (annars skulle jag bara skriva på svenska för att få in min träning). Please translate future posts using an online service of your choice, including the original text below a demarcation line as I did in the edit to your post above if so desired.

Thanks!

1 Like

damn you have already learn swedish. :wink: :wink:

Translated by moderator. See below the line for original post


No. I don’t speak Swedish.


Original post below


Nej. Jag pratar inte svenska.

1 Like

hahahah :rofl:

To put things back on track…

@julien.avril there is no way to extract Revit content into non-Revit files. Instead I recommend you make a new Revit project file containing one instance of each group and nothing else. You can then write some code to open that file in the background, get a list of all the groups which are in the newly opened file, trigger a UI to have the user select a group name, and copy the instance from the container file into the new one, and then delete the copied instance. This will put the ‘group type’ into your project without creating an instance thereof.

Alternatively you can build a .rvt for each group type and allow the user to select an RVT which is background opened, the one group instance in the newly opened project selected and then copied into the active project, and finally deleting the newly created instance.

Either way you’ll need Revit to see the file contents.

Indeed, that’s a solution. Can we open a Revit file and paste model groups into the Revit project using only Dynamo functions or by using Python?

Yes; I’d go with Python.

You can look into the ElementTransformUtils class, which has a CopyElements() method that can copy from one file to the other. I do not recommend using a series of nodes for opening the file, copying the group, and closing the file as stability and performance suffers due to ALL files being opened at once rather than one at a time. This is because each Revit file needs 20x it’s file size in RAM to open and work well, so if you’re opening 30 small files averaging 300 mb in size in the background you need 30x300x20 mb , or 180gb of RAM available. But if you open, copy, close as one action you only need 300x20 mb or 6GB at a time (most of the RAM frees up after you close the file due to how Revit handles garbage collection).