Hi all,
When creating generic appearance from sample code:
Public Sub CreateSimpleColorAppearance()
Dim doc As Document
Set doc = ThisApplication.ActiveDocument
' Only document appearances can be edited, so that's what's created.
' This assumes a part or assembly document is active.
Dim docAssets As Assets
Set docAssets = doc.Assets
' Create a new appearance asset.
Dim appearance As Asset
Set appearance = docAssets.Add(kAssetTypeAppearance, "Generic", _
"MyShinyRed", "My Shiny Red Color")
Dim tobjs As TransientObjects
Set tobjs = ThisApplication.TransientObjects
Dim color As ColorAssetValue
Set color = appearance.Item("generic_diffuse")
color.value = tobjs.CreateColor(255, 15, 15)
Dim floatValue As FloatAssetValue
Set floatValue = appearance.Item("generic_reflectivity_at_0deg")
floatValue.value = 0.5
Set floatValue = appearance.Item("generic_reflectivity_at_90deg")
floatValue.value = 0.5
End Sub
The appearance preview pic in Appearance Browser seems to be ok.
If I make e.g. Plastic Material based on code as followes:
Public Sub CreateSimpleColorAppearance_plastic()
Dim doc As Document
Set doc = ThisApplication.ActiveDocument
' Only document appearances can be edited, so that's what's created.
' This assumes a part or assembly document is active.
Dim docAssets As Assets
Set docAssets = doc.Assets
' Create a new appearance asset.
Dim appearance As Asset
Set appearance = docAssets.Add(kAssetTypeAppearance, "Plastic", _
"MyShinyRed_Plastic", "My Shiny Red Color_Plastic")
Dim tobjs As TransientObjects
Set tobjs = ThisApplication.TransientObjects
Dim color As ColorAssetValue
Set color = appearance.Item("plasticvinyl_color")
color.value = tobjs.CreateColor(255, 15, 15)
End Sub
Now the preview pic is about the white, but if start the editor for the appearance preview pic will update ok. Strange.
It seems that other appearance types do not update the preview pic correctly.
Does anyone managed to have correctly created preview pics when creating appearances through API?
/matti
Appearance Browser Pic:

Appearance Editor Pic
