Changing view type + adding view template

Right. The element classes is only available in 2023 though correct? this is working in 2021 at the moment, but once I upgrade the scrip to 23 I should be able to change that correct?

Many methods to access a ViewFamilyType element in older versions too.

Element Types was renamed to Element Classes. So you have access to the same methods in all years they just have different names.

Ok i came back to this using element.class and am running in to the same issue where its duplicating the view and changing the template but not moving it to the right spot.

You need to show us what you’re doing. That image doesn’t contain any duplicating or assigning templates. Have you confirmed that the parameter driving sorting/grouping in your project browser is controlled by the view template? If you’re sorting by ViewType, then a template isn’t going to change that.

My bad! here is a image of the full script

Make sure when you post images that you use Export Workspace (camera icon in the top right of the window) so that everything is visible and that you have node preview bubbles or watch nodes for everything.

Also, have you confirmed that view templates will control the view sorting?

sorry! i attached a better picture of the script as well as showing that its view templates will control the view sorting. it also looks like the name script is broken too.



Capture

So a ViewType can apply a template on creation but that’s not the same as the template applying the ViewType. If you do this manually in Revit you’ll see that changing the template doesn’t change the type. You need to change the type of an existing view separately from the template.

Also, again, make sure your image is legible before posting. You need to be zoomed in enough that the node titles are visible otherwise we can’t tell what’s going on.