Copy select view templates from one file and copy into all files in a set directory

Hi All,

I am making a script that is supposed to copy select view templates from one file and copy into all files in a set directory but am getting stuck.

It doesnt seem to be registering any view templates in the source file.

Is anyone able to provide some guidance on this?

BULK UPDATE VIEW TEMPLATES.dyn (83.9 KB)

Hi,

This part doesn’t look correct for me.

First of all , you can’t feed View Type where Element Type is required

Second, not sure if Collector.ElementsOfTypeInDocument works as expected in Revit 2023 and further versions.

Usually, to collect view templates in Document, I use node All ElementsofCategory+ from Clockwork, and feed Views category into it. Then you can filter out View Templates by node View.IsViewTemplate.

One more comment. If I remember correctly, view templates for 3d view can’t be picked this way. It’s tricky to find them

It would be nice to see the data flow from the preview tab.

One thing though, I don’t believe the CopyElementsFromDocument node will work if you have the files open in the background. IIRC it’s intended to have an open and active document, then copying from a file that’s opened in the background.

One approach I would suggest is making the script similar, but using Dynamo Multiplayer from Bird Tools to open the required files. This way you’re going to always have the destination file as the Active Document, which is how I believe the node I mentioned is intended to work.

I have a python script for that task which i use often but nothing with nodes you could understand, so I cannot help

Thankyou Andriy & Pedruccioli for your feedback.

I have taken it on board and believe the script is now flowing as intended … it now registers the view templates in the source file!!! Winning!

But it is still not saving the backgroud opened files and i dont believe overriting the view templates.

What is the best node to use for this?

BULK UPDATE VIEW TEMPLATES.dyn (77.4 KB)

From what I understand, Dynamo needs an active file to latch onto, and the files on the background are the ones you take the data from, and place in said active file. Maybe @jacob.small can help us out here to check if your logic stands, or if I’m correct to assume this. I’ve never been able to invert this, using documents in the background both as source and target.

With that in mind, what you need to connect into DataStream.Await is actually the output from Applications.OpenDocumentFile, not the elements you copied (Applications.CloseDocument needs a Document input, not Elements).

So, my approach here would be to have a Dynamo Script without UI, where you either get a premade list of Templates or all Templates from the source file. Run that from Dynamo Multiplayer, and will work like a breeze.

I say this because I don’t recommend using UI with Dynamo Multiplayer, as it will need input for every target file, so in this case I find it best to prepare an adequate source file.

This would be my approach - have a graph which works with the open file and loads in what you need from a rvt which you will always have access to (the most difficult aspect of this) and then leverage the custom dropdown node to allow them select what they want to transfer. This can then be run via Dynamo multiplayer to allow bulk adding the selected element into each file.