How to get the main Materials list like in the Material Browser?

How to get the main Materials list like in the Material Browser?

Anonymous
Not applicable
1,262 Views
2 Replies
Message 1 of 3

How to get the main Materials list like in the Material Browser?

Anonymous
Not applicable

Hi all, I am new to Revit and actually I am helping a friend developing an add-in in C#. We want to get the list of the main materials list like the one in the Materials Browser window, and then sort or filter the elements by this list. The list we want is he one in the photo below:

 

revit-category.jpg

 

 

 

0 Likes
1,263 Views
2 Replies
Replies (2)
Message 2 of 3

aignatovich
Advisor
Advisor

Hi!

 

You may retrieve this values from BuiltInParameter.PHY_MATERIAL_PARAM_TYPE parameter, then get distinct list or group materials by parameter value as you want.

 

This is python shell sample:

 

col = FilteredElementCollector(doc)

materials = col.OfClass(Material)

for m in materials:
	print m.Name, m.get_Parameter(BuiltInParameter.PHY_MATERIAL_PARAM_TYPE).AsValueString()
0 Likes
Message 3 of 3

Anonymous
Not applicable

Thank you @aignatovich for your reply,

 

I have been trying to work with your suggestion unfortunately I couldn't figure out to do it in C#. if you know a way to code it in C# I would be very happy.

 

Best regards @aignatovich

0 Likes