Get Width and Height of Appearance Texture Example (VBA)
This example shows how to get the width and height of an appearance
texture.
'-----------------------------------
'
' Preconditions: Model is open on which at least one
' appearance
texture has been applied.
'
' Postcondition: None
'
'-----------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim varAppearances As Variant
Dim vAppearance As Variant
Dim swAppearance As SldWorks.RenderMaterial
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
varAppearances = swModelDocExt.GetRenderMaterials
For Each vAppearance In varAppearances
Set
swAppearance = vAppearance
Debug.Print
"Appearance: " & swAppearance.FileName
Debug.Print
"Fixed aspect ratio: " & swAppearance.FixedAspectRatio
Debug.Print
"Width: " & swAppearance.Width
* 1000#
Debug.Print
"Height: " & swAppearance.Height
* 1000#
Next
End Sub