5 Replies Latest reply on May 10, 2013 5:39 PM by Benjamin Cavil

# Equations, Global Variables, IIF Statements, Linear Hole Patterns & More

I would like to set up an equation(s) to control the overall length and hole pattern of the bracket shown below.

The max length of the bracket is 70"

Hole pattern spacing is 4" from center

***the main problem I'd like help with is figuring out an equation that will ensure there's exactly 2" from the last hole to the bracket edge, even if the global variable "Width" contains a fraction.***

So, if my overall assembly is 58-7/16" (W) how can I set it up to get a bracket that's between 4-6" smaller but whose length is an integer and has the last mounting hole 2" from the edge?

Any help would be much appreciated!

Equations/Global Variables                Value/Equation                                                             Evaluates to

"Width"                                                       = "Width@soXXXXA.sldasm"                                                     80

"D1@Sketch2"                                            = if ( "Width" > 73.99 , "Width" - 10 , "Width" - 4 )                       70

"instance left direction@LPattern3"               = ( "Width" / 4 ) / 2                                                                    10

"instance right direction@LPattern3"             = ( "Width" / 4 ) / 2                                                                    10

"instance to left@LPattern4"                         = int ( "Width" / 4 ) / 2                                                               10

"instance to right@LPattern4"                       = int ( "Width" / 4 ) / 2                                                               10

• ###### Re: Equations, Global Variables, IIF Statements, Linear Hole Patterns & More

"Width" = Width@soXXXXA.sldasm

"instance left direction@LPattern3" = int ( "Width" / 4 ) / 2 -1

"instance right direction@LPattern3" = int ( "Width" / 4 ) / 2 -1

"instance to left@LPattern4" = int ( "Width" / 4 ) / 2 -1

"instance to right@LPattern4" = int ( "Width" / 4 ) / 2 -1

"D1@Sketch2" = (int ( "Width" / 4 ) / 2 -2) * 2 * "D4@LPattern3" + 4

Your patterns have one too many instances currently (the last one is off the edge of the part), so I add a Minus 1 to account for that.

Set the length of your part equal to the total length of the pattern plus 4 inches.

Message was edited by: Patrick O\'Hern

• ###### Re: Equations, Global Variables, IIF Statements, Linear Hole Patterns & More

My original equations weren't working for some reason, so I've updated them so that they do.

• ###### Re: Equations, Global Variables, IIF Statements, Linear Hole Patterns & More

Thanks for your prompt reply to my inquiry, I really appreciate it!

Your suggested changes seemed to get me closer to what I'm trying to achieve but as the image below illustrates I'm still not able to get the get the required 2" hole-to-edge distance.

Basically I just need to add 4" (2" per side) and I'll be good to go.

Should I ammend

"D1@Sketch2" = (int ( "Width" / 4 ) / 2 -2) * 2 * "D4@LPattern3" + 4

to

"D1@Sketch2" = (int ( "Width" / 4 ) / 2 -2) * 2 * "D4@LPattern3" + 8

• ###### Re: Equations, Global Variables, IIF Statements, Linear Hole Patterns & More

Actually, I should have made it:

"D1@Sketch2" = (int ( "Width" / 4 ) / 2-1) * 2 * "D4@LPattern3" +4

But either will work.

• ###### Re: Equations, Global Variables, IIF Statements, Linear Hole Patterns & More

Thank you, thank you, thank you!