ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
PHPaul Hitchcock22/10/2013

We save all of our parts with the file name in a format that has the "part number" on the end of the file name following a period.  We reference this part number on BOM and callout tags on exploded views.

Part Filename = <Assembly FileName>.<Part Number> (Example: 1234-10.105)

We have a custom property on each part named "PARTNO" that we are manually filling with the last number (105 in the example).

Is it possible to write this in a calculated field either on the Custom Property or inside a Table like a BOM to avoid having to run a macro?

In Excel I would use something like this: Equation = Replace(PartFileName, AssemblyFileName, "")

If not, can somebody get me started on the macro?  I'm very familiar with VB but brand new to SolidWorks.

Below is a quick outline of the steps I would like to do, I just need help getting the correct SolidWorks functions and objects to make it work.

For each Part in Assembly

  get PartFileName

   get PartNo from PartFileName - (I can handle the string manipulation steps)

   assign CustomPartProperty "PartNo" to PartNo

Next Part

Or is there a better way to do this that I'm no aware of?  We're using SW 2013 Standard.