PTC Bi-Monthly Email

September 4, 2001

A) PTC Design Tip:  Choosing the right Family Table Instance using Pro/PROGRAM

B) Today's technical tip:  What's that color?




 

A) PTC Design Tip:  Choosing the right Family Table Instance using Pro/PROGRAM

Note:  A license of Pro/Feature is required to edit the Pro/PROGRAM for parts (This module is included in nearly all Pro/Engineer packages) and a license of Pro/ASSEMBLY is required to edit the Pro/PROGRAM for assemblies (The Foundation package does include Pro/ASSEMBLY).  Check under "Help/Technical Support Info" to make sure you have these modules available.  Contact your sales representative if you don't.
For design automation, it can be desirable for an assembly to choose the family table instance of a component based on some dimensions or parameters.  One example would be choosing a rubber O-ring from a table of supplied sizes based on the piston's diameter and the receiving bore diameter.  Fortunately, by doing some simple editing of your assembly's Pro/PROGRAM, this can be accomplished rather simply.  For this example, let's add a little more complexity.

Example

Let's look at a simple piece of manufacturing tooling -- the C-Clamp.

To use a c-clamp in an automatic fashion, it would be nice if the size of the clamp was chosen automatically AND the jaw was opened to the correct size to accommodate the stock we're clamping.  Pro/PROGRAM can accommodate both needs.

Note:  If you've never used Pro/PROGRAM before, click here for a quick primer.

The process of solving this issue can be broken into 4 steps
1) Setting the assembly parameters.
2) Assembling the required components into the assembly.
3) Modify the Assembly Pro/PROGRAM to choose the correct family table instance of the c-clamp
4) Modify both the Assembly and Part Pro/PROGRAMS to enable the jaw to open to the correct size.

A follow-up summary flowchart makes it all clear.


1) Parameters

We'll create the assembly parameter, STOCK_SIZE, to capture the required opening to accommodate the total stock, shims and workbench thickness.  Also, the assembly parameter, DEPTH, will capture the required throat depth for the c-clamp.

These parameters could set manually, they could be measurements or they might just as well be dimensions.  Whatever the source of the values, they must be known to the assembly.


2) Assembly

Assemble the C-Clamp part generic into the assembly.  You can see that the clamp is too big and the throat is too shallow plus there's hidden line problems caused by the interference.

The (unmodified) Assembly Pro/PROGRAM follows.  The c-clamp assembly step is shown in bold.  Some assembly features were removed for brevity.
VERSION
REVNUM 126
LISTING FOR ASSEMBLY TOOLING

INPUT
END INPUT

RELATIONS
END RELATIONS
 

 ADD FEATURE 1
 INTERNAL FEATURE ID  1
 TYPE = DATUM PLANE
 NAME = ASM_RIGHT
 

    FEATURE IS IN LAYER(S) :
      01__ASM_ALL_DTM_PLN - OPERATION = SHOWN
      01__ASM_DEF_DTM_PLN - OPERATION = SHOWN

 END ADD

....
(other assembly features here)
....

 ADD PART WORKBENCH
 INTERNAL COMPONENT ID 39
 END ADD

 ADD PART STOCK
 INTERNAL COMPONENT ID 40
 PARENTS = 39(#5)
 END ADD

 ADD PART SHIM
 INTERNAL COMPONENT ID 50
 END ADD

 ADD PART C-CLAMP
 INTERNAL COMPONENT ID 41
 PARENTS = 39(#5)
 END ADD

MASSPROP
END MASSPROP


3)  Modifying the Assembly Pro/PROGRAM to chose and assemble the correct family table instance

The LOOKUP_INST function allows a family table instance to be chosen based on various parameter values.  From the online help we find the format.
The format for lookup_inst is:
lookup_inst ("generic_name", match_mode, "param_name_1", match_value_1, "param_name_2", match_value_2,...)
- where
 ·   generic name—Name of the generic model with a .prt or .asm extension
 ·   match_mode—One of the following values:
    -   –1 (find closest instance with param values less than or equal to supplied values)
    -   0 (find instance with param values that match supplied values exactly)
    -   1 (find closest instance with param values greater than or equal to supplied values)
 ·   param_name_1—Family table parameter name
 ·   match_value_1—Value to match against
For our c-clamp part, the family table parameters we want to consider are "JAW_HEIGHT" and "THROAT_DEPTH".
This function will assign the instance name to a string we'll call "clamp_instance".  So the following will be our relation:

clamp_instance = lookup_inst("c-clamp.prt", 1, "JAW_HEIGHT", stock_size, "THROAT_DEPTH", depth)

Remember, stock_size and depth are the two assembly parameters we defined earlier.  Match_mode=1 will insure we choose the next larger c-clamp and not the next smaller.  So our assembly relations block in the Pro/PROGRAM now looks like this:

RELATIONS
clamp_instance = lookup_inst("c-clamp.prt", 1, "JAW_HEIGHT", stock_size, "THROAT_DEPTH", depth)
END RELATIONS
We also need to make sure that the assembly grabs the correct instance.  At this point, only the parameter, "clamp_instance", has been set.  Nothing's been chosen yet.

Down in the Pro/PROGRAM listing, we find the "ADD PART" statement.  We need to modify this to assembly the instance instead of the generic.  To do this, "ADD PART C-CLAMP" will become "ADD PART (clamp_instance)".  The parameter placed in parenthesis tells Pro/Engineer to substitute the value of the parameter for the part name.

So the Pro/PROGRAM now looks like this

...
ADD PART (CLAMP_INSTANCE)
INTERNAL COMPONENT ID 41
PARENTS = 39(#5)
END ADD
...
And the assembly looks like the following.  Notice that the correct c-clamp was chosen but the jaw opening is still wrong causing hidden line problems.

 


4) Opening the jaw

To prevent hidden line removal problems and to simply make the assembly look good, the c-clamp should modify its opening dimension to accommodate the stock size I've chosen.  This requires two parts:  1) Setting up the c-clamp part to accept the desired input, and 2) Having the assembly regenerate the c-clamp with the correct opening dimension.

Part 1) is accomplished by adding a parameter to the INPUT block of the Pro/PROGRAM for the C-Clamp part.  INPUT statements take the form of "variable   type".  The type can be "number", "string" or "yes_no".  We've set the symbol of the dimension which controls the opening to be "OPENING".  Therefore, the input block looks like the following:

INPUT
 OPENING   NUMBER
END INPUT
Part 2) is accomplished by adding an EXECUTE statement to the assembly Pro/PROGRAM.  The EXECUTE statement passes the parameters and values listed to the part or assembly being executed.

The format of the EXECUTE statement is:
EXECUTE PART part_name
parameter1 = value1
parameter2 = value2
...
END EXECUTE

Substituting the information for this assembly,

 EXECUTE PART C-CLAMP
 OPENING = STOCK_SIZE
 END EXECUTE
Notice that we're not executing the instance but rather the generic.  Instances cannot be executed you must use the generic.  In the same way, instances cannot have their Pro/PROGRAM modified either.

Once that's all done, a single regeneration of the assembly produces the following.  It looks great, the BOM is correct, and hidden lines are no longer a problem!


 
 

Summary

The detailed steps given above can be summarized as follows.

The final Pro/PROGRAM follows.  Parts that were changed or added are in bold.  Some assembly features were removed for brevity.

VERSION
REVNUM 165
LISTING FOR ASSEMBLY TOOLING

INPUT
END INPUT

RELATIONS
CLAMP_INSTANCE = LOOKUP_INST("c-clamp.prt", 1, "JAW_HEIGHT", STOCK_SIZE, "THROAT_DEPTH", DEPTH)
END RELATIONS

 EXECUTE PART C-CLAMP
 OPENING = STOCK_SIZE
 END EXECUTE
 

 ADD FEATURE (initial number 1)
 INTERNAL FEATURE ID  1
 TYPE = DATUM PLANE
 NAME = ASM_RIGHT
 

    FEATURE IS IN LAYER(S) :
      01__ASM_ALL_DTM_PLN - OPERATION = SHOWN
      01__ASM_DEF_DTM_PLN - OPERATION = SHOWN

 END ADD

....
(other assembly features here)
....
 

 ADD PART WORKBENCH
 INTERNAL COMPONENT ID 39
 END ADD

 ADD PART STOCK
 INTERNAL COMPONENT ID 40
 PARENTS = 39(#5)
 END ADD

 ADD PART SHIM
 INTERNAL COMPONENT ID 50
 END ADD

 ADD PART (CLAMP_INSTANCE)
 INTERNAL COMPONENT ID 41
 PARENTS = 39(#5)
 END ADD

MASSPROP
END MASSPROP



Pro/PROGRAM primer

A Pro/PROGRAM is automatically created for each and every part and assembly in Pro/Engineer.  The Pro/PROGRAM controls the parameters and features of the object and can be edited to accomplish several automation tasks.  Among these are: allowing parameter values to be input during regeneration, choosing an assembly component to be included, turning features/components on and off depending on if-then-else logic, forcing the regeneration of an assembly component using passed down parameter values, and other such tasks.  One can also edit the features in the Pro/PROGRAM to reorder and delete features/components.  Be aware that a feature may not be created by simply editing the Pro/PROGRAM only deleted.

A typical design listing may contain any of the following:
 ·   Input variables with their current values
 ·   Relations
 ·   IF-ELSE clauses
 ·   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
 ·   EXECUTE statements (Assembly mode only)
 ·   INTERACT statements
 ·   Feature suppression and order
 ·   MASSPROP statement

A part's or assembly's Pro/PROGRAM can be accessed via the "Program" menu pick at the top level of either the part or assembly menus.

Before diving into Pro/PROGRAM, it is highly suggested that you review the information in the online help system.  Look in the index under Pro/PROGRAM.  There are about 40 pages of information in the help system.  Both capability descriptions and good examples are included.

There's also good information in our Technical Support Knowledge Database.  Some links are listed below (You'll need a customer support login to access these).
Frequently Asked Questions - Relations, Pro/Program, and Layers
Suggested Technique for Using Pro/PROGRAM to Create Instances
TITLE : Using UDF's to Facilitate the Assembly Process
 

 

 


B) What's that color?

Here's a quick tip.  Label your color names.

Just have too many similar colors?  By labeling them, much of the confusion of which one to use goes away.  Notice the "Cold_Steel" label in the following image.

This is accomplished by using one of the detail fields (Texture, Bump, Decal) in the color.map file to label the color.

The Decal field is probably the least used so it's perfect for this.

You'll need to edit the color.map file with a text editor.  Locate the 3rd line of each color and replace the last "NO_TEXTURE" field with the color name.  Make sure not to include any spaces in the name.

File: color.map
...
1.000 0.770 0.060 0.900 0.900 0.800 1.000 1.000 1.000 1.000
0.000 0.250 0.000 0.500 0 90
NO_TEXTURE NO_TEXTURE Corn_Yellow_Shiny
0.820 0.600 0.240 0.900 0.900 0.800 0.500 1.000 1.000 1.000
0.000 0.250 0.000 0.500 0 90
NO_TEXTURE NO_TEXTURE Tan_Glossy
0.440 0.500 0.600 0.900 0.900 0.800 1.000 1.000 1.000 1.000
0.000 0.250 0.000 0.500 0 90
NO_TEXTURE NO_TEXTURE Cold_Steel
0.640 0.460 0.300 0.900 0.900 0.800 0.370 1.000 1.000 1.000
0.000 0.250 0.000 0.500 0 90
NO_TEXTURE NO_TEXTURE Brown_Chalky
0.550 0.550 0.550 0.900 0.900 0.800 1.000 1.000 1.000 1.000
0.000 0.250 0.000 0.500 0 90
NO_TEXTURE NO_TEXTURE Aluminum_Polished
0.550 0.550 0.550 0.900 0.900 0.800 1.000 1.000 1.000 1.000
0.000 0.250 0.000 0.500 0 90
...

A sample color.map file has been included in this weeks mailing.  Be sure to check it out!