Applying view templates twice to same view in 1 script

Dear all, I have coded a script that applies view template to certain chosen views divided into two main sectors: the first row applies a certain viewtemplate to the views, the second row of the script applies another viewtemplate to the same views. However the problem is the following: After a lot of trials, dynamo doesn’t seem to deal with the same views twice in 1 script, having that said, it successfully rusn the first rows without problems but I can’t get to apply the 2nd viewtemplate to all views.

Any idea how to clear up the cache of dynamo maybe of something similar ?

Thanks !

I have even suspended the usage of custom nodes to apply the templates and coded my own python code for that, but still same porblem which makes me suspect that the problem is with RevitAPI itself.

I’m also thinking of isolating each row in a seperate customnode, do you think it’s gonna help ?

Your graph is not of a quality that we can read, please see the below thread on how to export something we can read.

sure here it is

This is error is so weird where I have just noticed that when I disconnect the views list from one of the setViewTemplate node then run the script and then reconnect it again, everything works fine. It seems to be a trouble with dynamo runtime cache or something

You need to follow the guide.

I did follow the guide, there is no need to expand anything else since all inputs are already popultaed in the single drop-down nodes of views

Do we have to guess which nodes are used?

Also this :point_down:still applies (though you disagree). Maybe not on all, but at least some.

Step 2 Expand the Data Nodes

OR

Maybe share your .rvt and .dyn.

will Export workspace function hides the names of the nodes anyway so here is normal screenshots of step0–3 as an example with data expanded (same procedure repeats itself throughout all other steps)

and here is a normal screenshot of step 10

I think your views need to regenerate after applying the first view template (by opening them)

1 Like

Hi Marcel, I like your notion of it. Do you know any node that can do that?

90% sure that what you are doing cannot be done in Revit as a view can only have one template applied at a time.

1 Like

With Transaction start and end for the firts template. after that the second. I wonder what is your use case.

Only one template is applied in the end though using this method, right?

That’s why I do not see a use case!

Maybe the second template doesn’t control aspects set by the first?

:thinking:

2 Likes

I did not read the whole thing, the logic I guess you are “applying” the view templates after run, logically if you wanted to apply second view temp, you need to duplicated the views first then apply view template 2.

I always use this little trick

This is happening because you are skipping step 3