Revit secondary development-obtain texture maps of materials and Secondary Development of revit
The Onmaterial () method in the IExportContext export class can be used to obtain the material information, mainly the material ID. Then, the material object material is obtained based on the material ID, and the Asset object is obtained through the following code:
ElementId appearanceId = material. AppearanceAssetId;
AppearanceAssetElement appearanceElem = document. GetElement (appearanceId) as AppearanceAssetElement;
Asset theAsset = appearanceElem. GetRenderingAsset ();
This Asset object contains all the rendering-related data, including texture maps. Determine the attribute "unifiedbitmap_Bitmap", that is, the desired texture map. to read the specific Asset attribute, you can search for Asset in the Revit API documentation. An example is provided.
Note: The texture map Path obtained here is relative to the system texture library path. Currently, you do not know how to obtain the system texture library path through the API provided by Revit: "C: \ Program Files (x86) \ Common Files \ Autodesk Shared \ Materials \ Textures ". If you have any idea, thank you!
For more information, see the source document. Http://www.cnblogs.com/onlyperfect/p/4235426.html