How to Set the starting view in current project file with python?
Have you taken a look at this?
1 Like
I do not know what to do with this
That’s the class for the starting view settings. If you look at its members you’ll see it has a property for setting the view.
2 Likes
# Boilerplate text
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
targetView = UnwrapElement(IN[0])
targetId = targetView.Id
# Current doc/app/ui
doc = DocumentManager.Instance.CurrentDBDocument
svs = StartingViewSettings.GetStartingViewSettings(doc)
# Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
if svs.IsAcceptableStartingView(targetId):
try:
svs.ViewId = targetView.Id
OUT = "Start view updated."
except:
OUT = "Start view unable to be updated."
else:
OUT = "View is not an accceptable start view."
TransactionManager.Instance.TransactionTaskDone()
4 Likes
@ruben.romero too many options for that:
1 Like
Noting 3 out of 4 of those are zero touch, only one in Python. I’d hazard a guess clockworks node is similar to the above.
would be fantastic to have it in your @GavinCrump package, easy and useful as always, thanks
1 Like