Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
I have a question.
I have a distance that is filled by a start rail, rail * number of rails and an end rail.
Only sometimes the end rail is a very small size, so that the start rail has to be shortened so that the end rail becomes longer.
The formulas for the rails are;
Start rail= 2.5*pallet+100
Rail= 3*pallet
Number of rails= Floor((distance-start rail)/rail)
End rail= distance – start rail- (rail*number of rails)
Now I have a code :
If end rail <= 1000
Start rail= 1.5*pallet+100
Else
Start rail=2.5*pallet+100
endif
If the end rail is longer than 1000mm, it is fine.
Only when the end rail is shorter than 1000mm, the start rail is shortened making the end rail longer, but since it then becomes longer than 1000mm again, the model automatically adjusts the start rail again to 2.5*pallet+100, making the end rail is again less than 1000mm. This way the model automatically goes back and forth every time you regenerate.
Is there a way to create conditions so that this doesn't go back and forth?
I can't figure it out myself, thanks in advance for the help.
Relations are executed *once*, in the order you supply them in, every time the model is regenerated. If your code changes the configuration so the result of the "IF" conditional is flipped every time the model is regenerated, it will act accordingly and reconfigure to meet your conditions. The design will never be stable. You need to evaluate the situation to determine the needed number of "rails" first, then apply those decisions to the overall design in terms of setting lengths, etc.
For your situation the way to set the different lengths would appear to be:
(1) Calculate the number of standard "rails" you need, based on overall length (distance?) and your standard length for them (3 * pallet ?)
(2) Calculate the necessary start and end rail lengths based on the remainder of the overall length you have to deal with (distance - number of rails * 3 * pallet ?)