AnsweredAssumed Answered

Custom Property Macro

Question asked by Wayne Easton on Jul 19, 2016
Latest reply on Jul 28, 2016 by Viktor Bovzdarenko

Hi,

 

I found a macro to create custom properties in a SW file. I have modified the original to suit our needs, it works well except for the fact that it writes the custom properties to the custom tab. Instead I would like to write the same custom properties but to all configuration tabs.

 

Can anyone help please?

 

Public swApp As Object

Public Part As Object

 

 

Sub main()

 

 

Set swApp = CreateObject("SldWorks.Application")

Set Part = swApp.ActiveDoc

 

 

Dim MyProp(1, 3) As String

 

 

'Property names

MyProp(0, 0) = "Material"

MyProp(0, 1) = "Weight"

MyProp(0, 2) = "SurfaceArea"

MyProp(0, 3) = "Volume"

 

 

'Property values

 

 

MyProp(1, 0) = Chr(34) & "SW-Material" & Chr(34)

MyProp(1, 1) = Chr(34) & "SW-Mass" & Chr(34)

MyProp(1, 2) = Chr(34) & "SW-SurfaceArea" & Chr(34)

MyProp(1, 3) = Chr(34) & "SW-Volume" & Chr(34)

 

 

Dim m As Integer

 

 

For m = 0 To 3

    retval = Part.AddCustomInfo3("", MyProp(0, m), 30, _

         MyProp(1, m))

Next m

 

 

End Sub

Outcomes