Valdas K.

Write Thickness to Configuration Specific Macro

Discussion created by Valdas K. on Sep 26, 2020
Latest reply on Sep 27, 2020 by Valdas K.

I have a code, which should write to each configuration a parameter = thickness.

Storis = Thickness

But the "Thickness" comes as word - text. I want it to be as parameter of sheet thickness.

I know that the culprit is this line:


swModel.CustomInfo2(swConfig.Name, "Storis") = "Thickness"


if I write Thickness without "" - it is a variable, but I don't know how to make that variable connected to sheet thickness. 


The code here:



Option Explicit

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim vConfNameArr As Variant
Dim i As Long
Dim swConfig As SldWorks.Configuration
'config manager
Dim swConfigMgr As SldWorks.ConfigurationManager

Sub main()

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
vConfNameArr = swModel.GetConfigurationNames

'config manager
Set swConfigMgr = swModel.ConfigurationManager
Set swConfig = swConfigMgr.ActiveConfiguration

For i = 0 To UBound(vConfNameArr)

Set swConfig = swModel.GetConfigurationByName(vConfNameArr(i))

'Add "Storis" = SW-Thickness - thickness of sheet
swModel.CustomInfo2(swConfig.Name, "Storis") = "Thickness"

Next i

End Sub