Change apply appearance option in material using SOLIDWORKS API

Edit ArticleEdit Article

Apply Appearance option in Edit material dialog
Apply Appearance option in Edit material dialog

This example demonstrates how to change the Apply Appearance option in the material options using SOLIDWORKS API.

Dim swApp As SldWorks.SldWorks
Dim swPart As SldWorks.PartDoc

Sub main()

    Set swApp = Application.SldWorks
    Set swPart = swApp.ActiveDoc
    If Not swPart Is Nothing Then
        Dim swMatVisPrps As SldWorks.MaterialVisualPropertiesData
        Set swMatVisPrps = swPart.GetMaterialVisualProperties
        swMatVisPrps.ApplyAppearance = False
        swPart.SetMaterialVisualProperties swMatVisPrps, swInConfigurationOpts_e.swAllConfiguration, Empty
        MsgBox "Please open part document"
    End If
End Sub

Product of Xarial Product of Xarial