It’s not a list so you can’t access it like one. First thing that comes back is Enumerable which means you can call a “for” loop on it:
for i in doc.ProjectLocations
or more pythonic:
[x for x in doc.ProjectLocations]
Now, what you will get back is a list of ProjectLocation objects. If you need their offsets like EastWest or NorthSouth you need to actually query their SiteLocation
and since that is an indexer, it will need a point value as input called like this:
position = location.GetProjectPosition[XYZ(0,0,0)]`
Then you have an object that you can call for Angle, NorthSouth etc. Here’s a full code:
# Import RevitAPI
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
def GetValues(loc):
pos = loc.ProjectPosition[XYZ(0,0,0)]
angle = pos.Angle
ew = pos.EastWest
e = pos.Elevation
ns = pos.NorthSouth
return [angle, ew, ns, e]
locations = doc.ProjectLocations
#Assign your output to the OUT variable.
OUT = [GetValues(x) for x in locations]