I have a part I need to pattern but the number of times it is patterned is related to a length parameter...
If <= 60 in then don't pattern
If 60>X>=120 in then pattern twice
If 120>X>=180 in then pattern three times
If 180>X>=240 in then pattern four times
That's what I need to do using the rule... how would this rule be written?
Solved! Go to Solution.
Solved by ASchlaack. Go to Solution.
Solved by MegaJerk. Go to Solution.
Does this code do it?
''' Things you'll need. ''' (3) parameters ''' ---------------------------------------------- ''' -- Parameter Name -- Type -- Unit --------- ''' ---------------------------------------------- ''' -- someLength -- Number -- in --------- ''' -- finalLength -- Number -- in --------- ''' -- someQty -- Number -- ul --------- ''' ---------------------------------------------- ''' Create the above parameters in your model. ''' The code below should do what you're after. ''' change the value of 'someLength' to see ''' the changes to your finalLength and Qty! finalLength = someLength - 6.0 Select Case finalLength Case <=60 someQty = 1 Case > 60, <= 120 someQty = 2 Case > 120, <= 180 someQty = 3 Case > 180, <= 240 'So there is nothing after 240? someQty = 4 Case Else someQty = 1 '??? Whatever value you want. End Select
I do believe this code wil work, however I didn't end up using it. I was able to write another that worked. Thank you.
If LENGTH <= 60 in Then GUARD_PATTERN = 1 ul Parameter("15-1-0000 - GUARD_HOLDER:1", "WIDTH") = LENGTH-6.5 in End If If LENGTH > 60 And LENGTH <= 120 in Then GUARD_PATTERN = 2 ul Parameter("15-1-0000 - GUARD_HOLDER:1", "WIDTH") = (LENGTH-10 in)/2 End If If LENGTH > 120 And LENGTH <= 180 in Then GUARD_PATTERN = 3 ul Parameter("15-1-0000 - GUARD_HOLDER:1", "WIDTH") = (LENGTH-13.5 in)/3 End If If LENGTH > 180 And LENGTH <= 240 in Then GUARD_PATTERN = 4 ul Parameter("15-1-0000 - GUARD_HOLDER:1", "WIDTH") = (LENGTH-17 in)/4 End If