Hi @claudio.ibarra. Yes. This is possible. Although setting the 'appearance' of a face is a bit more complicated than setting the appearance of the whole part, or a feature, because there is not a shortcut iLogic snippet for that task. Here is some iLogic code you can try for that situation though. If those two appearances are saved locally to the document, and this is a true template scenario, then you can probably get rid of the parts of this code that are trying to find them within the active appearances library, and get rid of the Try...Catch blocks, to shorten the code a bit. I was trying to make it fairly fool proof with error catching stuff.
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kPartDocumentObject Then
MsgBox("A Part Document must be active for this rule to work. Exiting.", vbCritical, "")
Exit Sub
End If
Dim oPDoc As PartDocument = ThisDoc.Document
oPDef = oPDoc.ComponentDefinition
'try to find/get the named face
Dim oNEs As NamedEntities = iLogicVb.Automation.GetNamedEntities(oPDoc)
Dim oOutsideFace As Face = oNEs.TryGetEntity("OUTSIDE_SURFACE")
If IsNothing(oOutsideFace) Then
MsgBox("Could not find a face named 'OUTSIDE_SURFACE'.", vbCritical, "")
Return
End If
'try to get the 'Appearance Assets named 'Blue' & 'Plate'
Dim oDocAppAssets As AssetsEnumerator = oPDoc.AppearanceAssets
Dim oLibAppAssets As AssetsEnumerator
oLibAppAssets = ThisApplication.ActiveAppearanceLibrary.AppearanceAssets
Dim oBlue, oPlate As Asset
Try
oBlue = oDocAppAssets.Item("Blue")
Catch
oBlue = oLibAppAssets.Item("Blue")
Catch
MsgBox("Could not find Appearance Asset named 'Blue'.", vbCritical, "")
Return
End Try
Try
oPlate = oDocAppAssets.Item("Plate")
Catch
oPlate = oLibAppAssets.Item("Plate")
Catch
MsgBox("Could not find Appearance Asset named 'Plate'.", vbCritical, "")
Return
End Try
'now the code similar to your original
If PAINTED_BLUE Then
oOutsideFace.Appearance = oBlue
Else
oOutsideFace.Appearance = oPlate
End If
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS :bulb: or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)