Modify the Material ThermalConductivity Parameter

I am passing in a WallType and then using the following:

walltype = UnwrapElement(IN[0])
wallCS = walltype.GetCompoundStructure()
layers = wallCS.GetLayers()

for layer in layers:
MaterialID = layer.MaterialId
Material = doc.GetElement(MaterialID)
ThermalAssetID = Material.ThermalAssetId
PropertySetElement = doc.GetElement(ThermalAssetID)
thermalass = PropertySetElement.GetThermalAsset

I would like to then get the ThermalConductivity of the thermalass, however I dont get access to this.

Has anyone had any success driving the Thermal Conductivity of a material within Python/Dynamo?

Thanks,

Drew

Hello djarvis!

Maybe this will work for you: ( be careful not to start variable names with capital letters )

import clr

# Import RevitAPI
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

walltype = UnwrapElement(IN[0])
wallCS = walltype.GetCompoundStructure()
layers = wallCS.GetLayers()

thermalcondList = []

for layer in layers:
	materialID = layer.MaterialId
	material = doc.GetElement(materialID)
	thermalAssetID = material.ThermalAssetId
	propertySetElement = doc.GetElement(thermalAssetID)
	thermalass = propertySetElement.GetThermalAsset()
	thermalcond = thermalass.ThermalConductivity
	thermalcondList.append(thermalcond)

OUT = [thermalcondList]

PS: You can format your code with this button: