Start a topic
With the exception of Windchill, The PTC Community is on read-only status until April 6 in preparation for moving our community to a new platform. Learn more here
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The PTC Community is on temporary read only status in preparation for moving our community to a new platform. Learn more here

Translate the entire conversation x

How to do this check

YA_10963798
14-Alexandrite

How to do this check

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 

 
 
 
 

 

ACCEPTED SOLUTION

Accepted Solutions

6 REPLIES 6

Capture.JPG

 

Thanks a lot it works 

Yusra

Need to get a little fancy

nice thank you

Werner_E
25-Diamond I
(To:YA_10963798)

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

grafik.png

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:

grafik.png

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..."

grafik.png

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.

grafik.png

If you don't like using the "return" statement to terminate the program, you may use the "break" statement to terminate just the loop:

grafik.png

 

YA_10963798
14-Alexandrite
(To:Werner_E)

Thank you so much for such explanation 

Announcements


Top Tags