Trying to access some Document ElementSet properties (Start View)


#1

I’m trying to use GetStartingViewSettings so I can find out the ViewID and details of the currently selected Starting View (if there is one). I can use Element Type node to actually select the ‘element’ in Revit, but it is relatively useless because I need to address some Members of that object. See attached image.

Is there an easy way to unwrap a given element and directly get data for its members in a Python node?

starting-view


#2

Try the following script in a Python node with no inputs:

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

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
OUT = doc.GetElement(StartingViewSettings.GetStartingViewSettings(doc).ViewId)


I’ve just added this to package Clockwork as Document.StartingView …

#3

well done Andreas. seems API doesn’t provide method to set the Starting view…


#4

Works perfectly, thanks!


#5

Hahahah, you beat me to it again. This time difference advantage that you have is almost unfair. :slight_smile: Great job!


#6

Julien, it’s a get/set property. So you could use it to set the starting view as well, like so:

StartingViewSettings.GetStartingViewSettings(doc).ViewId = myNewStartingViewId

(where, obviously, myNewStartingViewId is the ID of the view that you want to set as a starting view…)