AnsweredAssumed Answered

Use part name to control a global variable or custom property

Question asked by Connor Bourque on Jun 16, 2020
Latest reply on Jun 16, 2020 by Matt Peneguy

So here is what I'm trying to do. I have a part that is named "case 10.000_11.000_12.000.sldprt" Its a simple box meant to represent a cardboard box and as the file name states the box is 10" x 10" x 12". We design robotic palletizers so we get have many different customers and they have many different case(box) sizes. Currently I have 3 custom properties that I change when I need to make a new box size to design around. What I would like to do is have solidworks pull the box size out of the filename and assign that to the custom properties. This is helpful because all I have to do to get a new box size is file save as, then the new name changes the model for me.       


using excel as a proof of concept I get where A2 = case 10.000_11.000_12.000

"length" =MID(A2,6,6)  = 10.000

"width" =  MID(A2,13,6) = 11.000

"height"=  MID(A2,20,6) = 12.000


so I was thinking in the custom properties tab I could just replace the A2 with $PRP:"SW-File Name(File Name)"

"length" =MID($PRP:"SW-File Name(File Name)",6,6)  = 10.000

"width" =  MID($PRP:"SW-File Name(File Name)",13,6) = 11.000

"height"=  MID($PRP:"SW-File Name(File Name)",20,6) = 12.000


But I was not able to get this to work. I also tried using global variables but that didn't work either. Is there anyway to get this to work using custom properties or global variables without ahveing to use a API or macro?


I looked into these previous post but it seem the equation tab doesn't let string text exist on the right side of the equation anymore.

Equations =MID(…..  ) Custom Properties 


note: I'm using SW 2020 SP3

any help would be very much appreciated.