Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
Hi all,
I have one appearance I am happy with, but now I want it in a lot of different colorshades (only RGB value should change). Is there a quick solution to create all these at once? I have an excel file with the new appearance names and their RGB values. I hope to find to way to prevent my to typing all these values manually to inventor.
It doesn't matter if its via excel, xml or a table in inventor. If someone has some code to duplicate an appearance or material in ilogic, I will be able to make to work.
Hope someone can help
Solved! Go to Solution.
Solved by Gabriel_Watson. Go to Solution.
Try this suggested solution from the Inventor VBA/iLogic/etc. forum:
https://forums.autodesk.com/t5/inventor-programming-ilogic/batch-create-appearences-maybe-with-macro...
Sub main()
Dim name(200) As String
Dim red(200) As Integer
Dim green(200) As Integer
Dim blue(200) As Integer
Dim i As Integer
For i = 1 To 200
Call CreateAppearance(name(i), green(i), red(i), blue(i))
Next i
End Sub
Sub CreateAppearance(ByVal name As String, ByVal red As Integer, ByVal green As Integer, ByVal blue As Integer)
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oTG As TransientObjects
Set oTG = ThisApplication.TransientObjects
Dim docAsset As Assets
Set docAsset = oDoc.Assets
Dim appearance As Asset
Set appearance = docAsset.Add(AssetTypeEnum.kAssetTypeAppearance, "Generic", name & "Appearances", name)
Dim generic_color As ColorAssetValue
Set generic_color = appearance.Item("generic_diffuse")
generic_color.Value = oTG.CreateColor(red, green, blue)
generic_color.HasConnectedTexture = True
Dim generic_texture As AssetTexture
Set generic_texture = generic_color.ConnectedTexture
Dim generic_image_fade As FloatAssetValue
Set generic_image_fade = appearance.Item("generic_diffuse_image_fade")
generic_image_fade.Value = 0.75
Dim generic_glossiness As FloatAssetValue
Set generic_glossiness = appearance.Item("generic_glossiness")
generic_glossiness.Value = 0.3
Dim generic_highlights As BooleanAssetValue
Set generic_highlights = appearance.Item("generic_is_metal")
generic_highlights.Value = False
End Sub
CAD and PLM admin | My ideas | Inventor-Vault Expert GPT (my AI brain)
Thank you for that link, I tried to search but did not find this one myself.
It works, so I am very happy!
Do you also happen to know if there is a list how to address all the different aspects of an appearance? (for example reflectivity or description)
CAD and PLM admin | My ideas | Inventor-Vault Expert GPT (my AI brain)
Can't find what you're looking for? Ask the community or share your knowledge.