How to Prompt for Input in a Part

The method below describes how a part can be set up to ask for input every time it is loaded and regenerated. This is useful when creating intelligent parts and assemblies. In this example it is used to automate a spring template part. So instead of creating a massive library of springs they are generated as required from a spring template. The dimensions of the spring are set using parameters and relations. When the part is regenerated it prompts the user for new dimensions.

Inputs are added to the part using Program, Edit Design a text window will appear containing relation and statements that control the design, find the two lines INPUT and END INPUT the program below will be added between those two lines.

Format of program statement:

PARAMETER_NAME      PARAMETER_TYPE

PROMPT

Example:

FREE_LENGTH      NUMBER

"ENTER FREE LENGTH"

After completing the program save it and confirm YES to incorporate the design into the part. Below is an example of some inputs that have been added to a design (highlighted in red).

VERSION 20.0

REVNUM 661

LISTING FOR PART SPRING_TEST

INPUT

FREE_LENGTH NUMBER

"ENTER FREE LENGTH"

WIRE_DIA_MM NUMBER

"ENTER WIRE DIA (MM)"

SPRING_RATE NUMBER

"ENTER SPRING RATE N/MM (REF ONLY)"

OD NUMBER

"ENTER OUTSIDE DIAMETER"

NO_OF_COILS NUMBER

"ENTER NUMBER OF COILS"

CLOSED_HEIGHT NUMBER

"ENTER CLOSED HEIGHT (REF ONLY)"

NO_EFFECTIVE_COILS NUMBER

"ENTER NO OF EFFECTIVE COILS"

GROUND_ENDS YES_NO

"GROUND ENDS YES/NO"

MAN_REF STRING

"ENTER MANUFACTURERS REF (REF ONLY)"

END INPUT

RELATIONS

:

:

END RELATIONS

The above program has a problem - each time the part is regenerated it will ask for the parameter values again. This problem can be avoided by enhancing the program so parameter values are only requested on the first regeneration.

The program below is the same as above with three additional lines and an additional parameter. A YES_NO parameter 'NEW_SPRING' is created and set to YES in a part when the part is regenerated  the program asks for inputs only if the parameter 'NEW_SPRING' is set to YES. Following the any regeneration the parameter 'NEW_SPRING' is set to NO and the inputs are no longer requested. If it is necessary to modify the spring simply set the parameter 'NEW_SPRING' back to YES (Setup, Parameters, Modify pick NEW_SPRING and enter YES) the input section is then reactivated for one more regeneration.

Modification highlighted in red.

VERSION 20.0

REVNUM 661

LISTING FOR PART SPRING_TEST

INPUT

 IF NEW_SPRING==YES

     FREE_LENGTH NUMBER

     { program as above }

     "ENTER MANUFACTURERS REF (REF ONLY)"

 END IF

END INPUT

RELATIONS

NEW_SPRING=NO

:

:

END RELATIONS