Materials API

Top  Previous  Next

A part has "assets" which define the material of that part, assets describe the material name, properties appearance etc.


You can use this code to examine the assets in a part document:


   const long ikNumAssets = pPartDoc->Assets->GetCount();

   for (long i = 0; i < ikNumAssets; i++) {

       CComPtr<Asset> pTempAsset = nullptr ;

       CComVariant iVar(i + 1);


       TRACE (L"%d material asset type %d has display name <%s> fixed name <%s> and category name <%s>",





              LPCWSTR(pTempAsset->GetCategoryName())); // e.g. "Copper"



And the output will look something like this:


1 material asset type 99073 has display name <Copper - Satin> fixed name <Metal-022> and category name <Metal>

2 material asset type 99073 has display name <Default> fixed name <InvGen-071> and category name <Miscellaneous>


The asset type will be one of these:











If you look at the code at the start of this page you'll see that there is Name and DisplayName. DisplayName will change with the language version of Inventor, but Name stays the same. Here are three examples:


Name: "Material-071"    DisplayName(Italian): "Ferro, Duttile"         DisplayName(English): "Iron, Ductile"

Name: "Material-087"    DisplayName(Italian): "Acciaio inox AISI 304"  DisplayName(English): "Stainless Steel AISI 304"

Name: "MaterialInv_024" DisplayName(Italian): "Acciaio inossidabile"   DisplayName(English): "Stainless Steel"                


In your program you'll generally have access to one DisplayName in the language of the Inventor you are using, so you should consider using Name. Name will not change from language to language.




I'm still investigating this, but it looks like the material is defined inside an Asset. Try this:


       CComPtr<Asset> pAsset = nullptr ;



       TRACE (L"Active material asset has name <%s>", LPCWSTR(pAsset->DisplayName)); // e.g. "Copper"


       TRACE (L"Active material asset has category name <%s>", LPCWSTR(pAsset->GetCategoryName())); // e.g. "Metal"


You can also get hold of the asset type, which will be one of these:


kAssetTypeAppearance                        99073

kAssetTypeMaterial                        99074

kAssetTypePhysicalProperties        99075

kAssetTypeUnknown                                99076



You can loop over all the asset libraries loaded into inventor like this:


   CComPtr<AssetLibraries> pAssLibs ;

   HRESULT hRes = pInvApp->get_AssetLibraries (&pAssLibs) ;

   if (FAILED(hRes) || (pAssLibs == nullptr)) {

       ShowCOMError (hRes,L"Could not get asset libraries");

       return ;



   long iNumAssLibs ;

   pAssLibs->get_Count(&iNumAssLibs) ;

   WalertBoxA ("There are %d asset libraries",iNumAssLibs) ;


   for (long iLib = 1 ; iLib <= iNumAssLibs ; iLib++) {

       CComPtr<AssetLibrary> pAssLib ;

       pAssLibs->get_Item (CComVariant(iLib),&pAssLib) ;


       CComBSTR bstrDisplayName,bstrFullFileName,bstrInternalName ;

       pAssLib->get_DisplayName (&bstrDisplayName) ;

       pAssLib->get_FullFileName (&bstrFullFileName) ;

       pAssLib->get_InternalName (&bstrInternalName) ;


       TRACE (L"Lib %d has <%s>,  <%s>,  <%s>.\n",iLib,bstrDisplayName,bstrFullFileName,bstrInternalName) ;



And you'll get a result something like this:


Lib 1 has <Autodesk Material Library>,  <C:\Program Files (x86)\Common Files\Autodesk Shared\Materials\2015\PhysicalMaterial.adsklib>,  <AD121259-C03E-4A1D-92D8-59A22B4807AD>.

Lib 2 has <Autodesk Appearance Library>,  <C:\Program Files (x86)\Common Files\Autodesk Shared\Materials\2015\assetlibrary_base.adsklib>,  <314DE259-5443-4621-BFBD-1730C6CC9AE9>.

Lib 3 has <Favorites>,  <C:\Users\Owen\AppData\Roaming\Autodesk\Inventor 2015\FavoriteMaterials.adsklib>,  <D07F930C-485A-4658-AD69-C91D17FEB99B>.

Lib 4 has <Inventor Material Library>,  <C:\Users\Public\Documents\Autodesk\Inventor 2015\Design Data\Materials\InventorMaterialLibrary.adsklib>,  <AFEFC330-5E61-4E24-814F-AE810148B79D>.


The internal name is a GUID it looks like.


Once you have an asset lib you can loop over its contents like this:


       CComPtr<AssetsEnumerator> pAssEnum ;

       pAssLib->get_MaterialAssets (&pAssEnum) ;


       const long ikNumAssets = pAssEnum->Count ;


       for (long iAss = 1 ; iAss <= ikNumAssets ; iAss++) {

           CComPtr<Asset> pAsset ;

           pAssEnum->get_Item (CComVariant(iAss),&pAsset) ;


           CComBSTR bstrDispName,bstrName,bstrCatName ;

           pAsset->get_DisplayName (&bstrDispName) ;

           pAsset->get_Name (&bstrName) ;

           pAsset->get_CategoryName (&bstrCatName) ;

           TRACE (L" DisplayName=<%s> Name=<%s> CatName=<%s>\n",

                  bstrDispName,bstrName,bstrCatName) ;



And the results will look something like this:


DisplayName=<GFRC> Name=<Material-010> CatName=<Concrete>

DisplayName=<Gold> Name=<Material-068> CatName=<Metal>

DisplayName=<Iron, Ductile> Name=<Material-071> CatName=<Metal>

DisplayName=<Lead> Name=<Material-072> CatName=<Metal>

DisplayName=<Silver> Name=<Material-076> CatName=<Metal>

DisplayName=<Steel> Name=<Material-077> CatName=<Metal>

DisplayName=<Steel, Galvanized> Name=<Material-079> CatName=<Metal>


Name does not change from language to language, display name will. Categories are clearly Metal, Concrete, Wood etc.








Material Assets serve to group a physical asset and appearance together. Conceptually a material can be described by its physical properties (density, Poisson’s ratio, yield strength, etc.) and how it looks or its appearance. A material property has some basic information that identifies it, (name, description, type, etc.), and it references a physical properties asset.




Where do materials exist?


The number of asset libraries changes when you have nothing open (1 for examples) to when you have an assembly open (4 for example).


The idea behind Consistent Materials is that all Autodesk programs use the same library of materials.


There are three primary types of assets; materials, physical properties, and appearances





Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)