I’m trying to retrieve a value of thermal properties of wall of a revit model. After collecting wall element by FilteredElementCollector, I’m using ThermalProperties class and a property of that ( which in my case is named ‘HeatTransferCoefficient’). My problem is I could not find how to use the thermal properties class, my code is collecting walls but when it comes to thermal properties, I get error.
My code is here:
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory,APIObject,ThermalProperties
You need to get WallTypes rather than just Wall instances when getting ThermalProperties. It works like this:
walls = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsElementType()
for w in walls:
# getting Thermal Properties of WallTypes
tp = w.ThermalProperties
# getting ThermalResistance (or other parameter) from Thermal Properites
# not every WallType has ThermalResistance set
if tp:
print tp.ThermalResistance
Thanks heaps David,
It solved my problem.
On another note, I’m trying to retrieve thickness of roof and floor. For walls there is a Width property in WallType class which does the job. But for roof and floor I’m using the code below and not getting an error, but there is no output in the output window.
import Autodesk.Revit.DB as DB
import clr
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory, Transaction, TransactionGroup,APIObject,ThermalProperties
Make sure to call .ToElements() when wanting to collect elements from DB.FilteredElementCollector as it does not begin running the query until the last step
import clr
import Autodesk.Revit.DB as DB
doc = revit.ActiveUIDocument.Document
Roofs = DB.FilteredElementCollector(doc).OfCategory(DB.BuiltInCategory.OST_Roofs).WhereElementIsElementType().ToElements()
for r in Roofs:
# getting Thickness of Roof
t = r.LookupParameter('Thickness')
if t:
x = t.AsDouble()
print (x)
@Mehdi1994 Roof Type does not have a Thickness property. Roof instances do. So you need to collect the instances. The collector you have filters for Types currently. Change ElementIsElementType to ElementIsNotElementType
import clr
import Autodesk.Revit.DB as DB
doc = __revit__.ActiveUIDocument.Document
Roofs = DB.FilteredElementCollector(doc).OfCategory(DB.BuiltInCategory.OST_Roofs).WhereElementIsNotElementType().ToElements()
for r in Roofs:
# getting Thickness of Roof
t = r.LookupParameter('Thickness')
if t:
x = t.AsDouble()
print (x)