The PTC Community is on temporary read only status in preparation for moving our community to a new platform. Learn more here
Hi there ,
I need to do this check that F< fy ...
I get the wrong answer .. can you help me to fix it
I don't know why I can't upload the picture here it is attached
Solved! Go to Solution.
Thanks a lot it works
Yusra
nice thank you
A program returns the last expression it executes and in case of your program thats the result of comparing F with 80 kN. So you always get "M36" for any force up to 80 kN.
You may return the vector "size" which you create in your program
But that's probably not what you want to see either.
My crystal ball tells me that you are interested in the first entry that is not 0. So the next largest bolt size. Is that correct?
You could achieve that using the "lookup" function:
The method fails for forces larger than the largest in the list (80kN) because there is no next largest bolt size.
If that's an issue you could cope with that using a "try...onerror..."
BTW, we can easily modify your approach using the for-loop to do the very same. Instead of creating a vector of size values we stop the loop the first time F is smaller or equal than f.y using the "return" statement.
If you don't like using the "return" statement to terminate the program, you may use the "break" statement to terminate just the loop:
Thank you so much for such explanation
