AnsweredAssumed Answered

Macro for SW Custom Properties.

Question asked by Ben Froese on Jan 22, 2019
Latest reply on Jan 22, 2019 by Ben Froese

Hey Guys,

 

I have a macro that I cannot seem to get to function properly.

 

What I want is for the macro to choose values from the Configuration Specific menu in the Properties Manager but instead it is taking values from the Custom menu. How can I get the macro to choose the Config Specific menu?

 

Macro is pulling values from here

I want the macro to pull values from here.

this is the macro

 

Option Explicit

 

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swCustPrpMgr As SldWorks.CustomPropertyManager

Dim nFileName As String

Dim Value As String

Dim Qty As String

Dim FilePath As String

Dim MTRL As String

Dim Thickness As String

Dim vConfNameArr As Variant

Dim sConfigName As String

Dim i As Long

Dim bShowConfig As Boolean

Dim bRebuild As Boolean

Sub Main()

 

 

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

 

 

' Check the document is a sheet metal part

If swModel Is Nothing Then

MsgBox "Please open a Sheet Metal Part"

Exit Sub

End If

 

If swModel.GetType <> swDocPART Then

MsgBox "Please open a Sheet Metal Part"

Exit Sub

End If

 

If swModel.GetBendState = swSMBendStateNone Then

MsgBox "Please open a Sheet Metal Part"

Exit Sub

End If

 

'Get Document Path

FilePath = Left(swModel.GetPathName, InStrRev(swModel.GetPathName, "\"))

 

 

'Get Document Name without extension

nFileName = Mid(swModel.GetPathName, InStrRev(swModel.GetPathName, "\") + 1)

nFileName = Left(nFileName, InStrRev(nFileName, ".") - 1)

 

*** this is the section that needs to change

'Get Custom Property

Set swCustPrpMgr = swModel.Extension.CustomPropertyManager("")

swCustPrpMgr.Get3 "Thickness", False, "", Value

swCustPrpMgr.Get3 "Material", False, "", MTRL

 

 

thanks for your help.

Outcomes