Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
chandra.shekar.g
in reply to: Anonymous

@Anonymous,

 

Try below iLogic code to change appearance of named face (In this code, "Top" is considered as named face).

Sub Main()
	Dim oDoc As PartDocument
	oDoc = ThisApplication.ActiveDocument
	
	Dim oAsset As Asset 
	oAsset = ThisApplication.AssetLibraries.Item(2).AppearanceAssets.Item("Cardboard")
	
	Dim oDocAsset As Asset 
	Try 
		oDocAsset = oDoc.AppearanceAssets.Item("Cardboard")
	Catch
		oAsset.CopyTo(oDoc)
		oDocAsset = oDoc.AppearanceAssets.Item("Cardboard")
	End Try

	Dim oCompDef As ComponentDefinition
	oCompDef = oDoc.ComponentDefinition

	Dim oFaces As Faces
	oFaces = oCompDef.SurfaceBodies(1).Faces

	Dim AttSets As AttributeSets
	Dim AttSet As AttributeSet
	
	Dim oFace As Face 

	For Each oface In oFaces
		 AttSets = oface.AttributeSets
		 If AttSets.NameIsUsed("iLogicEntityNameSet") Then
		  	AttSet = AttSets.Item("iLogicEntityNameSet")
			  For Each Att In AttSet
			    If Att.value = "Top" Then
					oFace.Appearance = oDocAsset
				End If 
			  Next
		 End If
	Next
End Sub
 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network