+ All Categories
Home > Documents > Pro Program

Pro Program

Date post: 20-Nov-2014
Category:
Upload: graham-moore
View: 8 times
Download: 4 times
Share this document with a friend
Description:
Automate Pro Engineer
Popular Tags:
26
T & T Series – Pro/PROGRAM Everything there is to know about Pro/Program
Transcript
Page 1: Pro Program

T & T Series – Pro/PROGRAM

Everything there is to know about Pro/Program

Page 2: Pro Program

© 2003 PTC2

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

Page 3: Pro Program

© 2003 PTC3

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)

Page 4: Pro Program

© 2003 PTC4

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.

Input Relations Execute BodyMass Props

Page 5: Pro Program

© 2003 PTC5

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

Page 6: Pro Program

© 2003 PTC6

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.

Page 7: Pro Program

© 2003 PTC7

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

______________________________________________________________________________

Page 8: Pro Program

© 2003 PTC8

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

Page 9: Pro Program

© 2003 PTC9

Functions Used in Relationscos() cosine

tan() tangent

sin() sine

sqrt() square root

asin() arc sine

acos() arc cosine

atan() arc tangent

sinh() hyperbolic sine

cosh() hyperbolic cosine

tanh() hyperbolic tangent

log() base 10 logarithmln() natural logarithmexp() 1 to an exp. Degreeabs() absolute value

Page 10: Pro Program

© 2003 PTC10

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

Page 11: Pro Program

© 2003 PTC11

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

Page 12: Pro Program

© 2003 PTC12

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.

Page 13: Pro Program

© 2003 PTC13

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-asm1Input1=expressionInput2=variableInput3=valueEnd Execute

Execute PART component2Input=value. . .End Execute

Page 14: Pro Program

© 2003 PTC14

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

Page 15: Pro Program

© 2003 PTC15

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.

Page 16: Pro Program

© 2003 PTC16

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

Page 17: Pro Program

© 2003 PTC17

Body Editing Examples

For example, if the original Part design was:

ADD PROTRUSION.....

ADD HOLE.....

ADD CUT.....

The modified design might look like this:

ADD PROTRUSION.....

IF d1 > d2

ADD HOLE

...

END ADD

ENDIF

ADD CUT.....

END ADD

Assembly…..

ADD PART BASE_1....IF DIA > 1.25ADD PART PART_A.....END ADDELSEADD PART PART_B.....END ADDENDIF

Page 18: Pro Program

© 2003 PTC18

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

Page 19: Pro Program

© 2003 PTC19

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

INTERNAL COMPONENT ID 12

END ADD

ADD PART (INSTANCE_NAME) INTERNAL COMPONENT ID 12 END ADD

Page 20: Pro Program

© 2003 PTC20

UDF Replacement

CHOOSE STATEMENT

INPUT

GROUP STRING

"ENTER GROUP TO PLACE 300/352/409"

END INPUT

CHOOSE (GROUP)

Ref. Page 382.

Page 21: Pro Program

© 2003 PTC21

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

Page 22: Pro Program

© 2003 PTC22

Pro/Program Structure – MassProp

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

Syntax:

MASSPROPPart [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.

Page 23: Pro Program

© 2003 PTC23

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.

Page 24: Pro Program

© 2003 PTC24

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!

Page 25: Pro Program

© 2003 PTC25

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.)

Page 26: Pro Program

View/Application Share: Live DemonstrationView/Application Share: Live Demonstration

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


Recommended