Is there a way to link a Configuration specific custom property to the "PART NUMBER" property that is displayed in a BOM?
We are using a third party CAM program that reads a SWX configuration specific custom property value to use for the machine file name.
I can create a configuration specific property called "PartNo" and edit it manually for each configuration, but it would save a lot of time if I
could link it to the "Part number displayed when used in a BOM" property, which is already set up via the configuration property tab.
(right click on a configuration & select properties, Bill of materials options.)
Here's the nuts & bolts of it stripped out of my code, but you need to do more. The bold text are the methods and properties that you should look up in the API help. Just copy the text below and paste it into a macro to begin:
Dim Part As Object
Dim strConfig, strPartNo as String
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
Set config = Part.GetConfigurationByName(strConfig)
'To assign / change the configuration properties:
config.UseAlternateNameInBOM = True 'VB Set property for BOM use in SolidWorks
config.AlternateName = strPartNo 'VB assign
config.UseAlternateNameInBOM = True 'VB Set property for BOM use in SolidWorks
Part.CustomInfo2(strConfig, "PartNo") = strPartNo 'strConfig = configuration name; 'PartNo = name of the custom property
'To read the configuration properties:
strPartNo = config.AlternateName 'read the config part number
strPartNo = Part.CustomInfo2(strConfig, "PartNo")
Message was edited by: Tom Helsley Oops, I had to change one thing... Part.CustomInfo2(strConfig, "PartNo") = strPartNo was Part.CustomInfo2(strConfig, "PartNo") = strProperty