Set Scale of View Template

I’m running into issues using Dynamo to set the scale of a list of view templates. I’ve tried Element.SetParameterByName and Elements.SetParameterByNameTypeOrInstance from rhythm, and I’m getting a message that the parameter is read-only. Can the scale of view templates be edited through Dynamo?

I tested with “get parameter value” to make sure I had the right inputs for elements & parameterName, and that seems to work. I’m getting a warning & nulls during the Set Parameter part of the process.

Here the overview of my graph. Thanks in advance for your input!

In newer versions of Dynamo there appears to be a View.SetScale node. I believe this cannot be set via parameter.
image


If you are in a version of Dynamo without that node, then this python script should do it.

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import View

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#Preparing input from dynamo to revit
views = UnwrapElement(IN[0])
scale = IN[1]

TransactionManager.Instance.EnsureInTransaction(doc)
for view in views:
	view.Scale = scale
TransactionManager.Instance.TransactionTaskDone()

OUT = views

image

1 Like

View.SetScale worked like a charm. Thank you so much!