# Set viewTemplate to multiple views

**URL:** <https://forum.dynamobim.com/t/set-viewtemplate-to-multiple-views/66071>\
**Category:** Revit\
**Tags:** dynamo\
**Created:** [July 12, 2021, 12:25pm UTC](https://forum.dynamobim.com/t/set-viewtemplate-to-multiple-views/66071 "2021-07-12T12:25:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cool.inna-24](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cool.inna-24/32/132661_2.png) [@cool.inna-24](https://forum.dynamobim.com/u/cool.inna-24)\
**Post date:** [July 12, 2021, 12:25pm UTC](https://forum.dynamobim.com/t/set-viewtemplate-to-multiple-views/66071/1 "2021-07-12T12:25:05Z")

</div>

Good day!  
I want to set a viewTemplate to multiple views. I have already tried this implementation ([Python - Set different ViewTemplate to multiple FloorPlanView](https://forum.dynamobim.com/t/python-set-different-viewtemplate-to-multiple-floorplanview/64363)) but I get a mistake after compilation:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.  
Tracking (last call last):  
File “”, line 34, in  
EnvironmentError: System.Runtime.InteropServices.SEHException (0x80004005): An external component threw an exception.  
at Element.setParameterValue (Element \*, ElementId, ParameterValue \*)  
at Autodesk.Revit.DB.Parameter.Set (ElementId value)  
at Microsoft.Scripting.Interpreter.FuncCallInstruction `3.Run (InterpretedFrame) at Microsoft.Scripting.Interpreter.Interpreter.Run (InterpretedFrame) at Microsoft.Scripting.Interpreter.LightLambda.Run4 [T0, T1, T2, T3, TRet] (T0 arg0, T1 arg1, T2 arg2, T3 arg3) at System.Dynamic.UpdateDelegates.UpdateAndExecute3 [T0, T1, T2, TRet] (CallSite site, T0 arg0, T1 arg1, T2 arg2) at Microsoft.Scripting.Interpreter.DynamicInstruction` 4.Run (InterpretedFrame)  
at Microsoft.Scripting.Interpreter.Interpreter.Run (InterpretedFrame)  
at Microsoft.Scripting.Interpreter.LightLambda.Run2 [T0, T1, TRet] (T0 arg0, T1 arg1)  
at IronPython.Compiler.PythonScriptCode.RunWorker (CodeContext ctx)  
at Microsoft.Scripting.Hosting.ScriptSource.Execute (ScriptScope scope)  
at DSIronPython.IronPythonEvaluator.EvaluateIronPythonScript (string code, IList bindingNames, IList bindingValues)

I attach my code. How I can solve it? Will be glad for any help.

 ![Снимок экрана (20)](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/7/f7271110339f185834487dbe101fe75b8bfff4b7.png)

---

<div class="post-metadata">

**Author:** ![paris](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paris/32/144289_2.png) [@paris](https://forum.dynamobim.com/u/paris)\
**Post date:** [July 12, 2021, 6:00pm UTC](https://forum.dynamobim.com/t/set-viewtemplate-to-multiple-views/66071/2 "2021-07-12T18:00:09Z")

</div>

Hi @cool.inna-24 , you can use OOTB node instead python node, or it’s a choice?  
Cheers

---

<div class="post-metadata">

**Author:** ![cool.inna-24](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cool.inna-24/32/132661_2.png) [@cool.inna-24](https://forum.dynamobim.com/u/cool.inna-24)\
**Post date:** [July 12, 2021, 6:58pm UTC](https://forum.dynamobim.com/t/set-viewtemplate-to-multiple-views/66071/3 "2021-07-12T18:58:07Z")

</div>

@paris, thank you for your answer.  
I tried with nodes, but I was needed to loop a combination of nodes for each viewTemplate. I haven’t been successful in nodes. Next I decided to use python script. It is even more optimal.  
So I do want to eliminate the mistake.

---

<div class="post-metadata">

**Author:** ![BenBimlogic](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/benbimlogic/32/133767_2.png) [@BenBimlogic](https://forum.dynamobim.com/u/BenBimlogic)\
**Post date:** [July 12, 2021, 10:47pm UTC](https://forum.dynamobim.com/t/set-viewtemplate-to-multiple-views/66071/4 "2021-07-12T22:47:34Z")

</div>

Hi @cool.inna-24 , can you share your .Dyn file ? There’s an error with your Views.ViewTemplate node and that might be the reason why it won’t set the viewtemplate.

Also, do you want to apply one viewtemplate to all the views selected or multiple viewtemplate like my Script ?

---

<div class="post-metadata">

**Author:** ![paris](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paris/32/144289_2.png) [@paris](https://forum.dynamobim.com/u/paris)\
**Post date:** [July 13, 2021, 7:09am UTC](https://forum.dynamobim.com/t/set-viewtemplate-to-multiple-views/66071/5 "2021-07-13T07:09:30Z")

</div>

Hi @cool.inna-24  
Maybe this can help you:

> [@Set multiple templates to view, one after another](https://forum.dynamobim.com/t/set-multiple-templates-to-view-one-after-another/57191):
>
> Hello Dynamo Community! This is my first post but it for sure won´t be the last one! I´m pretty new to Dynamo and Revit and i`m having fun experimenting and lerning. I´m having trouble with my first script and would appreciate your help. Task: find all views with specific view template set new view template (e.g.: wall\_views\_filter) set another view template (e.g.: wall\_views) Reason: Our worklflow is to have a filter-template for our view types. For example, we have a wall\_views template …

> [@Set View Template](https://forum.dynamobim.com/t/set-view-template/27059):
>
> Hey. I’m trying to make levels and then put on some specific view templates, but i get a warning when i try to put on view templates. How can change the list content to a string?? Nichlas

Cheers

---

<div class="post-metadata">

**Author:** ![cool.inna-24](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cool.inna-24/32/132661_2.png) [@cool.inna-24](https://forum.dynamobim.com/u/cool.inna-24)\
**Post date:** [July 13, 2021, 8:59am UTC](https://forum.dynamobim.com/t/set-viewtemplate-to-multiple-views/66071/6 "2021-07-13T08:59:39Z")

</div>

Thank you, @BenBimlogic, @paris !  
@BenBimlogic , you hit it! I have solved a problem at last.  
In attached image there are changes those I made.

 ![Replacing](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/7/47d292a9d63a281364f6ba5e91de59d21cc8ceb5.png)

---

<div class="post-metadata">

**Author:** ![BenBimlogic](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/benbimlogic/32/133767_2.png) [@BenBimlogic](https://forum.dynamobim.com/u/BenBimlogic)\
**Post date:** [July 13, 2021, 3:19pm UTC](https://forum.dynamobim.com/t/set-viewtemplate-to-multiple-views/66071/7 "2021-07-13T15:19:52Z")

</div>

No problem! I’m Glad that I could help! 🍻
