Program
Program
Pro/ENGINEER
Wildfire™ 2.0
Pro/PROGRAMTM
Help Topic Collection
About Pro/PROGRAM................................................................................................. 1
Incorporating Changes................................................................................................ 3
Execution Errors.......................................................................................................... 5
Feature Errors.......................................................................................................... 5
Geometry Errors...................................................................................................... 5
Creating Instances...................................................................................................... 7
Editing a Design......................................................................................................... 13
Relations................................................................................................................. 13
v
Table Of Contents
IF-ELSE Statements............................................................................................ 16
EXECUTE Statements............................................................................................21
Feature Operations................................................................................................. 25
Editor Errors........................................................................................................... 27
Index......................................................................................................................... 29
vi
Pro/PROGRAM Basics
About Pro/PROGRAM
Each model in Pro/ENGINEER contains a listing of major design steps and parameters
that can be edited to work as a program. By running the program, you change the
model according to new design specifications.
To enter the Pro/PROGRAM environment, click Tools > Program from the PART or
ASSEMBLY menu.
Note: From Model reflects the current state of the model, while From File
includes all new instructions that you have added during the last editing session.
2. Click Show Design or Edit Design from the PROGRAM menu to view the model
design.
o If you choose Edit Design, the program appears under the system editor—
usually in the startup window.
Note: In the header of every design listing, a REVNUM indicates the last model
revision. The system uses this to detect if the design is outdated.
• Relations
• IF-ELSE clauses
1
Pro/PROGRAM – Help Topic
• Lists of all the features, parts, or assemblies in the design, which, when enclosed
within "IF condition... ELSE... END IF" statements, create alternate design
branches
• INTERACT statements
• MASSPROP statement
2
Incorporating Changes
Note: If you want to check the current parameter values, choose Show Design
> From Model. The information window displays the listing with the input
variables and values assigned to them in the current model design.
• Enter—Enter new input values as prompted. Check boxes in the INPUT SEL
menu control parameter selection. Pro/PROGRAM only prompts you to enter a
new value for the checked parameters.
• Read File—When running a program, the system uses input from a file. Type a
file name (including the extension, if any).
5. In the INPUT SEL menu, click the check boxes next to the input parameters for
which you want to enter values, and then click Done Sel.
3
Pro/PROGRAM – Help Topic
If you enter parameters from a file that contains fewer parameters than are called
for in the INPUT statement, the system assumes current values for the missing
parameter.
If, on the contrary, the output file contains more variables than are needed for the
execution, those parameters not pertaining to the program are disregarded.
Because the program ignores those parameters that do not pertain to this particular
program, you can create an input file that acts as a global source for a number of
models.
Note: The system is case-sensitive when parameters and their values are read in
from a file. Be consistent in specifying variables.
4
Execution Errors
In Assembly mode:
If the failure occurs during assembly (for example, because a substituted
member does not fit), the system informs you that it failed to replace the
particular member and asks you if you want to reedit the program.
Feature Errors
Many errors are not detected during editing, but they still make the design unusable.
They can be defined generally as invalid feature-list errors. Such errors usually result
from reordering or deleting features that depend on each other, or from imposing
condition values on features such that a feature that must be created is missing its
parent.
Feature list errors are caught during execution, after the input values have been
requested, but before the model geometry reconstruction has begun.
Geometry Errors
Some errors cannot be detected until the geometry reconstruction process has
begun. For example, you could take the following design:
ADD FEATURE PROTRUSION
ADD FEATURE SHELL
OF THICKNESS d10 (to make a cup)
ADD FEATURE PROTRUSION (handle for cup)
and reorder the last two features, which are not dependent on each other. If the
geometry of the handle is too thin to be shelled with thickness d10, this creates a
geometry error. Pro/ENGINEER fails to regenerate the shell. The failed feature (the
shell) is highlighted in red on the model. The RESOLVE FEAT menu appears, and
the Failure Diagnostics window opens with information on the failed item.
If you choose Undo Changes, the system undoes the changes in this regeneration
and returns to the previous state. In the preceding example, this means that the
feature order would be restored.
5
Creating Instances
2. On the PROGRAM menu, click Instantiate. Pro/TABLE appears with the name of
the generic model or models (part in Part mode, assemblies and parts in
Assembly mode) in column 1, and the default instance name or names in column
2.
3. Edit the default instance name or names for assembly and parts if desired, and
then exit Pro/TABLE.
After you create an instance assembly, you can view the family table. It now includes
the instance assembly name, part names that were executed, and variables that
were entered during input.
Note: The parameters that appear in the family table control the model design.
7
Pro/PROGRAM – Help Topic
8
An Example of Parametric Design
1. Assembly 1
2. Assembly 2
3. Assembly 3
4. COVER_TYPE=NO
5. CYL_DIAM
9
Pro/PROGRAM – Help Topic
6. CAP: MODEL_A
7. COVER_TYPE=YES
8. COVER_SIZE
9. CAP: MODEL_B
Note:
a. Pass value for COVER_TYPE down to part "Cover." If value is YES, cover has
a hole added. Also, pass values for material and size of the cover (size of
the top plate).
b. Add a cover.
c. If COVER_TYPE=YES, add the cap to the assembly
1
An Example of Parametric Design
RELATIONS
DIAM = COVER_SIZE / 2 [a.]
IF MATERIAL == "Poly"
d0=.10
ELSE
d0=.2
ENDIF
END RELATIONS
ADD FEATURE 1
INTERNAL FEATURE ID 33 [b.]
TYPE=FIRST FEATURE
...
COVER_SIZE = 2.4 [c.]
ADD
END
Note:
a. Relations include a relation for the hole diameter and a conditional
statement for material type. ("Poly" and "ABS" require double quotation
marks.)
b. Add the base feature.
c. Parameter name has been renamed to "COVER_SIZE".
1
Pro/PROGRAM – Help Topic
d. Add walls.
e. If COVER_TYPE=YES, add a hole. (No quotation marks around YES.)
RELATIONS
END RELATIONS
1
Editing a Design
A warning appears when you attempt to edit From Model while a file with a
Pro/PROGRAM listing exists in the working directory. This warning reminds you that
when you exit from the editor the file will be overwritten with the new contents. If
you still want to proceed with editing (this replaces an old design file), enter Y. To
abort editing, enter N.
If you are working with an assembly that has components belonging to a family
table, listings for instances may be viewed, but they cannot be edited, because the
program always resides in the generic part.
Note: To gain access to the listing in a generic assembly, assembly instances
must be cleared from workstation memory.
Relations
All relations valid in a Pro/ENGINEER model can be entered in a Pro/PROGRAM
design.
If an expression you want to include in the RELATIONS statement contains more than
80 characters, use a backslash (\) to interrupt the current line and continue the
expression on the next line.
The format can be as follows:
RELATIONS
PARAMETER = COVER_SIZE/2 + LENGTH*0.75 -\
0.75*d3*d3 + THICKNESS*2
END RELATIONS
1
Pro/PROGRAM – Help Topic
Changing the material density in a part causes the system to update the mp_density
value in relations and vice versa.
Note:
o When using negative dimensions, a dollar sign ($) must precede the
dimension symbol in both the input statement and the external input files.
For example, use $d20 instead of d20. The dimensions will not be updated
if a dollar sign does not precede the symbols.
Note that the slash and asterisk precede the comment. Also, the comment on a
feature must immediately follow its ADD FEATURE line. The comment is then
attached to the feature being added and appears in the information window.
• String—Enter a string of characters for this variable type. This enables you to
enter parameters or model names, but not user attributes.
Note: If no type is specified for the variable, the system default is Number.
1
Editing a
particular input variables. Then, during design execution, the prompts appear when
the associated variable requires input.
The rules for including prompts follow:
• A prompt must be enclosed in quotation marks.
For example:
INPUT
THICKNESS NUMBER
"Enter wall thickness for the cylinder"
INCLUDE_VALVE YES_NO
"Is valve to be included for analysis"
STOCK_ID STRING
"Enter the part’s stock ID"
...
END INPUT
When executing this program, you are prompted to enter the diameter of a hole only
if a hole feature is included.
1
Pro/PROGRAM – Help Topic
IF-ELSE Statements
Conditional statements are also valid for assemblies. They control whether a
particular part or subassembly is added to the assembly or executed. In the following
example, PART_B is not used unless the parameter DIA has a value less than or
equal to 1.25.
ADD PART BASE_1
....
IF DIA > 1.25
ADD PART PART_A
.....
END ADD
ELSE
ADD PART PART_B
.....
END ADD
ENDIF
1
Editing a
INPUT
fastener_name STRING
"Enter name of fastener to be used in cam:"
END INPUT
1
Pro/PROGRAM – Help Topic
2. In the associated ADD statement, put the name of the string variable in
parentheses.
For example:
INCL_CRANK YES_NO
RELATIONS
IF (INCL_CRANK == YES)
PART_NAME = "CRANK"
ELSE
PART_NAME = "SHAFT"
ENDIF
END RELATIONS
The ADD statement includes the variable defined in the ADD statement (it is
enclosed in brackets).
For example:
ADD PART (PART_NAME)
...
END ADD
1
Editing a
o –1 (find closest instance with param values less than or equal to supplied
values)
o 0 (find instance with param values that match supplied values exactly)
o 1 (find closest instance with param values greater than or equal to supplied
values)
1
Pro/PROGRAM – Help Topic
where <variable name> is the name of a string variable that contains the ID of the
group to be placed. All the available IDs can be found in the ADD statement of the
leader of the currently active group in the Pro/PROGRAM listing.
o To use a CHOOSE statement, you must first manually replace a family table
instance of the group or replace the group with another group.
2
Editing a
EXECUTE Statements
input variable.....
END EXECUTE
2
Pro/PROGRAM – Help Topic
For example, for the part block_base, the listing looks like this:
INPUT
key_size
ansi_thread
...
END INPUT
RELATIONS
d5 = key_size
d3 = depth * 1.25
END RELATIONS
....
Then the design listing for the assembly looks like this:
INPUT
hole_diameter NUMBER
thread_type STRING
depth
...
END INPUT
RELATIONS
END RELATIONS
EXECUTE PART block_base
key_size = hole_diameter/2 + 0.025
ansi_thread = thread_type
depth = DEPTH
...
END EXECUTE
And the design for the part block_base looks like this:
INPUT
ADD FEATURE.....
Note:
2
Editing a
• If you incorporate changes in the model after ignoring the warning, the value of A
is passed to a parameter with the same name in the part being executed.
2
Pro/PROGRAM – Help Topic
END EXECUTE
ENDIF
Note: When specifying the model for which mass properties are to be calculated,
enter the model name without an extension.
The MASSPROP statement can contain the IF... ELSE clause. If you add a condition
to the MASSPROP statement, the mass properties of an object will be calculated only
if that condition is met.
For example:
MASSPROP
IF THICKNESS > 1
PART PLATE
ELSE
ASSEMBLY BLOCK
ENDIF
END MASSPROP
In the preceding example, if the parameter THICKNESS is more than 1, mass
properties is recalculated for the part PLATE; otherwise, mass properties for the
assembly BLOCK is calculated.
2
Editing a
ELSE
INTERACT
END IF
ADD CUT.....
Feature Operations
Note: Suppression through the use of Pro/PROGRAM works the same way as in
regular Pro/ENGINEER (suppressed models are not retrieved when an assembly is
retrieved). Therefore, suppressed models are not stored when you save an assembly
with the Save As command.
2
Pro/PROGRAM – Help Topic
You can also assign a new dimension value through the RELATIONS statement.
2
Editing a
Editor Errors
If the file contains errors, the PROG ERROR menu appears with the following active
commands:
• Abort—Cancel changes that you have made to the design and keep it as it was
prior to editing.
• Edit—Edit the design to correct errors. Error messages indicate the location and
type of error. These messages are ignored during subsequent design processing;
they are deleted if new errors are found and inserted into the design, or if you
exit from the model.
2
Index
C
CHOOSE statement
In Program 20
CHOOSE statement 20
components
interchanging in Program 17
replacing in assemblies 17
components 17
conditional statements 16
design branches
about 15
creating 15
PROGRAM menu 1
errors
correcting programmatically 27
execution errors 5
feature 5
geometry 5
in Program 27
errors 5, 27
EXECUTE statements
in Program 21
2
Pro/PROGRAM – Help Topic
EXECUTE statements 21
features
changing dimensions 26
features 26
geometry
errors 5
reconstruction 5
geometry 5
groups
groups 25
IF statements 16
input parameter
types
selecting or modifying 3
input variables
entering 3
in model design 3
input variables 3, 14
instances
creating 7
creating programmatically 7
instances 7
INTERACT statements
in Program 24
INTERACT statements 24
3
Index
lookup_inst function
in Program 18
lookup_inst function 18
MASSPROP statement
in Program 23
MASSPROP statement 23
Pro/PROGRAM
about 1
comment format 14
conditional statements 15
design branches 15
errors 5, 27
including prompts 14
interchanging components 17
relations 13
3
Pro/PROGRAM – Help Topic
Pro/PROGRAM 1, 2, 3, 5, 7, 9, 13, 14, 15, 17, 18, 21, 22, 23, 24, 25, 27
prompts
prompts 14
relations
in Program 13
relations 13
resume
resume 25
PROGRAM menu 1
suppress
suppress 25
variables 14, 16