How to Use SmartAssembly in Pro/ENGINEER

SmartAssembly is a process capture tool that allows you to focus on the design process, instead of being bogged down with the repetitive tasks that are present in every design. It is a development engine that allows you to create UDFs, assemble existing parts or sub-assemblies, and configure new parts or sub-assemblies with associated drawings from existing company templates. You can develop programs in a simple easy to use language. Most programs are only a few paragraphs regardless of complexity.

SmartAssembly provides a powerful script language to define complex Pro/ENGINEER templates using components, UDFs and any available Features. Dimensions, Parameters and References can be defined in a flexible table-structure that will also drive the dynamic assembly GUI.

SmartAssembly also provides powerful machine design functions, such as bolts and dowel pin connections, library management and many other standard component functions. SmartAssembly is a powerful automation tool for any part or assembly typically placed as a library component as well as large complex assemblies with complex relationships between parts.

This tip is designed to introduce SmartAssembly and talk about how easy it is to get started.

Note: SmartAssembly is a 3rd party tool that may be acquired through www.sigmaxim.com. For more information on this product or a demo license, please contact Todd Stecker at tstecker@ptc.com.

Let's first begin by explaining programs. Programs are simple text files that are created in an editor such as Word, Notepad, WordPad or Crimson Editor. Crimson Editor is mentioned here since it is a shareware program and can be set to color code words when they are typed correctly to avoid syntax mistakes. The following is a simple program structure:

BEGIN_GUI_DESCR

END_GUI_DESCR BEGIN_ASM_DESCR
CONFIG_ELEM
END_ASM_DESCR

There are two main parts of the program: the GUI section (Graphical User Input)-this is the user interface that pops up after the program is selected-and the main program which is indicated by BEGIN_ASM_DESCR, and ending with END_ASM_DESCR.

The GUI section is optional; meaning sometimes we don't need it. An example of this is when we are extracting a BOM and outputting it to an Excel spreadsheet or bulk processing Pro/ENGINEER objects such as parts, assemblies, or drawings.

Let's add a few lines to the GUI section and show the results:

BEGIN_GUI_DESCR

  GLOBAL_PICTURE <name of a gif object here; create any gif image>

  USER_SELECT CSYS PICK_CSYS

END_GUI_DESCR

Here are the results that would show up in Pro/ENGINEER after selecting this program:

Notice that there is no compiling required; simply edit the text file and run it.

When you select the 'PICK_CSYS' button above, the smart filter selection in Pro/ENGINEER switches to Coordinate System, since this is the type of reference the program is asking for.

There are many other types of references we can look for, such as point, axes, plane, surface, curves, any type of geometry Pro/ENGINEER supports.

Let's add a few more lines to the GUI section:

BEGIN_GUI_DESCR

  GLOBAL_PICTURE newsletter

  USER_SELECT CSYS PICK_CSYS

  USER_SELECT AXIS PICK_AXIS

  USER_INPUT_PARAM DOUBLE ENTER_DOUBLE_NUMBER

  CHECKBOX_PARAM INTEGER ROTATE

  RADIOBUTTON_PARAM INTEGER SELECT_ONE A B C

END_GUI_DESCR

BEGIN_ASM_DESCR

  CONFIG_ELEM

END_ASM_DESCR

Here is what this GUI will look like after selecting the program again:

Notice the program takes care of organizing the GUI automatically. We are now required to select 'A', 'B', or 'C'. Turn on the 'ROTATE' option and enter a value for 'ENTER_DOUBLE_NUMBER'.

Next we will focus attention on the BEGIN_ASM_DESCR, END_ASM_DESCR section. This is where features are created, parts and sub-assemblies get assembled, and parameters are created. Think about all the things we can do inside of part, assembly or drawing. In this tutorial we will show how to assemble a part and create an udf.

Assembling the part:

We must be in assembly mode to do this. It is not possible to assemble a part in part mode or drawing mode.

Here is an example of assembling a part or sub-assembly into an active assembly.

BEGIN_ASM_DESCR

  CONFIG_ELEM
SEARCH_MDL_REF THIS CSYS PRT_CSYS_DEF MTG_PART_CSYS

ASSEMBLE THIS PICK_SUB_ASM

  CSYS REF_CSYS MTG_PART_CSYS

END_ASSEMBLE
END_ASM_DESCR

In the above example we are assembling a component using a typical coordinate system to coordinate system constraint. All types of assembly constraints are supported.

The keyword 'ASSEMBLE' means to start the assembly instructions. The keyword 'THIS' refers to the object the user is assembling. It can be a part, copy of a part, assembly, or a copy of an assembly. Some examples are family table instance of a bolt, bushing, gusset, clamp assembly, or a start assembly that gets copied and renamed automatically.

The next keyword 'PICK_SUB_ASM' means that the component will automatically get assembled inside of this assembly. So we can assemble parts inside another sub-assembly while working at the top level assembly. This keyword is optional and not required. Without it the component gets assembled to the active assembly.

Next line is the assembly constraints. The 'REF_CSYS' is an assembly reference from the assembly; typically this is selected through the GUI from the 'USER_SELECT' command as described in the GUI section.

The next reference 'MTG_PART_CSYS' is from the component. We use the command SEARCH_MDL_REF to automatically find this coordinate system from the part to be used.

Example: SEARCH_MDL_REF THIS CSYS PRT_CSYS_DEF MTG_PART_CSYS

Here we look for a coordinate system called "PRT_CSYS_DEF" and store it in the variable 'MTG_PART_CSYS' so we can use it for assembly purposes.

Applying features to models:

The following is a call to an udf (user defined feature). Udf's are collections of Pro/ENGINEER features. They can include a single feature or unlimited number of features.

To create udfs simply select Tools; Udf Library., Create, and follow the prompts.

This will store a *.gph file. We then call this *.gph file and pass it the required references.

Example:

CREATE_UDF <name of *.gph file w/o extension> PICK_MODEL

  UDF_REF CSYS REF_CSYS

END_CREATE_UDF

Explanation of this file:

CREATE_UDF - starts a call to the udf

<name of *.gph file w/o extension7gt; - this is the name of the *.gph file you want to apply

PICK_MODEL - is a reference from the object that is to receive the udf

UDF_REF - is the command to pass a reference to the udf

CSYS - is the prompt that you typed in when storing the udf - it is important to remember this prompt!

REF_CSYS - is the reference we are passing to the udf; typically comes from a user select or we can automatically find it using a search mdl ref command

END_CREATE_UDF - stops the call to the udf

You can create as many udfs as you like in a program and also apply these to several models from an assembly. For example, you can assemble a bolt then create the c'bore feature in one part, a clearance hole in another part, and finally a drill and tap feature in a third part all in the same program. Couple that with a FOR, or WHILE loop and you can apply a program many times over in a matter of seconds.



PTC Channel Advantage VAR - Platinum 2010 © Copyright 2009-2010 TriStar Inc. All rights reserved. All trademarks contained herein are the property of their respective owners.