Set viewTemplate to multiple views

Good day!
I want to set a viewTemplate to multiple views. I have already tried this implementation (Python - Set different ViewTemplate to multiple FloorPlanView) 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.

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

@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.

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 ?

1 Like

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

Cheers

1 Like

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

1 Like

No problem! I’m Glad that I could help! :beers:

1 Like