跳到主要内容

使用SOLIDWORKS API更改材料中的应用外观选项

编辑材料对话框中的应用外观选项

该示例演示了如何使用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
Else
MsgBox "请打开零件文档"
End If

End Sub