There's something very odd going on within the Appearances of the file you supplied.
This sort of thing is usually very easy to do, but not for the file you supplied.
So I used a bit of code to write out a detailed list of all the documents 'Assets' (The Assets are either Material, Appearance, or Physical Properties type Assets, used to store the settings of each variation.) What it revealed is very puzzling. It can't find an appearance type asset named "White".
None of the Assets are named "ral 7016".
And two of the Assets are named "1:Black" (both of their DisplayNames are "ral 7016").
Here's the code I used to investigate:
Dim oFileName As String = SpecialDirectories.Desktop & "\" & "Appearance Assets Info.txt"
Dim oWrite As System.IO.StreamWriter = System.IO.File.CreateText(oFileName)
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
oWrite.WriteLine("List of Appearance type Assets within this document:")
For Each oAsset As Asset In oDoc.Assets
' If oAsset.AssetType = AssetTypeEnum.kAssetTypeAppearance
oWrite.WriteLine("")
oWrite.WriteLine("oAsset.Name = " & oAsset.Name)
oWrite.WriteLine("oAsset.DisplayName = " & oAsset.DisplayName)
oWrite.WriteLine("oAsset.AssetType.ToString = " & oAsset.AssetType.ToString)
oWrite.WriteLine("oAsset.CategoryName = " & oAsset.CategoryName)
oWrite.WriteLine("oAsset.HasTexture = " & oAsset.HasTexture)
oWrite.WriteLine("oAsset.IsReadOnly = " & oAsset.IsReadOnly)
oWrite.WriteLine("oAsset.IsUsed = " & oAsset.IsUsed)
oWrite.WriteLine("oAsset.Count (Asset Values Count) = " & oAsset.Count)
oWrite.WriteLine("Detailed List of its Asset Values:")
If oAsset.Count > 0 Then
For i As Integer = 1 To oAsset.Count
oWrite.WriteLine(vbTab & "oAsset.Item(" & i & ").Name = " & oAsset.Item(i).Name)
oWrite.WriteLine(vbTab & "oAsset.Item(" & i & ").DisplayName = " & oAsset.Item(i).DisplayName)
oWrite.WriteLine(vbTab & "oAsset.Item(" & i & ").IsReadOnly = " & oAsset.Item(i).IsReadOnly)
oWrite.WriteLine(vbTab & "oAsset.Item(" & i & ").ValueType.ToString = " & oAsset.Item(i).ValueType.ToString)
oWrite.WriteLine("")
Next
End If
Next
oWrite.Close()
ThisDoc.Launch(SpecialDirectories.Desktop & "\" & "Appearance Assets Info.txt")
The resulting TXT file is attached.
Within the Appearance Browser, things look just fine, but when trying to assign an Asset as the value of oBody.Appearance, with the name "White", it won't work. So I tried looping through the Assets, and if the DisplayName.Contained("White"), I tried to assign that Asset to the value, but that would't work either.
The DisplayName route works for the "ral 7016" one though. Very odd.
Here's the code I was trying to use to ask you which Appearance you wanted to assign to each solid body, then assign it.
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Part Documents.",vbOKOnly + vbExclamation , "WRONG DOCUMENT TYPE")
Return
End If
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
'Set the list of Options to choose from
Dim oChoices As List(Of String) = New List(Of String)
oChoices.Add("ral 7016")
oChoices.Add("White")
'Loop through the solid bodies and ask which option to use for each
For Each oBody As SurfaceBody In oPDef.SurfaceBodies
Dim oChoice As String = InputListBox("Choose a color for " & oBody.Name, oChoices, oChoices(1), "CHANGE COLOR", "COLORS")
For Each oAsset As Asset In oPDoc.Assets
If oAsset.DisplayName.Contains(oChoice) Then
oBody.Appearance = oAsset
End If
Next
Next
But, it's still not working right, for some reason.
Wesley Crihfield

(Not an Autodesk Employee)