Alien
February 16, 2024, 5:04pm
1
In my project information I have a zone:
I’m trying to extract it using Python:
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
projinfo = doc.ProjectInformation
elementlist = []
elementlist.append(projinfo.OrganizationName)
elementlist.append(projinfo.OrganizationDescription)
elementlist.append(projinfo.BuildingName)
elementlist.append(projinfo.Zone/System)
OUT = elementlist
But I get the error “Project Information object has no attribute, Zone”
Am I correct in my assumption that it’s the / that’s messing it all up?
Should I glare at the BIM manager?
Alien
February 16, 2024, 5:09pm
2
So I’ve extracted the zone like this instead.
But question still remains… Is it the slash (/) that’s causing the issue or is it something else?
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import StorageType
doc = DocumentManager.Instance.CurrentDBDocument
projinfo = doc.ProjectInformation
zoneSystemParam = projinfo.LookupParameter("Zone/System")
if zoneSystemParam.StorageType == StorageType.String:
OUT = zoneSystemParam.AsString()
Attributes are not the same as parameters. Some builtin “parameters” are actually attributes or properties of the object. Any custom parameter you add is just a parameter and has to be treated as such. You need to get the parameter from the Project Information parameters.
projinfo.LookupParameter("Zone/System")
EDIT: Looks like you figured out how to solve it, but the explanation above hopefully details why.
2 Likes
Alien
February 16, 2024, 5:12pm
4
Ahhh! Yes, makes sense. Thank you