Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
davidt162003
152 Views, 2 Replies

How can i set the apperance of a part-Vb.net

im Trying to set the appearance of a surface body from the content center to the default but i cant seem to find the asset. 

    Friend Sub ChangeBodyApperance(Body As SurfaceBody, PartDoc As PartDocument)
        Dim AssetLst = PartDoc.Assets
        Dim CurrentAsset = Body.Appearance
        ' MsgBox(CurrentAsset.Name)
        Dim DefaultAsset As Asset
        Try
            DefaultAsset = AssetLst("Default")
        Catch ex As Exception
            Dim _App As Inventor.Application = Body.Application
            Dim AssetLib = _App.AssetLibraries("Autodesk Appearance Library")
            Dim LibDefault = AssetLib.AppearanceAssets("Default")
            DefaultAsset = LibDefault.CopyTo(PartDoc, True) 'throws a error here 
        End Try


        If CurrentAsset.Name <> DefaultAsset.Name Then
            Body.Appearance = DefaultAsset
        End If
    End Sub

 

HII