From: Matt Schroeder on
For whatever reason, where I work decided to use a different custom
property other than Description to fill in their descriptions for parts
and assemblies, and the use this to fill in the drawing title block,
making that custom, and the BOM, making the BOM template custom as
well.

The main reason I feel we need this changed is because it adds a level
of complexity to creating toolbox fasteners that I think is
unnecessary. This situation requires that toolbox fastener
descriptions also need to be customized, adding another ambiguous
custom property, so the fastener's description will read properly in
the BOM of assembly drawings.

I'm looking for a macro that will run through all our parts and
assemblies on the network, and copy the value from our special custom
property into the "Description" custom property that everyone else in
the world uses.

After I do this, I can then change our drawing and BOM templates to use
Description.

If anyone's seen anything like this, or similar that I could modify and
use, I'd be appreciative.

I'm also open to alternate solutions to this issue.

The ideal solution would be to modify the existing drawings templates
custom property to Description, while also modifying the name of the
custom property in the drawings and assemblies to Description.

I did something similar to this once with 2D Microstation drawings and
material hardness specifications, but that was a simple ASCII text
replace command. I'm pretty sure it's not that easy this time.

--Matt Schroeder

From: TOP on
This is right out of help with one line added. It adds an x to the end
of each custom prop in each config and copies it.

Google for ccrp to get a routine that will recurse through a directory.

Option Explicit



Public Enum swCustomInfoType_e

swCustomInfoUnknown = 0

swCustomInfoText = 30 ' VT_LPSTR

swCustomInfoDate = 64 ' VT_FILETIME

swCustomInfoNumber = 3 ' VT_I4

swCustomInfoYesOrNo = 11 ' VT_BOOL

End Enum



Sub main()



Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swConfig As SldWorks.Configuration

Dim vConfName As Variant

Dim vPropName As Variant

Dim vPropValue As Variant

Dim vPropType As Variant

Dim nNumProp As Long

Dim i As Long

Dim j As Long

Dim bRet As Boolean

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc



Debug.Print "File = " + swModel.GetPathName



vConfName = swModel.GetConfigurationNames

For i = 0 To UBound(vConfName)

Set swConfig = swModel.GetConfigurationByName(vConfName(i))



nNumProp = swConfig.GetCustomProperties(vPropName, vPropValue,
vPropType)



Debug.Print " Config = " & vConfName(i)

For j = 0 To nNumProp - 1

Debug.Print " " & vPropName(j) & " <" & vPropType(j) &
"> = " & vPropValue(j)

'The following line adds an x to the end of the property name
bRet = swModel.AddCustomInfo3(vConfName(i), vPropName(j) &
"x", vPropType(j), vPropValue(j))

Debug.Print bRet

Next j

Debug.Print " ---------------------------"

Next i

End Sub