Get 3D view template

anyone have solution? doesn’t work for both Dynamo node and Python node

@Ning_Zhou

try this, just getting the Name property. Remove it when accessing the template view itself.

OUT = [v.Name for v in FilteredElementCollector(doc).OfClass(View).WhereElementIsNotElementType() if v.IsTemplate]

1 Like

thanks jshial, works great if only get name but 3D view template itself is still NULL, well, maybe i can get 3D view template via name?!

so my question now is can i get 3D view template via name?

Related, https://github.com/DynamoDS/DynamoRevit/issues/1636

Cc @solamour

1 Like

thanks John for the insight, does it mean Revit API having same issue?

It’s a dynamo problem.

ok, does it mean Python Node in Dynamo environment can solve this problem if i understand correctly because Python coding is exactly the same as API?

@Ning_Zhou
You probably need to wrap downstream logic in the Python node as well.

what you are trying accomplish in the end? Mapping templates to views?

The id or Name of a template view could help you achieve it already. Apply template to any view will just require the Id of the template.

image

2 Likes

thanks jshial, i just want to get 3D view templates and delete or modify in Dynamo environment.
any hint how to wrap downstream logic in the Python node will be greatly appreciated.

@Ning_Zhou Deleting it should be pretty straightfoward, you just call Document.Delete(Id);
https://www.revitapidocs.com/2020/a0461dd1-71d9-4581-1604-2ef8c211dd60.htm

I haven’t tried to modify a view template programmatically but I guess it’s pretty much just like modifying a regular view, such as customizing visibility. the only difference is the template having a IsTemplate == True. There should be some good references in the forum.

well, i only want to get 3d view template, that’s it, the issue is you cannot get it, it’s null!

Use the Collect.View3DTemplates node of Springs package to solve this Dynamo issue.
Collect.View3DTemplates

6 Likes

Oh man. I didn’t even know about this node.

1 Like

thanks Alban, i cannot find that node except image

edit: found that node after i reinstalled latest version of spring nodes

Is there a way to get the 3D view template from the view?

Here you go
https://dynamopackages.com/#

More discussion on the subject of getting 3D View Templates at Some View Templates not being found in Python/Dynamo - #10 by truevis