Duplicate multiple views - wrong naming

Hi,

I am trying to duplicate multiple views at the same time… I have an example here with only 4 views that I want to duplicate and I want the script to just take the original name and add Copy 1 as a suffix…

This is working but in every project there is one view that gets duplicated with no name, the rest looks exactly how I need it but one of the views always gets duplicated wrong… for now I am always duplicating the one view manually after running the script but I would like the script to do this correct… any ideas?

The picture should explain everything :

Instead of feeding an empty string into the View.Duplicate node, try feeding in the name of the view being duplicated, with your " Copy 1" (keep the space before copy) string appended onto the end.

thank you this works…

though is there any other way to do this?

Maybe a different node where you dont need to specify the name of the new view… because there may be a project with different number then 01-WA001 (this is a number of a prefab element needed in the factory) and the first number always corresponds to the building number and it differs between projects

You’re duplicating an existing view, which has an existing name. So…

  1. Get the view (you have done this already)
  2. Get each view’s name (Element.GetParameterValueByName node on the list of views)
  3. Append " Copy 1" to the end of each view (+ node)
  4. Use the View.Duplicate node where the list of views is the list from #1, the list of names is the list from #3, and the options is what you had before.

Because this would append your suffix to the end of whatever was before it won’t matter what the name is before duplication, as we’re reading that to start with.

This makes sense now, and also it works! thanks you very much

1 Like