How to access the Material Type of the physical Asset

How to access the Material Type of the physical Asset

Anonymous
Not applicable
631 Views
1 Reply
Message 1 of 2

How to access the Material Type of the physical Asset

Anonymous
Not applicable

Hello, I am filtering all the materials and I want to sort them by the Type property that belongs to the Physical Asset. Up to now, I have tried the following:

 

ElementId materialId = keyMaterialId;
Element e = m_doc.GetElement(materialId);
Parameter paramMaterial = e.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM);
Material material = m_doc.GetElement(materialId) as Material;

                if (material.StructuralAssetId != 
                    ElementId.InvalidElementId)
                {
                    PropertySetElement property = 
                    m_doc.GetElement(material.StructuralAssetId) as 
                    PropertySetElement;

                    Parameter paramType = 
 property.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_TYPE);
                    if (paramType != null)
                        Debug.WriteLine("material " + 
                         paramType.AsValueString());
                }

The code gets into the first if, so that means that it correctly gets the Physical Asset, but when I try to get the Type (in the variable paramType), paramType is always null, I know this because it never does the Debug.Writeline();

 

Any ideas?

 

Regards,

JMGP

0 Likes
Accepted solutions (1)
632 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk
Accepted solution

Use RevitLookup to explore the hierarchy of the material, its assets and their properties.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder