cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Loop programming

ptc-6167959
1-Newbie

Loop programming

I'm trying to right a small programming loop to increase the size of a dimension until it passes a certain safety check. Here's what I wrote:question.jpg

All of the OTM values are defined before the function as well as the values for "Code", W.f, FS.OTM, D, a, W.T, D.f, R.p.x, A.p. However, this never produces a value for W.f.new. Can anyone point out where I'm going wrong with this?

1 ACCEPTED SOLUTION

Accepted Solutions

I overlooked on first inspection that you have created an endless loop.

You have to ensure that the values of the RM's and FSOTMy change, when you change W. This can either be done by putting the calculation of those values in the while loop as in the attached or by turning those calculations into functions of W.

12.06.png

View solution in original post

7 REPLIES 7
MikeArmstrong
5-Regular Member
(To:ptc-6167959)

Can you provide a worksheet for us to work with.

What happens if you place the cursor in the expression which yields no result and prerss F9?

Is automatic calculation turned on?

Automatic calculation is turned on. The programming loop just runs indefinitely, though.

Capture.PNG

While loop increments the value of W but there is no change to values of FS.xxx

So it does not exit.

What should be modified by the change in W?

Regards

Andy

I want the change in W to modify the values for RM.xxx which will modify FS.xxx

I overlooked on first inspection that you have created an endless loop.

You have to ensure that the values of the RM's and FSOTMy change, when you change W. This can either be done by putting the calculation of those values in the while loop as in the attached or by turning those calculations into functions of W.

12.06.png

That makes sense, thank you!

Top Tags