Using python, how can I get the calculated values from a Room schedule? Are they accessible like a parameter (of Rooms in this case)? From what I’ve read, it looks like I retrieve it from the schedule view, but I’m unsure how. I guess I could also just recalculate it in Python script, but I’m having trouble with that too. Here’s what I have so far. I’m trying to get a Calculated value called OCCLOAD in a room schedule.
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
# Import Revit Nodes
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
# Import DocumentManager and TransactionManager
clr.AddReference ("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
coll1 = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms).ToElements()
roomname = []
roomlevel = []
arearequired = []
area = []
department = []
ismeetrm = []
occupancy = []
olf = []
occload = []
TransactionManager.Instance.EnsureInTransaction(doc)
for i in coll1:
options = SpatialElementBoundaryOptions()
if all((
i.Area != 0.00,
i.Location is not None,
len(i.GetBoundarySegments(options)) != 0,
(i.DesignOption is None or i.DesignOption.IsPrimary)
)):
roomname.append(i.LookupParameter("Name").AsString())
department.append(i.LookupParameter("Department").AsString())
area.append(i.LookupParameter("Area").AsValueString())
roomlevel.append(i.LookupParameter("Level").AsValueString())
occupancy.append(i.LookupParameter("Occupancy").AsString())
arearequired.append(i.LookupParameter("PLANNED SQ FT").AsValueString())
ismeetrm.append(i.LookupParameter("MEETING SPACE").AsInteger())
olf.append(i.LookupParameter("CC_OccLoadFactor_PWProj").AsInteger())
occload.append(i.LookupParameter("OCCLOAD").AsDouble())
#if olf[0] != 0:
#occload.append((i.LookupParameter("Area").AsInteger())/(i.LookupParameter("CC_OccLoadFactor_PWProj").AsDouble()))
# Assign your output to the OUT variable.
OUT = roomname, department, area, roomlevel, occupancy, olf, arearequired, ismeetrm, olf, occload