Skip to main content
1-Visitor
January 28, 2016
Solved

Parameters automation - limitation of typed values

  • January 28, 2016
  • 3 replies
  • 4582 views

Hello everyone.

I am now working on the project for my Creo course and I am using parameters and relations. I have also added an extra option according to which during every regeneration of the model there appears a small window where you can provide the value of each parameter (I did it as follows: Tools > Model Intent > Program > Edit Design). Everything works perfectly, however, I would like to limit the possibility of entering values. I'm going to explain it according to the specific example. Let's go.

I decide at the begining that my model has for example a shape of the rectangle and is extruded at some distance. So, I create three parameter: SIDE1, SIDE2 and EXTRUDE. I'm choosing Tools > ... > Edit Design and in the new window between INPUT - END INPUT I provide each parameter with the proper command (e.g. "Enter the value of side 1" and so on). Now, after each regeneration I can change those values and my model is transformed. Ok, but I would like to limit now the range of each parameter. For instance, I want SIDE1 to be not shorter than 1 and ad the same time not longer than 5, so if someone provides 6 for this parameter there will appear the information "Wrong value. Operate between 1-5".

And my question is: does anyone have any idea how to do this limitation? I expect that it is connected somehow with IF fuction, however, I don't know where exactly should I use it (I expect that in the same window as I introduced parameters to be displayed but I don't know the exact place in this document).

I will be very grateful for your help

PS.: I attach my file. Please explain it according to this one, if you can of course


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
Best answer by TomU

Right, don't loop, just keeping asking the same question a pre-determined number of times. 

3 replies

23-Emerald IV
January 29, 2016

I'm not sure you're going to get exactly what you want.

  • You can use conditional statements in the INPUT section of the program to determine whether or not the user is prompted to enter a value.
  • You can use conditional statements in the RELATIONS section to determine how to handle the value they entered.  Change it to something else, round it, etc.  (Relations editing it better done with the relations editor instead of the program editor.)
  • I don't know of any way to get the system to re-prompt you if the first value entered is not acceptable.  I haven't tried it, but you might be able to simply list the same parameter multiple times in the INPUT section but with different prompts based on the last entered value.

Make sure you read through the Pro/PROGRAM section of the help docs:

http://help.ptc.com/creo_hc/creo30_pma_hc/usascii/#page/pma/fundamentals/Conditional_Input_Statements.html

mkrawczyk1-VisitorAuthor
1-Visitor
January 29, 2016

Thank you for your answer I tried to get the system to re-prompt in case of wrong value, unfortunately, it works only partialy. I used IF-ELSE function and "asked" it to check if the value is greater than 5 or smaller than 1 and alert if it is. However, when I checked it and typed wrong values from both sides in the next step I could enter every value. To reach well-working IF-ELSE statement I need to close it in some kind of loop. So I want it to re-prompt until the user provides the proper value. Do you know maybe how can I close the loop in this case?

This is the code I prepared and it works as I've explained above:

SIDE1 NUMBER

"Enter value for side 1 (1-5):"

IF SIDE1>5

     SIDE1 NUMBER

     "Wrong value! Operate in the limit (1-5):"

ELSE

     IF SIDE1<1

         SIDE1 NUMBER

         "Wrong value! Operate in the limit (1-5):"

     ELSE

         SIDE1 NUMBER

         "Confirm the value for side 1 (1-5):"

     END IF

END IF

1-Visitor
January 29, 2016

Would this work?

SIDE1 NUMBER

"Enter value for side 1 (1-5):"

IF SIDE1>5

     SIDE1 = 5

     "Value defaults to 5:"

ELSE

     IF SIDE1<1

         SIDE1 = 1

         "Value defaults to 1:"

     END IF

END IF

10-Marble
January 29, 2016

Good morning (or afternoon/evening), Marcin,

If I am not mistaken, this is not possible with ProProgram.  Looping is only available through, say, one of the external api's.  There is an ability to limit the parameter values, but I haven't tested that against ProProgram.  The JLink api is very nice for this type of automation.  I presume the vb api as well but, well, I'm not a vb guy so I don't know.  The challenge to using the JLink api (well, any of them) is the use of external files (not optimal).  But given the java part, it can make some very nice, robust interfaces for things like this.

For anyone else, please correct me if I'm wrong.

TomU23-Emerald IVAnswer
23-Emerald IV
January 29, 2016

Right, don't loop, just keeping asking the same question a pre-determined number of times. 

mkrawczyk1-VisitorAuthor
1-Visitor
January 30, 2016

Ok people, thank you very much for your help It is really kind of you that your tried to solve this task with me. To sum up all your messages and the whole conversation I think, that the best for my project, and also enough, will be the following option:

INPUT

SIDE1 NUMBER

"Enter value for side 1 (1-5):"

IF SIDE1 < 1 | SIDE1 > 5

     SIDE1 NUMBER

     "Wrong value! Operate in the limit (1-5):"

END IF

IF SIDE1 < 1 | SIDE1 > 5

     SIDE1 NUMBER

     "Wrong value! Operate in the limit (1-5):"

END IF

END INPUT

According to this the user can write wrong values twice (and there will appear the prompt that something is incorrect) until the program accepts it. I know it is not exactly what I was looking for, however, it is enough for my project if I don't use the external software. Once again thank you all very much for your support. It makes my work much easier with your ideas