With Inventor 2014 new API functionality has been introduced that fully supports consistent materials. The primary object in consistent materials is an Asset object, where Asset objects represent materials, physical properties, and colors (which are now referred to as appearances). An asset is essentially a collection of values. You may consider a material as a combination of its physical properties (density, 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 and an appearance asset.
Assets exist within libraries. Inventor API Help contains several code samples that write out all of the information associated with the material, appearance, and physical property assets.
The following VBA sample set desired material from the Autodesk Material Library to the active part.
Private Sub SetMaterialToPart()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim Name As String
Name = "Copper"
' Name = "Steel"
Dim localAsset As Asset
On Error Resume Next
Set localAsset = oDoc.Assets.Item(Name)
If Err Then
On Error GoTo 0
' Failed to get the appearance
' in the document, so import it.
' Get an asset library by name.
' Either the displayed name (which
' can changed based on the current language)
' or the internal name
' (which is always the same) can be used.
Dim assetLib As AssetLibrary
Set assetLib = ThisApplication.AssetLibraries _
.Item("Autodesk Material Library")
' Set assetLib = ThisApplication.AssetLibraries _
' Get an asset in the library
Dim libAsset As Asset
Set libAsset = assetLib.MaterialAssets.Item(Name)
' Copy the asset locally.
Set localAsset = libAsset.CopyTo(oDoc)
On Error GoTo 0
'set material to the part
oDoc.ActiveMaterial = localAsset
' Select the top browser node of the model pane.
' This is a workaround to refresh materials info in the UI.