MACRO LIBRARY

Display custom properties for selected cut list folder

Free public access. No account or subscription required.

Files

Display custom properties for selected cut list folder

Code

Module:

'Displays certain custom properties for the selected weldment cut list folder.
    
'Preconditions: Cut list folder is selected.
    
'Written by Keith Rice
'CADSharp LLC
'www.cadsharp.com
    
Option Explicit
    
Sub main()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swSelMgr As SldWorks.SelectionMgr
    Dim swFeat As SldWorks.Feature
    Dim swCustPropMgr As SldWorks.CustomPropertyManager
    Dim swUserUnit As SldWorks.UserUnit
    Dim strLength As String, strMaterial As String, strQty As String
    
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swSelMgr = swModel.SelectionManager
    Set swFeat = swSelMgr.GetSelectedObject6(1, -1)
    Set swCustPropMgr = swFeat.CustomPropertyManager
    Set swUserUnit = swModel.GetUserUnit(swLengthUnit)
    
    swCustPropMgr.Get2 "Length", Empty, strLength
    swCustPropMgr.Get2 "Material", Empty, strMaterial
    swCustPropMgr.Get2 "Quantity", Empty, strQty
    
    MsgBox "Cut list item: " & swFeat.Name & vbCrLf & vbCrLf & _
        "Length: " & strLength & " " & swUserUnit.GetFullUnitName(Empty) & vbCrLf & vbCrLf & _
        "Material: " & strMaterial & vbCrLf & vbCrLf & _
        "Qty: " & strQty
End Sub