Set Material Physical/Thermal parameters

Hello,

I want to create new materials with physical and thermal properties. I’m using this code from autodesk knowledge as base:


//Create the material
ElementId materialId = Material.Create(document, “My Material”);
Material material = document.GetElement(materialId) as Material;

//Create a new property set that can be used by this material
StructuralAsset strucAsset = new StructuralAsset(“My Property Set”, StructuralAssetClass.Concrete);
strucAsset.Behavior = StructuralBehavior.Isotropic;
strucAsset.Density = 232.0;

//Assign the property set to the material.
PropertySetElement pse = PropertySetElement.Create(document, strucAsset);
material.SetMaterialAspectByPropertySet(MaterialAspect.Structural, pse.Id);


I’ve tried to replicate that code in Python but I get an error in line 27. Any idea about how I can fix it?

Thanks!


I’ve found the error, it was pretty obvious… at line 23, “My Property Set” wasn’t a valid asset name.

1 Like