I was wondering if someone could help me. I got a script that works partly.
It comes with an interface. When everything is filled in it works.
The user is supposed to select a ViewTemplate when he duplicates view(s).
Sometimes there is no ViewTemplate needed, but when the option ViewTemplate is left blank the script wont duplicate.
On the picture down here there is no viewtemplate selected List[0][1] = null
Thanks for the input. thats the problem
as long the user inputs a viewtemplate from the dropdown they get on the interface the script works as desired.
But there is no option to choose “no template” because no template is not a template.
See picture below
How would that work? i think the Apply View Template desires the name of a viewtemplate.
How do i choose no template? i tried feeding it “” but that doesnt work.
the script works as long as the user chooses any template from the dropdown, just when its left out blank it wont duplicate.
I have done something very similar in the past, but how I have dealt with it is to create / duplicate the views FIRST, then apply the template to it AFTER it has been created with a simple Element.SetParameterByName node. This allows you to “skip” the template if one is not selected. I know in this case I am “hard” selecting it, but it would be just as easy through the Data-Shapes.
@Mark.Ackerley I get what you are saying but thats not the point where it stops working.
How do i tell this node template:
Its from Steam Nodes, the python code is shown in my first post.
I can feed it any viewtemplate as string, it will work. but what if i dont want a viewtemplate?
@SeanP Thanks for your help, i came up with the same idea earlier. i think the problem is the node i use, needs viewtemplate as a string. so that wont work.
Could an option be to create a “default” view template and make that the default slection for the drop down? That way if they don’t pick one you still get something to work with? Perhaps you could also look for another view duplicate node that doesn’t require a VT.
Wont it be possible to select <None.> somehow? it shows up in revit when you choose viewtemplate
If no VT selected the script returns null, i can change the null to anything afterwards, i just dont know how to call “no ViewTemplate” or None in Dynamo
Yes -add a option to your list of keys, and a null to your list of values. The graph will throw an error at that node, but the views will be created. So long as you don’t need to process stuff down the line you should be all set.
If you want to avoid the error, you’ll need to work an if statement into your python to not perform any action of the valu passed is a null, and set the template if it’s a string.
Maybe we should back up just a second. Are you trying to apply the VT to ONLY the duplicated views, or to both the existing and new? What you are doing in this graph would be applying the VT to the old BEFORE duplicating them.
However, the Null isn’t working because it can’t duplicate a “null” view. Try putting the template node AFTER the View.Duplicate node. This way if there isn’t a template the view will still be created.
Looks like maybe you should use this post for reference and @Konrad_K_Sobon’s package for existing nodes to do this work.
Once the views are duplicated, use an IF statement to either Apply the VT they selected, or remove it if they didn’t pick one. Would that work for you?