To Create Material Library for Material, Finish (Color) & Appearance

To Create Material Library for Material, Finish (Color) & Appearance

RoyWickrama_RWEI
Advisor Advisor
1,489 Views
4 Replies
Message 1 of 5

To Create Material Library for Material, Finish (Color) & Appearance

RoyWickrama_RWEI
Advisor
Advisor

I am creating a comprehensive material library for material, finish (color and paint spec) and texture (expanded metal, perforated sheet, gratings etc.).

I tried with so many leads through the whole day. But could not get through a workable solution.

I shall be most grateful if someone help me.

Libraries to do with are:

Material libraries

  • Inventor Material Library
  • Autodesk Material Library
  • InventorMaterialLibrary_RWEI

Appearance Libraries

  1. InventorMaterialLibrary_RWEI
  2. RWEI Appearance Library
  3. RWEI Texture Library
  4. RWEI Appearance Library RAL
Sub Main()
	Dim oDoc = ThisDoc.Document
	Dim assetLib As AssetLibrary


	Dim oList_Assets As New ArrayList	
	For Each oAssetLibrary In ThisApplication.AssetLibraries
	oList_Assets.Add(oAssetLibrary.DisplayName)
	Next oAssetLibrary
	

	oAssetLibrary_Selected = InputListBox("SELECT REQ'D LIB. FROM ABOVE!", oList_Assets, oList_Assets.Item(0), "CHANGE MATERIAL ASSET LIB.", "LIST OF ASSET LIBRARIES")

	oIndex = oList_Assets.indexof(oAssetLibrary_Selected)


'	Dim oAppearanceAssets As AssetsEnumerator
'	oAppearanceAssets = oPartDoc.AppearanceAssets
	oAssetlib = ThisApplication.AssetLibraries.oList_Assets(oIndex)
'	ThisApplication.ActiveAppearanceLibrary = oAssetLibrary_Selected.indexof(oAssetLibrary_Selected)
	 


End Sub

 

 

2019-03-31 19_57_04.png

 

2019-03-31 19_48_50.png

 

2019-03-31 20_04_57.png

 

2019-03-31 14_55_41.png

2019-03-31 15_11_01.png

 

Autodesk Inventor Professional 2019

Vault Professional 2019

 

0 Likes
Accepted solutions (1)
1,490 Views
4 Replies
Replies (4)
Message 2 of 5

chandra.shekar.g
Autodesk Support
Autodesk Support

@RoyWickrama_RWEI 

 

Even through UI, appearance of assembly can not be changed. Other way is change to all occurrences in assembly to required appearance.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 3 of 5

RoyWickrama_RWEI
Advisor
Advisor

Thanks Chandra Shekar G,

I today thought to let you know about my latest posting requesting help to build material library. It is fine that you are already aware of this posting. (I saw a few of your postings in this area). Could you help me on the followings:

Step-1:

to choose the material library from the drop-down list of available libraries

Step-2:

to select the material from the drop-down list of materials available from within the selected library of materials in Step-1

Step-3:

to choose the appearance library from the drop-down list of available appearance libraries

Step-4:

to select the appearance from the drop-down list of appearances available from within the selected library of appearances in Step-3

0 Likes
Message 4 of 5

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@RoyWickrama_RWEI,

 

Try below iLogic code to get material library, selected material from material library, appearance library and selected appearance from appearance library.

 

Before running this iLogic code, read the difference between material library and appearance library from below link.

 

https://forums.autodesk.com/t5/inventor-customization/vba-detect-matrial-or-appearance-library/td-p/...

'Step 1

Dim oLibrary As AssetLibrary 
Dim oMaterialLibrary As String 
Dim oMaterialList As New ArrayList
For Each oLibrary In ThisApplication.AssetLibraries 
	If oLibrary.MaterialAssets.Count > 0 Then
		oMaterialList.Add(oLibrary.DisplayName)
	End If
Next

oMaterialLibrary = InputListBox("Select materilal library", oMaterialList, oMaterialList.Item(0), Title := "Material library", ListName := "Material library List")

'Step 2

Dim oSelected_Material_Library As AssetLibrary  
oSelected_Material_Library = ThisApplication.AssetLibraries.Item(oMaterialLibrary)

Dim oMaterialAsset As MaterialAsset 
Dim oMaterialAssetList As New ArrayList
Dim oSelected_Material As String 
For Each oMaterialAsset In oSelected_Material_Library.MaterialAssets 
	oMaterialAssetList.Add(oMaterialAsset.DisplayName)
Next

oSelected_Material = InputListBox("Select material from list", oMaterialAssetList, oMaterialAssetList.Item(0), Title := "Material", ListName := "Material List")

MessageBox.Show(oSelected_Material, "Material")

'Step 3
 
Dim oAppearanceLibrary As String 
Dim oAppearanceList As New ArrayList
For Each oLibrary In ThisApplication.AssetLibraries 
	If oLibrary.MaterialAssets.Count = 0 Then
		oAppearanceList.Add(oLibrary.DisplayName)
	End If
Next

oAppearanceLibrary = InputListBox("Select appearance library", oAppearanceList, oAppearanceList.Item(0), Title := "Appearance library", ListName := "Appearance library List")

'Step 4

Dim oSelected_Appearence_Library As AssetLibrary  
oSelected_Appearence_Library = ThisApplication.AssetLibraries.Item(oAppearanceLibrary)

Dim oAppearanceAsset As Asset 
Dim oAppearanceAssetList As New ArrayList
Dim oSelected_Appearance As String 
For Each oAppearanceAsset In oSelected_Appearence_Library.AppearanceAssets  
	oAppearanceAssetList.Add(oAppearanceAsset.DisplayName)
Next

oSelected_Appearance = InputListBox("Select appearance from list", oAppearanceAssetList, oAppearanceAssetList.Item(0), Title := "Appearance", ListName := "Appearance List")

MessageBox.Show(oSelected_Appearance, "Appearance")

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 5 of 5

RoyWickrama_RWEI
Advisor
Advisor

It is doing well. I am tailoring to retrieve my needs. Therefore, I would like to revert back to you for some more help (may be).

 

0 Likes