23 Replies Latest reply on Jun 4, 2018 3:48 PM by Rubén Rodolfo Balderrama

# Equations in Custom Property

I'm trying to learn how I can manipulate Solidworks to:

1. Get the configuration name (.500 in this example)

2. Divide .500 by .0625 and return a value of 008

3. Place the calculated value (008) into the PARTNO value (H00000-008 for example)

.

See the screen shot for clarity.  How should I approach this?  I'm not very familiar with using equations in this context, so my learning curve is looking a little steep, and could use some expert advice to help me solve this problem and save myself a whole lot of time in creating our custom library of mechanical fasteners.  I am ultimately trying to avoid using Toolbox (I've had some bad experiences with it).

• ###### Re: Equations in Custom Property

Unfortunately i don't know how to connect those values thru equations, but why not use a design table to make the configurations you need?

• ###### Re: Equations in Custom Property

Did you try to use DT? Attach your file and I will try make a DT for you

• ###### Re: Equations in Custom Property

The ultimate goal is to be able to create the part numbers automatically.  The last three digits of the part number should be represented as the quantity of 1/16" increments that make up the length of the bolt.  For example:

.625 long hex head cap screw should be part# H00004-010.  Then a .750 long screw would be H00004-12.

Are you suggesting that a design table would allow me at accomplish this?  The part is really simple....just downloaded it from McMaster-Carr and suppressed the helical threads.  The I simply configured the dimension that drives the bolt length and created lengths from 1/2" all the way up to 8".  So, getting the configurations is easy, but going back to manually change the part numbers is time consuming and prone to human error.

• ###### Re: Equations in Custom Property

Made a mistake there....the .750" long screw should be H00004-012.  The other issue is how to get leading zeros into the equation.  For example, .500 divided by .0625 returns "8".  I need it to return 008.  Likewise, .750 divided by .0625 returns "12".  I need that to return 012.  I hope I've articulated that well enough to not cause confusion.

• ###### Re: Equations in Custom Property

Design tables can drive custom properties.  This is what you want to do, especially since (it sounds like) you're not wanting to make the part number change automatically as someone changes the dimension, but rather that the user should select the config they want.

You can configure the dimension in the design table as well.

• ###### Re: Equations in Custom Property

Exactly.  I want the user to select the config (based on the bolt length), and propagate the correct meta data out to the BOM.  I still haven't figured out how to solve the leading zeroes issue though.  Is it possible to pull that info from an external table?  For example, when the simple math returns "8", have the software access a table and return "008".  Or, is there a better way?

• ###### Re: Equations in Custom Property

if you use a design table i think the below formatting would create what you are looking for. Have individual cells with separate parts of the part number and them combine them

• ###### Re: Equations in Custom Property

That's spot on!  Thank you very much.  The last piece of the puzzle is how to get that combined value pushed out to the Custom Properties as PARTNO.

• ###### Re: Equations in Custom Property

should just need something like this, also i just realized you will have to convert it to text and you can create the "000" during that step

• ###### Re: Equations in Custom Property

Hi Stephen

The syntax for properties in a Design Table is

\$PRP@PropertyName

so you would type \$PRP@PARTNO

btw SW already has a partnumber property

• ###### Re: Equations in Custom Property

Interesting question, as something similar was asked last week.  Design table probably is the way to go, but if you are trying to generate 999 parts, it may get bulky?

Anyway, see this post & see if that helps.  What it does is instead of adding 0's to the solution, it breaks the solution down to individual 0-9 digits for your case, 3 times.  There is an integer issue in that case, but as you are dealing solely with decimals, you will be ok.

Edit:

If you use a design table, Logan's answer is the way to go.

• ###### Re: Equations in Custom Property

If you dimension is equal to custom prop. name, you can link it to Global Variable and modify it:

Then link Custom Prop. PartNo to GV:

Now link BOM to Custom Prop. PartNo

You also can use Design Table to deal with it.

• ###### Re: Equations in Custom Property

I'm still struggling to get the info from the DT to the Custom Property field for PARTNO.  This has been a very humbling experience thus far.  :-)  I've typed \$PRP@PARTNO into cell E2, but nothing happens.  What am I missing?

• ###### Re: Equations in Custom Property

Make sure property PARTNO is Specific Configuration Property, not Custom Property. Then you can link DT to PARTNO

• ###### Re: Equations in Custom Property

Putting it in the DT automatically creates the property and makes it configuration specific.  You don't have to create it beforehand.

• ###### Re: Equations in Custom Property

well, just trying to figure out why link isn't working

• ###### Re: Equations in Custom Property

the blue cell below is set to family and is ok to leave blank, however the red cells have to have values in them solidworks will stop looking when it hits the first blank cell (the black one). so in my example solidworks never sees the "Calculation" column of data

• ###### Re: Equations in Custom Property

SW stops processing rows and columns when it comes to a blank in column A or in row 2.  So it's not getting all the way to your E2 column.  If you need to calculate "intermediate" type values, just put them out to the right, but make column C drive the property.

• ###### Re: Equations in Custom Property

You can also use the heading \$USER_NOTES to have columns that are ignored by SW

• ###### Re: Equations in Custom Property

Thank you Rob, good to know!

• ###### Re: Equations in Custom Property

I just wish that it worked like a comment in computer code, where you could add any text afterwards to describe what the note is,,

but I found a work-a-round.

You can use the 1st row

• ###### Re: Equations in Custom Property

Thanks guys.  I owe you all a beer.

• ###### Re: Equations in Custom Property

I do it....try to make same to you