Get Material Types

Get Material Types

Anonymous
Not applicable
1,289 Views
3 Replies
Message 1 of 4

Get Material Types

Anonymous
Not applicable

Hi folks,

 

I would like to be able to get the materials in the project and get their Material Class.2018-10-12_16-08-34.png

 

The code I've written is as follows.

 

FilteredElementCollector materials = new FilteredElementCollector(Global.doc()).OfClass(typeof(Material));

List<Element> materialList = materials.ToList();

 

But when I try to get i.e materialList[11].MaterialClass I am not able to retrieve its class. Eventhough I know its there.

There must be a specific way of casting the value.

 

2018-10-12_16-17-26.png

 

 

I've tried casting like (Autodesk.Revit.DB.Material)materialList[11] but it didn't helped either.

 

Can anybody please help me to retrive MaterialClass please. Any advice is much appreciated.

 

0 Likes
Accepted solutions (1)
1,290 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

Have you installed RevitLookup?

 

https://github.com/jeremytammik/RevitLookup

 

You can use that to interactively explore the Revit database, its elements, their properties, and their mutual relationships.

 

That should enable you to resolve your issue yourself.

 

Cheers,

 

Jeremy

 



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

Message 3 of 4

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Anonymous,

Have you tried the below code??

Material mat;
string material_class=mat.MaterialClass.ToString();

 

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 4 of 4

Anonymous
Not applicable

Thank you this is very helpful.

0 Likes