AnsweredAssumed Answered

BOM Quantity - cannot set!

Question asked by Aaron Torberg on Aug 15, 2016
Latest reply on Aug 16, 2016 by Deepak Gupta

Hey all I am trying to write a simple macro to prompt a user for a BOM quatity value, create the property and set the BOM Quantity drop down to the newly created field.  So here is what I have:

 

Sub main()

 

 

    Dim swApp As Object

    Dim swModel As Object

    Dim ModelTitle As String

    Dim ModelPath As String

    Dim UserQTY As Integer

    Dim Longstatus As Long

   

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

   

    UserQTY = 8

    ModelTitle = Left(swModel.GetTitle, (InStr(1, swModel.GetTitle, ".") - 1)) & "_QTY" & UserQTY

    ModelPath = Replace(swModel.GetPathName(), swModel.GetTitle, "")

    Longstatus = swModel.AddCustomInfo("BOM QTY", "Number", UserQTY)

    swModel.Extension.CustomPropertyManager.Set "UNIT_OF_MEASURE", "BOM QTY"

 

 

End Sub

 

but I cannot get it to set "unit_of_measure" to the property BOM QTY!  What am I doing wrong...?  TIA!

Outcomes