Changing View name with UI (data-shapes)


I am trying to create a script with data shapes, where you select the view that you want to change the name and then type the new name.
The UI is working fine but the final step where they have to run and change the name is having issues and cannot find why.

please post your script or a screen shot of the error message pop up. one thing you might consider on this is using data-shapes datatable node to allow users to update multiple views in an “excel” table type of interface. you could have two columns: current name and new name columns that users fill in. just a thought. DiRoots is also a helpful plug that does similar renaming work

1 Like

Here is my script.

And the error is this “Warning: Element.SetParameterByName expects argument type(s) (Element, string, var), but was called with (string, string, string).”
I understand the error, but not sure how to fix it.

Change name of View Name.dyn (48.2 KB)

It sounds like you have only the view names in your top input: the first “string” in the error message, this needs to be an “Element” which is the actual view you are trying to rename. In your UI.ListView Data node, you have a key and a value input, you will need to insert the view elements into the values and the view names into the key input. this should remedy your issue.

It looks like your keys and values are the same object - the view name judging by the error. The value needs to be the actual element.

Perfect, you were right in that.
But I still have problems with the parameter to set, it is saying that they cant find that parameter. I think I am doing in the incorrect way the filtering, or maybe I have to select the parameter before the UI.multipleform (and added to the inputs)

First off, make sure you’re supplying the filtered element list since that’s the list of names you’re using. Right now you’re using the original list. If that doesn’t fix the problem post an image again with node preview bubbles for all the inputs as well.

And as an FYI your list will also include view templates so you might want to filter those out as well unless you’re wanting to rename templates. You can also just use a single “View Name” string as the parameter name input. No need to pull the same value from all views.

It is weird, because sometimes it works and others no. I put a string to read “view Name” parameter, and sometimes it tell me that the parameter is not found.

I upload the script here.

Change name of View Name.dyn (56.3 KB)

Filter those views ahead of time. They’re likely 3D views.

Thank you very much.
Now I try in another way (because i was filtering my views as you said and the problem was still there). So now I ried with element tyopes “view Plan” and the parameter not found problem is still there

I think Nick is suggesting this in his older post:

You’ve filtered down your list of names/keys, but you haven’t also applied that filtering to the view elements.