How to modify a viewport's "Title" parameter (family type parameter) based on the viewports "View Name" Parameter

Hello, I seem to be stuck, is there no way to extract all the names of the views associated with every viewport on a sheet in a project? I dont seem to be able to do this. I wan to then change the viewports “Title” parameter to a specific value based on the family type. But I dont see anyway to be able to get the viewports’ Type Name or anything. See below. Thanks!

Not super sure what you are trying to do but I think you want to try something like this. Let me know if this helps or I am not even close.

1 Like

Hi @Steven_Hansen

FYI, Whenever you want to type hint/note in code block hit “Divisional Slash” twice before.

1 Like

or this (Element.Type from Clockwork)

Is there a way to do this without a sheet schedule? I dont have one?

I dont seem to be able to get all the view ports in the project and select their parameters. when I do it this way I get nothing:

But when I do it this way I only get the parameters of the viewport types:
What am I doing wrong?

Ok, but what I need to do is to set the viewport type based on the view name:


Also why am I getting an empty list when I try to add the view title to the viewport type?

Ok - that’s a different problem than what i though you were tring to accomplish. Couple of questions:
First - View Name is always unique - if you have 20 View you will have 20 unique names - are you going to have 20 Viewport Types? or are you looking to Search the view Names ofr some sub-String and then Set the Viewport Type based on the Substring?
Second - Viewport Types have Type Name, not View Name. View Name is and instance parameter of Viewports, and will be read only. This is similar to getting a beam type and asking it what it’s length is - the length is a parameter of the beam instance, not of the beam type.

So - what i think you asking for is that you want to read the View Name of the Viewport, look for some substring within that View Name that denotes by some logic which Vieport Type should be used, then switch the Viewport Type of that Viewport.

“So - what i think you asking for is that you want to read the View Name of the Viewport, look for some substring within that View Name that denotes by some logic which Vieport Type should be used, then switch the Viewport Type of that Viewport.” Yes!

Yes, I want to set the viewport based on the substring of the view name. But how do I access the view name parameter of the viewport? Even if it is read only, I cant get it to give me any results.

What is your naming convention? In order to pull out a substring we need to know how you name your views to devise a method of extracting the proper information.

As far as your view title’s name try this.

1 Like

Also please check out this page of the Primer. It gives a good run down of how to use and manipulate strings.

http://dynamoprimer.com/en/04_The-Building-Blocks-of-Programs/4-4_strings.html

Ok, we are getting close. Here is how I would filter what I want to assign each viewport type to, but its giving me an empty list. what am I miss understanding here? @Ben_Osborne-You were understand what I am trying to do, any suggestions here? thanks!

Your graph is a little messy but i think this is all you need to do.

Well, it worked. I was excited at first, but now I appear to be changing the view title, instead of the view port type. I should be just selecting the viewport type because it contains the viewport title as a type parameter. Yeah, because this way is messing up. How do I select the viewport type based on the view name?

sorry wrong one.

sorry I you want the first type. that is the list of elements you would like to change.

Looks Like you are nearly there. Once you have a list of theSorted Viewport Types that you want to switch the Viewports to, you should get the ElementID of the Viewport types. Then you can use the Python Script in this thread and feed in the Viewports to the first port and the Viewport Type Element IDs to the second port.

Ideally you could just feed the Viewports into a SetParameterBy Name node with the parameter as “Type” and feed in the list of Viewport Types as the Value to Set, but i have found that getting “Type” from that node is not stable (it may work for 95% of a list and then miss the other 5% - run again and you will see that some that worked previously will suddenly be “null” and others that did not work now seem to work - the Python Script does not have these problems)