You are on page 1of 26

T & T Series – Pro/PROGRAM

Everything there is to know about


Pro/Program
Presentation Topics

 Pro/Program Background
 Structure of a Pro/Program
• Inputs

• Relations

• Execute

• Body

• Mass Properties
 Running Programs
 Helpful Hints
 Where to Find More Info

2 © 2003 PTC
Pro/Program Background

What is Pro/Program?
 Pro/Program is a tool within Pro/ENGINEER to automate the
generation of similar parts and assemblies by modifying parameters.
 Think of Pro/Program as relations on Steroids.

What isn’t Pro/Program?


 Pro/Program isn’t a True Programming Language.
 Pro/Program isn’t a way to make one model generate your entire
Product Catalog.

What do I need to use Pro/Program?


 Parts Only – Pro/E Foundation.
 Parts and Assemblies – Advanced Assembly Extension (AAX)

3 © 2003 PTC
Pro/Program Structure

Every Pro/Program has the Following Sections, in the Following


Order:
 Input Statements – Ask your Questions
 Relations – Manipulate the Inputs
 Execute Statements – Pass along the Results
 Body – Suppress / Resume / Swap Components and Features
 Mass Properties – Compute the physical from the virtual.

Mass
Input Relations Execute Body Props

4 © 2003 PTC
Pro/Program Structure - Inputs

Input Statements provide the Values to Automate your Product.

There are Three types of Inputs:


 String
 Number (The Default)
 Yes_no

Sample Input Section:


Input
modeled_by String
End Input

5 © 2003 PTC
Pro/Program Structure - Inputs

Input Section Tips


 Provide Prompts for your Inputs by enclosing them in quotes after the
Input Request.
Example:
Input
Modeled_by String
“Who is modeling this Part?”
End Input
 Filter out Inputs with the Use of Conditional statements – If and ENDIF
 All Input Lines become Parameters in the Model. Deleting Input
statements will not remove the parameter. It must be manually
deleted.

6 © 2003 PTC
Input 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

______________________________________________________________________________

7 © 2003 PTC
Pro/Program Structure – Relations

Relations allow you to manipulate the Inputs


 This is the same Relations section you know and Love.
 You can use all of the built-in functions of Pro/Engineer
• Math Functions (+, -, *, /, Tan, SQRT, Log, etc.)
• IF / ELSE / ENDIF
• Ceil

• Floor

• Lookup_inst – Used for finding Family Table Instances


 Be nice to the People who have to modify after you. Use /* to
include Comments

8 © 2003 PTC
Functions Used in Relations
cos() cosine log() base 10 logarithm
ln() natural logarithm
tan() tangent
exp() 1 to an exp. Degree
sin() sine
abs() absolute value
sqrt() square root

asin() arc sine

acos() arc cosine

atan() arc tangent

sinh() hyperbolic sine

cosh() hyperbolic cosine

tanh() hyperbolic tangent


9 © 2003 PTC
Functions Used in Relations

ceil() the smallest integer not less than the real value

floor() the largest integer not greater than the real value

Optional Values for ceil and floor.

ceil (parameter_name or number, number_of_dec_places)

floor (parameter_name or number, number_of_dec_places)

Ex:

ceil (10.2) = 11

floor (-10.2)= -11

ceil (10.255,2) = 10.26

ceil (10.255,0) = 11

floor (10.255,1) = 10.2

floor (-10.255,2) = -10.26

10 © 2003 PTC
Operators Used in Relations

+ Addition

- Subtraction

/ Division

* Multiplication

^ Exponentiation

() Parentheses for grouping ex. d0=(d1-d2)*d3

== Equal to

> Greater than

>= Greater than or equal to

!=,<>,~= not equal to

< Less than

<= Less than or equal to

| Or

& And

~,! Not

11 © 2003 PTC
Pro/Program Structure - Relations

Relation Tips
 Add Comments to remind yourself and others what your
relations are controlling
 Modify your dimensions with Logical names
• Length instead of d20, etc.
 Relations are evaluated from top to bottom. Relations towards
the bottom have more precedence than those higher up.
 Parameters must exist before they can be used in relations.
 Maximum Line length is 80 Characters use \ to continue on a
second line. Recommended Maximum of 5 lines total.

12 © 2003 PTC
Pro/Program Structure – Execute

Execute Statements allow an assembly to pass values to sub


assemblies or parts and run their programs. Think subroutine.

Syntax:
Execute ASSY sub-asm1
Input1=expression
Input2=variable
Input3=value
End Execute

Execute PART component2


Input=value
...
End Execute

13 © 2003 PTC
Execute Example

EXECUTE STATEMENT

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

14 © 2003 PTC
Pro/Program Structure – Execute

Tips on Using Execute Statements:


 Execute Statements only work in assemblies.
 You can use as many Execute Statements as necessary
 Execute Statements can be surrounded by IF / ENDIF to skip
an Execute statement
 Instead of specifying a Particular Name, a Variable can be
used. IE: Execute Part (Component)
 If a Part is assembled in your assembly more than once, it only
needs to be executed once.
 Use Execute Statements instead of Assembly relations. They
are more reliable and more versatile.

15 © 2003 PTC
Pro/Program Structure - Body

The Body is where the Features or Components are added.

Pro/Program can suppress or resume features / components. Surround


the Add / End Add with If / End IF

Pro/Program Can Replace Components Automatically.

Syntax:
Add Part (Variable)
...
End Add

Add Feature
...
End Add

16 © 2003 PTC
Body Editing Examples

For example, if the original Part design was:

ADD PROTRUSION.....
Assembly…..

ADD HOLE.....
ADD PART BASE_1
ADD CUT.....
....
The modified design might look like this:
IF DIA > 1.25
ADD PROTRUSION.....
ADD PART PART_A
IF d1 > d2
.....
ADD HOLE END ADD
... ELSE
END ADD ADD PART PART_B
ENDIF .....
ADD CUT..... END ADD
END ADD ENDIF

17 © 2003 PTC
Replacing Components

Replacing Components in Assembly Designs

The format for assembly relations is:

XYZ = <parameter_name>:fid_<feature_name>:<comp_id>

OR

XYZ = <parameter_name>:fid_<N>:<comp_id>

Example:

INPUT

fastener_name STRING

"Enter name of fastener to be used in cam:"

END INPUT

ADD PART (fastener_name)

...

END ADD

OR

To interchange a part named washer for a subassembly or vice versa, use an ADD COMPONENT

statement, using this format:

ADD COMPONENT (name with an extension, or variable)

COMPONENT ID <component Id>

For example:

ADD COMPONENT washer.prt

COMPONENT ID 4

...

END ADD

18 © 2003 PTC
Replacing From a Family Table

LOOKUP_INST Statement

d1 d0 d4

333              3.5       3.0       1.0   

431              4.0       3.0       1.0   

1211341         4.0      10.0       2.0    

541              5.0       4.0       1.0   

TEST_PART        8.0       1.0       1.5    

651              6.0       5.0       1.0   

JOE_INST         7.0      10.0       2.0   

SPEC_2           2.0       4.0       1.0   

8901            8.0       9.0       1.0   

PEGGY            2.0       7.0       1.0    

2233548          4.0       4.0       5.0

RELATIONS

INSTANCE_NAME = LOOKUP_INST("333.PRT",1,"D1",X:1,"D0",Y:1)

END RELATIONS

ADD PART 333


ADD PART (INSTANCE_NAME)
INTERNAL COMPONENT ID 12

END ADD
INTERNAL COMPONENT ID 12
END ADD

19 © 2003 PTC
UDF Replacement

CHOOSE STATEMENT

INPUT

GROUP STRING

"ENTER GROUP TO PLACE 300/352/409"

END INPUT

CHOOSE (GROUP)

Ref. Page 382.

20 © 2003 PTC
Pro/Program Structure – Body

Tips in the Body:


 Automatic Replacement of components can only occur with
Family Table instances or with the use of an Interchange
Assembly.
 Parts or Sub-Assemblies can be Replaced
 If you want to suppress / resume multiple adjacent features
you can use a single IF / ENDIF

21 © 2003 PTC
Pro/Program Structure – MassProp

Use the Mass Prop statement to update the mass properties each time
Geometry Changes.

Syntax:

MASSPROP
Part [NAME]
Assembly [NAME]
END MASSPROP

Tips:
 Use IF / ENDIF to classify which components get updated
 If you rename an object, you must manually update the MASSPROP
area.
 If you use a relation to set a parameter with the mass prop, you have
to regenerate again to update the parameter.

22 © 2003 PTC
Running your Program

 All Programs are automatically run every time the Object is


regenerated.
 If Inputs have been specified, Pro/Engineer will ask how you
would like to provide them: Current Vals, Enter, or Read File
 If you have a lot of Inputs, a Text File can save a lot of time.
Use the Following Format:
Input1 = Value
Input2 = “STRING”
Input3 = NO
Etc.

23 © 2003 PTC
Helpful Hints:

 Keep your Lines below 80 characters


 Use Multi-part If Statements to clarify your Logic
 Program your parts, then your sub-assemblies, then the Top
Level Assembly.
 Use Top Down Design Techniques to simplify Part
Replacements.
 Skeletons are your Friend
 Follow the KISS Principle!

24 © 2003 PTC
Need More Info:

 Pro/E Help System


• Help – Contents & Index
• Program or Relations in the Index
 PTC Knowledge Base
• www.ptc.com/support/support.htm

• Use Program in the Module field


 Third Party Books
• Automating
Design in Pro/ENGINEER with Pro/PROGRAM –
Mark Henault, et al.
• Old Pro/E Manuals (REV 18, 19 or 20.)

25 © 2003 PTC
View/Application Share: Live Demonstration

[PlaceWare View/Application Share. Use PlaceWare > Edit Slide Properties... to edit.]

You might also like