Anda di halaman 1dari 65

NX 10.


CHUYÊN ĐỀ: CAM – Post Builder

Sinumerik controller support

View a topic

 Modify the mill method to support

 Sinumerik template posts CYCLE832
 Events and cycles for Sinumerik  Set _camtolerance for Cycle832
controllers in NX  Define the machine’s home position
 Procedures and settings coordinates
 Cycle832  ORIRESET and TRAORI
 Cycle95  Match the swivel data record of
 Add the Sinumerik 840D events in NX CYCLE800
 Machine home position

Sinumerik template posts

The following template posts support Sinumerik controllers for mills:

 Sinumerik_802D_3axis
 Sinumerik_828D
 Sinumerik_840D
 Sinumerik_840D_millturn

The Sinumerik_840D_lathe template post supports lathes:

Where do I find it?

Post Builder template posts

Application Post Builder

Menu File→New
Location in dialog box Controller group→Library list
Events and cycles for Sinumerik controllers in NX

Supported Sinumerik cycles are documented in Chapter 10 of the file

Working_with_OOTB_MACH_Simulation_Examples.pdf in your
...\MACH\samples\nc_simulation_samples folder.

Sinumerik Sets default settings including tolerance, high speed machining parameters,
840D five axis orientation parameters, and whether the feed rate is defined in a

Biên soạn:KS.Phan Văn Tú Page 1


You can add the Sinumerik 840D start event for:

 A single milling operation

 The lowest level program group in the Program view of the
Operation Navigator.

The Compressor option works only with linear motion. If the Compressor
option is set to On, the post will disable circular output, and output only
linear motion.

If you choose Swiveling in the Transformation option of the

Sinumerik_840D user-defined event, CYCLE800 is output and
transformation is turned off (TRAFOOF), otherwise TRANS/AROT is
output for coordinate translation and rotation.

You can set the number of significant digits for the output format, and the
appropriate rounding resolutions, with the custom commands
PB_CMD_reset_output_digits and PB_CMD_set_resolution.
DNC Header Makes the NC output file accessible to the Siemens Motion Control
Information System (MCIS) by appending the following comments and
values to the file before the % (start of tape) symbol:


Add the user-defined event to the top working program group under
NC_PROGRAM in your milling program.
Sinumerik Lets you call external subroutines. Used by MOM_program_control,
Program PB_CMD_MOM_program_control, PB_CMD_start_of_extcall_operation,
Control PB_CMD_end_of_extcall_operation, PB_CMD_end_of_extcall_program,
and other procedures.

Add the event to a program group for the Sinumerik_840D and

Sinumerik_828D template posts. Do not add it to operations.
Where do I find it?
Application Manufacturing

Biên soạn:KS.Phan Văn Tú Page 2


Menu Insert→Operation
Location in dialog
box Operation dialog box→Machine Control group→Edit (Start of Path
Procedures and settings


Set the post default settings (mills only) according to the Sinumerik version. If the
sinumerik_version is not set, the procedure returns without making any settings.

Interprets the On and Off parameters from the event dialog box and the controller version
to sets the appropriate values for variables.


Set the post default settings (802D_3axis) for Sinumerik version 7.


Sets the Sinumerik version. The default is value is V7.

Sinumerik version 6 and later support CYCLE832 high speed machining G code output.


To output CYCLE832 parameters, set PB_CMD_set_Sinumerik_version to V6 or V7.

V6 and V7 have different CYCLE832 codes, as shown in the following examples.

Output example differences
$MA_COMPRESS-POS_TOL[X]= _camtolerance*1.2
$MA_COMPRESS-POS_TOL[Y]= _camtolerance*1.2
$MA_COMPRESS-POS_TOL[Z]= _camtolerance*1.2
$MA_COMPRESS-POS_TOL[C]= _camtolerance*12
V5 $MA_COMPRESS-POS_TOL[A]= _camtolerance*12

Biên soạn:KS.Phan Văn Tú Page 3



 The Compressor, Smoothing, Feed Forward, and Transformation
options set the corresponding bit of the second parameter of CYCLE832.
 The last bit of the second parameter of CYCLE832 defines the machining


 The Compressor, Smoothing, Feed Forward, and Transformation

options do not affect the CYCLE832 output code.
 The second parameter of CYCLE 832 defines the machining method.

Note The machining method is set in the Mill Method dialog box. To open the Mill Method
dialog box, in an operation dialog box, in the Path Settings group, beside Method, click

Edit .

The NX turning processor supports output for the Siemens Sinumeric 840d’s CYCLE95 stock
removing cycle in the following operation types:


Biên soạn:KS.Phan Văn Tú Page 4


Cycle parameters are automatically mapped from NX CAM turning parameters. Knowledge of
specific output parameters is not required.

Note The IPW that is created by existing operations which are capable of CYCLE95 output is
used by subsequent operations. This IPW will be only an approximation of the actual
CYCLE95 results.

The Post Builder template post for the Siemens Sinumerik 840D Controller has been updated to
include support for CYCLE95.

The contour definition for CYCLE95 is output in the form of a subprogram. You can output the
subprogram in one of these ways:

 In-line with the main program

 At the end of main program
 In a separate SPF file

On the shop floor, the machine operator can adjust a single line of code, for example to change
the cut depth per pass. To make the same change with conventional output, many lines of code
must be recalculated.

Where do I find it?

Application NX

Create or edit a turning operation of a type listed in the preceding

Prerequisite article.

Biên soạn:KS.Phan Văn Tú Page 5


Location in dialog
box Machine Control→Motion Output→Machine Cycle

Application Post Builder

Prerequisite Create or edit a SIEMENS — SinumeriK_840D_lathe post.

Location dialog Program & Tool Path→Custom

box Command→PB_CMD_init_cycle95_output
Add the Sinumerik 840D events in NX

1. In the ...\MACH\resource\user_def_event folder, remove the # from # INCLUDE


This also makes additional parameters, such as Top Dwell and Final Dwell, available in
the Cycle Parameters dialog box for Hole Making operations.

2. In an operation dialog box, in the Machine Control group, beside Start of Path Events,

click Edit .
3. In the User Defined Events dialog box, from the Events Available list, select
Sinumerik 840D.

4. Click Add new event .

5. In the Sinumerik 840D dialog box, specify the options you need, and click OK.

Consult your current Sinumerik manuals for explanations of the purpose and usage of
each option.

6. Click OK to close the User Defined Events dialog box.

7. Click OK to save the operation.

Modify the mill method to support CYCLE832

This procedure is for Sinumerik 840D version 6 or later

1. In an operation dialog box, in the Path Settings group, from the Method list, select the
appropriate method.

2. Next to Method, click Edit .

3. In the Mill Method dialog box, in the Path Settings group, click Edit .

Biên soạn:KS.Phan Văn Tú Page 6


4. In the Search Result dialog box, from the Matching Items list, select one of the
following options to support CYCLE832:
o OPD0_00021, roughing

Sample code output: CYCLE832 ( _camtolerance, 1112103)

o OPD0_00022, semi-finishing

Sample code output: CYCLE832 ( _camtolerance, 1112102)

o OPD0_00023, finishing

Sample code output: CYCLE832 ( _camtolerance, 1112101)

o OTHERS, prismatic

Sample code output: CYCLE832 ( _camtolerance, 1112100)

5. Click OK to close the Search Result dialog box.

6. Click OK to close the Mill Method dialog box.
7. Click OK to save the operation.

Set _camtolerance for Cycle832

For all versions, the default value of _camtolerance is the average of the Intol and Outtol values
defined in the operation. To output a different value for _camtolerance:

1. In NX, add the Sinumerik 840D UDE start event.

2. In the Sinumerik 840D dialog box, in the Tolerance group, select the User Defined
Tolerance Status checkbox.
3. In the User Defined Tolerance box, type the tolerance value that you want to use.
4. Click OK until the operation is saved.

Define the machine’s home position coordinates

To output the safe home position for your machine:

1. In the Post Builder application, click the Machine Tool tab.

2. Under Display Machine Tool, click General Parameters.
3. In the Home Position group, enter the appropriate X, Y, and Z values.
5. To change the output order of TRAORI and rotary angles, ORIRESET must output after
TRAORI. ORIRESET is available in Sinumerik software version V7.
6. In the template post, ORIRESET is output by the command PB_CMD_preset_angle.
7. Match the swivel data record of CYCLE800

Biên soạn:KS.Phan Văn Tú Page 7


8. The _TC parameter in CYCLE800 is the name of the swivel data record, and must
exactly match the swivel data record name for your machine.
9. To change the output, modify _TC in the CYCLE800 macro as shown.

Parameter Expression
_TC \―R_DATA\‖

10. The output would be similar to the following example.

11. CYCLE800(1,”R_DATA”,0,57,0.40,0,-45.0,0,0,0,0,-1)
12. If there is only one swivel data record, it could be blank as shown in the following
13. CYCLE800(1,"",0,57,0.40,0,–45.0,0,0,0,0,-1)
Machine home position

The template post outputs a return motion to the machine home position before a tool change,
after a tool change, and at the end of an operation. For example:

Note D is the Tool Adjust Register value set in the operation.

The default X, Y, and Z values for safe home position are:

 _X_HOME=999999.9
 _Y_HOME=999999.9
 _Z_HOME=999999.9

Legacy postprocessor conversion

View a topic

 Pre V3.0 XZC Simple Mill-Turn Posts

 Pre V3.4 Mill posts
 Pre V3.0 Linked Posts
 Pre V3.3 Lathe Posts
 Correct pre V2.0.2 XZC Mill and Simple
 Pre V3.1 multi-axis posts
Mill-Turn Posts

Pre V3.4 Mill posts

Preserving New IKS Parameters

In Post Builder 3.3 or earlier, custom commands such as PB_CMD_init_new_iks were used to
enable the new IKS functionality. Parameters specified in any of these custom commands are
extracted and preserved with the posts when saved in this version of Post Builder. Interactively,
these parameters are presented in the appropriate dialog boxes when a post is open. However, the
parameters are not preserved if the new IKS service was not enabled (mom_kin_iks_usage = 0)
in the custom command. Default values for the new IKS parameters are presented instead.

Biên soạn:KS.Phan Văn Tú Page 8


These legacy custom commands are no longer needed but are retained with the posts for your
reference. You can delete them manually.

Swapping Rotary Axes of Dual-Head Posts

The assignments of rotary axes in all dual-head 5-axis mill posts created before this version of
Post Builder were intentionally switched to accommodate certain short comings with the legacy
inverse kinematics solver. The rotary axes assignments are corrected when a post is saved with
this version of Post Builder.

Kinematic parameters for the 4th rotary axis are swapped with that of the 5th axis.

The custom command PB_CMD_revert_dual_head_kin_vars is provided for all 5-axis mill

posts and is used to swap the kinematic parameters of the dual rotary heads. Use this custom
command whenever the new IKS is disabled.

VNC of Dual Rotary Heads

Prior to NX 4, the NC axes assignment in a VNC file required a custom command. To convert
the file, manually edit the custom command.

Legacy Posts using ugpadvkins.dll

The new IKS service is disabled for dual-head mill posts using the ugpadvkins.dll shared library.
The kinematic parameters assigned for the dual rotary heads are swapped as described above.

Pre V3.3 Lathe Posts

The custom command PB_CMD_output_spindle used by any legacy lathe posts to output a
block for setting the maximum spindle speed requires the following entry:

if {$mom_spindle_maximum_rpm > 0} {
MOM_do_template spindle_max_rpm
proc PB_CMD_output_spindle { } {
global mom_spindle_mode
global spindle_is_out
global mom_spindle_maximum_rpm
if {![info exists spindle_is_out]} {
if {$mom_spindle_mode == "RPM"} {
MOM_force once M_spindle S G_spin
MOM_do_template spindle_rpm
} elseif {$mom_spindle_mode == "SFM" || $mom_spindle_mode == "SMM"} {

Biên soạn:KS.Phan Văn Tú Page 9


MOM_force once M_spindle S G G_spin

# The following line has been changed.
if {$mom_spindle_maximum_rpm > 0} {
MOM_do_template spindle_max_rpm
MOM_do_template spindle_css
set spindle_is_out 1
Pre V3.1 multi-axis posts

Axis Limit Violation Handling for a rotary axis specifies how the postprocessor behaves when
the system reaches a rotary axis limit. The options are:

 Warning outputs a message to the warning file, but takes no action to correct the axis
limit violation.
 Retract/Re-engage generates N/C codes that enable the machine-tool to:
o Retract to clearance geometry (plane, cylinder or sphere) at the retract feed rate.
o Reposition the rotary axis to a valid position if possible.
o Re-engage to a specified distance above the part at the approach feed rate.
o Feed to the previous position where it retracted from at the engage feed rate.
o Continue moving to the programmed destination.

Parameters for this control are specified in the custom command PB_CMD_init_rotary
under Program & Tool Path→Custom Command. You can modify the variables
mom_kin_retract_type, mom_kin_retract_distance and
mom_kin_reengage_distance to configure how this functionality behaves.

The parameter mom_kin_retract_plane has been replaced by mom_kin_retract_distance. The

parameter PLANE used as one of the options of mom_kin_retract_type in some pre-release
versions of v3.1 has been replaced by SURFACE. After you save your legacy posts in Post
Builder v3.1, unless you make changes in the custom command PB_CMD_init_rotary, the
value of mom_kin_retract_plane is transferred to mom_kin_retract_distance and PLANE is
automatically interpreted as SURFACE.

Pre V3.0 XZC Simple Mill-Turn Posts

The information in the custom commands PB_CMD_init_mill_turn and

PB_CMD_init_mill_xzc have been converted to dialog box options on the Machine Tool pages
and removed.

The custom commands PB_CMD_start_of_mill, PB_CMD_end_of_mill,

PB_CMD_start_of_turn and PB_CMD_end_of_turn have been converted into event handlers.
You can now edit these event handlers on the Linked Posts page.

Biên soạn:KS.Phan Văn Tú Page 10


Pre V3.0 Linked Posts

The custom command PB_CMD_init_multiple_post of all legacy posts has been converted to
dialog box options on the Linked Posts page and removed. The custom commands used to start
and end each head are converted into event handlers. You can now edit these event handlers on
the Linked Posts page.

Correct pre V2.0.2 XZC Mill and Simple Mill-Turn Posts

To correct existing XZC mill posts created in Post Builder version 2.0:

1. Create a new XZC mill post using the existing post as the controller post. Make sure the
new post has the same output units as the existing post.
2. Transfer your changes of the variables, if any, from the custom commands
PB_CMD_kin_mill_turn_initialize and PB_CMD_kin_mill_xzc_init to
PB_CMD_init_mill_turn and PB_CMD_init_mill_xzc respectively.
3. Add a line of code containing the return statement at the beginning of both
PB_CMD_kin_mill_turn_initialize and PB_CMD_kin_mill_xzc_init commands.
4. Examine and save the post.

Postprocessing your tool paths

Postprocessing overview

The NX Manufacturing application generates tool paths that are used to manufacture parts. A
tool path consists of the following:

 Information about tool motion, such as GOTO points, feed rates, and tool axis
 Instructions to the controller that are called events, for example, coolant conditions,
spindle control, and tool changes.

Each machine tool and controller combination has different requirements, for example, specific
M-codes and G-codes, and the sequence of G-codes that is permitted in a program line. This
information is not in the initial NX tool path.

Output files

The NX Post output file can be :

 Verified in NX with the Simulation Control Panel, which simulates machine tool motions
and material removal.
 Loaded to the controller and run on the shop floor.
 Fully simulated with the VNCK application, which uses the Siemens 840D controller’s
logic to generate motions, alarms, and so on. The machine tool must be equipped with the
Siemens Sinumerik 840D controller and VNCK must be configured by the machine tool

Biên soạn:KS.Phan Văn Tú Page 11


NX/Post Builder dialog box overview

Use the NX/Post Builder dialog box to do the following:

 Define a new post processor in the Create New Post Processor dialog box.
 Edit an existing post processor.
 Manage the available forms of help for the other dialog boxes.

The dialog box contains only a menu bar, toolbar, and a cue line. Other dialog boxes appear as
you perform tasks related to post processor definition.

Suggestions for your current task appear in the cue line in the NX/Post Builder dialog box.

Where do I find it?

Menu Start→All Programs→Siemens NX 8.0→Manufacturing Tools→Post Builder
Defining a new postprocessor

Use the New command in the Post Builder application to define the following:

 The name and description of your new post processor.

 The type of post to be created: Main Post or Units Only Subpost
 The default output units
 The type of machine tool for which the post is intended
 The controller information

You can also choose to enable the user defined event editor and user cycle editing by default
anytime the post is opened for edit.

Biên soạn:KS.Phan Văn Tú Page 12


Where do I find it?

Application Post Builder

Shortcut button New

Menu File→New
Defining and editing main post processors

The dialog box to define and edit a post processor shows the name of the currently open post
processor in its title bar.

The following main tabs are available:

Biên soạn:KS.Phan Văn Tú Page 13


Machine Tool Lets you display a generic view of the machine tool, set basic kinematic
parameters of the machine tool, and set or modify some basic controller
capabilities, such as whether to output circular records.
Program & Lets you add code blocks and words, set the format and sequencing for
Tool Path controller words, managed linked posts, and more.
N/C Data Lets you modify blocks, words, formats, and word formats; attach user
Definitions defined event files; and inherit user defined events from other posts.
Output Lets you manage listing file output and listing file content, attach units-
settings only subposts, and more.
Virtual N/C Lets you configure a virtual numeric controller. Output is compatible only
Controller with the Tcl-based machine tool driver, or MTD.

Where do I find it?

Application Post Builder

Toolbar NX/Post Builder→Open

NX/Post Builder→File→Open

Menu NX/Post Builder→File→Recently Opened Posts

Create New Post Processor dialog box OK

Defining and editing units-only subposts

Biên soạn:KS.Phan Văn Tú Page 14


The dialog box to define and edit a post processor shows the name of the currently open post
processor in its title bar.

Values from the main post are shown in blue boxes that cannot be changed in this dialog box.

Values for the units of the subpost appear in white boxes that you can modify.

The following main tabs are available:

Units Values default to standard conversions of values in the main post.

If your machine and controller manuals specify different values from the
automatically converted values, you can set them on this tab.
WORD Values for word formats are defaulted to the same number of digits, with a
shift in the decimal point.

For example, if the format is 4.4 in Inches, it is represented in this dialog

box as 9999.9999.

The metric format is automatically converted to 9999.999.

If your controller recognizes a different format for alternate units, you can
set it on this tab.
FORMAT Values for word formats are defaulted to the same number of digits, with a
shift in the decimal point.

This tab has formats for absolute coordinates, coordinates, and feed rates.

Biên soạn:KS.Phan Văn Tú Page 15


Where do I find it?

Application Post Builder

You must have a main post from NX 8 or later on which to

Prerequisite base the subpost.

Toolbar NX/Post Builder→Open

NX/Post Builder→File→Open

Menu NX/Post Builder→File→Recently Opened Posts

Biên soạn:KS.Phan Văn Tú Page 16


Create New Post Processor

dialog box OK
Create a mill-turn post

1. Create a new 2-axis lathe post.

2. Save the 2-axis lathe post using one of the following options:
o Save it as lathe_tool_tip in the folder where you intend to create your mill-turn
o Save it in your postprocessor folder, using a name of your choice.
3. Create a new mill post and select 3-Axis Mill-Turn (XZC).
4. In the mill post, on the Machine Tool tab, on the General Parameters page, under
Machine Mode, do one of the following:
o If you saved the 2-axis lathe post as lathe_tool_tip in the folder where you intend
to save your mill-turn post, select XZC Mill to automatically use the
lathe_tool_tip post.
o If you saved your lathe post in your postprocessor folder using a name of your
choice, select Simple Mill-Turn and click Select Name to navigate to your lathe
5. Complete your mill post and save it to the folder where you saved your lathe post.
6. In NX, on the Navigator toolbar, click Geometry
7. Make sure that all the lathe tool paths are in the MCS_SPINDLE group object.
8. Make sure that all the mill tool paths are in the MCS_MILL group object.
9. Postprocess your tool paths.
10. Customizing Post Builder
11. Post Builder allows you to customize the appearance of the dialogs. Work with the
following two files to make your customization changes.
12. ui_pb_resource.tcl
13. You can modify this file to change the default font sets, labels, messages and text strings
that appear throughout Post Builder. Only the system administrator should change this
file. This file resides in the POSTBUILD/app/ui directory.
14. ui_pb_user_resource.tcl
15. You can modify this file to overwrite the ui_pb_resource.tcl file. This file also resides in
the POSTBUILD/app/ui directory. You should copy this file to your home directory in
order to personally customize the appearance and behavior of Post Builder.
16. On Unix this directory is /users/log_name.
17. On Windows this directory is found by typing echo %homedrive%%homepath% from a
DOS command prompt.
18. The following example allows you to change the font appearance on your display, either
increase or decrease the size of the numbers in the file. Only change the value of the
numbers or the name of the browser.
19. You can change other features as well.
20. ########################################################################

Biên soạn:KS.Phan Văn Tú Page 17


22. ########################################################################
23. # Description
24. # This file defines personalized resources for the Post Builder.
25. #
26. ########################################################################
27. global gPB env Tcl_platform tixOption
28. #========================
29. # Font set specification
30. #========================
31. if {$tcl_platform(platform) == "windows"} \
32. {
33. set gPB(font) {ansi 8}
34. set gPB(font_sm) {ansi 6}
35. set gPB(bold_font) {ansi 8 bold}
36. set gPB(bold_font_lg) {ansi 10 bold}
37. set gPB(italic_font) {ansi 8 italic bold}
38. set gPB(fixed_font) {courier 8}
39. set gPB(fixed_font_sm) {courier 6}
40. }
Install your own language translation file

You can translate Post Builder into a language that is not installed with the software if you have
a language translation file. To install a new language:

1. In the POSTBUILD/msgs folder, copy one of the installed language files and rename it.
This example uses pb_msg_english.tcl.

Note Edit and save the file with unicode utf-8 encoding.

2. Define the label for your language. Add the following lines just below the language test:
3. #+++++++++++++++++++++++++++++++++++++++++++
4. # Define label in Unicode for this language
5. #+++++++++++++++++++++++++++++++++++++++++++
6. set gPB(my_language,LABEL) "my_label"
a. Replace my_language with the name of your language translation file. Use your
language file name as the locale name throughout the translation file.
b. Replace my_label with the label for your new language selection.

This label appears in the language list when you choose Options→Language.

7. To prevent Post Builder from using an incomplete translation file, replace return 1 with
return 0.
8. Replace every instance of mcset pb_msg_english with the name of your language
translation file.

Biên soạn:KS.Phan Văn Tú Page 18


9. Replace every English label with your translation.

10. Replace return 0 with return 1 when the file is ready to use.
11. Save the file with unicode utf-8 encoding.

Example of custom translation file modifications

if { [info exists gPB(LANG_TEST)] } {
# Define label in Unicode for this language
set gPB(my_language,LABEL) "My_label"
# Return "1" when this language file is ready to be deployed,
# otherwise return "0".
return 1
## Title
::msgcat::mcset my_language "MC(main,title,Unigraphics)" "Unigraphics"
::msgcat::mcset my_language "MC(main,title,UG)" "UG"
::msgcat::mcset my_language "MC(main,title,Post_Builder)" "My_title"
Modal Word Groups and mom Variables
MOM Variable Default Value Description
$mom_sys_cutcom_code(LEFT) 41 Cutcom Left
$mom_sys_cutcom_code(RIGHT) 42 Cutcom Right
$mom_sys_cutcom_code(OFF) 40 Cutcom Off
$mom_sys_cutcom_code($mom_cutcom $mom_sys_cutcom_code(L
_status) EFT)
XY Plane
$mom_sys_cutcom_plane_code(XY) 17
$mom_sys_cutcom_plane_code(ZX) 18 ZX Plane Code
$mom_sys_cutcom_plane_code(YZ) 19 YZ Plane Code
$mom_sys_cutcom_plane_code($mom_p $mom_sys_cutcom_plane_c Arc Plane
os_arc_plane) ode(XY) Code

Biên soạn:KS.Phan Văn Tú Page 19


Cutcom Plane
$mom_sys_cutcom_plane_code($mom_c $mom_sys_cutcom_plane_c
utcom_plane) ode(XY)
Tool Len
$mom_sys_adjust_code 43
Adjust Plus
Tool Len
$mom_sys_adjust_code_minus 44
Adjust Minus
Cancel Tool
$mom_sys_adjust_cancel_code 49
Len Adjust
IPM Feed Rate
$mom_sys_feed_rate_mode_code(IPM) 94
IPR Feed Rate
$mom_sys_feed_rate_mode_code(IPR) 95
FRN Feed
$mom_sys_feed_rate_mode_code(FRN) 93
Rate Mode
DPM Feed
$mom_sys_feed_rate_mode_code(DPM) 94
Rate Mode
Feed Rate
$mom_sys_feed_rate_mode_code($feed_ $mom_sys_feed_rate_mode Mode
mode) _code(IPM) (IPM/IPR/FRN
Spindle output
$mom_sys_spindle_mode_code(SFM) 96
Spindle output
$mom_sys_spindle_mode_code(RPM) 97
Spindle output
$mom_sys_spindle_mode_code($mom_s $mom_sys_spindle_mode_c
pindle_status) ode(RPM)
Cycle Retract
$mom_sys_cycle_ret_code(AUTO) 99
Cycle Retract
$mom_sys_cycle_ret_code(MANUAL) 98
$mom_sys_cycle_ret_code($mom_cycle_ $mom_sys_cycle_ret_code( Cycle Retract
retract_mode) MANUAL) (AUTO/MAN

Biên soạn:KS.Phan Văn Tú Page 20


$mom_sys_linear_code 1 Linear Move
$mom_sys_rapid_code 0 Rapid Move
$mom_sys_circle_code(CLW) 2 Interpolation
$mom_sys_circle_code(CCLW) 3 Interpolation
$mom_sys_circle_code($mom_arc_direct $mom_sys_circle_code(CL
ion) W)
$mom_sys_cycle_breakchip_code 73 Break Chip
$mom_sys_cycle_off 80 Cycle Off
$mom_sys_cycle_drill_code 81 Drill
$mom_sys_cycle_drill_dwell_code 82 Drill Dwell
$mom_sys_cycle_drill_deep_code 83 Drill Deep
$mom_sys_cycle_tap_code 84 Tap
$mom_sys_cycle_bore_code 85 Bore
$mom_sys_cycle_bore_drag_code 86 Bore Drag
$mom_sys_cycle_bore_dwell_code 89 Bore Dwell
$mom_sys_cycle_bore_no_drag_code 76 No Drag
$mom_sys_cycle_bore_back_code 87 Bore Back
$mom_sys_cycle_bore_manual_code 88 Bore Manual
Cycle Start
$mom_sys_cycle_start_code 79
Cycle Code
$mom_sys_cycle_reps_code x
$mom_sys_output_code(ABSOLUTE) 90 Absolute Mode
$mom_sys_output_code(INCREMENTA Incremental
L) Mode
$mom_sys_output_code($mom_output_ $mom_sys_output_code(AB Absolute/Incre
mode) SOLUTE) mental Mode
$mom_prefun Pre Function

Biên soạn:KS.Phan Văn Tú Page 21


Delay in
$mom_sys_delay_code(SECONDS) 4
$mom_sys_delay_code(REVOLUTIONS Delay in
) Revloutions
$mom_sys_delay_code($mom_delay_mo $mom_sys_delay_code(SEC
de) ONDS)
Spindle Max
$mom_sys_spindle_max_rpm_code 54
$mom_sys_reset_code 92
Position Reset
Output Unit
$mom_sys_unit_code(IN) 70
Output Unit
$mom_sys_unit_code(MM) 71
$mom_sys_unit_code($mom_output_unit Output Unit
) (Inch/Metric)
$mom_sys_return_code 28 Return Home
$mom_pos(0) Coordinate
$mom_cycle_feed_to_pos(0) Cycle Feed X
Rapid X
$mom_cycle_rapid_to_pos(0) Position in
Retract X
$mom_cycle_retract_to_pos(0) Position in
Clearance X
$mom_cycle_clearance_to_pos(0) Position in
$mom_tool_x_offset Tool X Offset
Return Home
$mom_sys_home_pos(0) 0
$mom_pos(1) Coordinate
$mom_cycle_feed_to_pos(1) Cycle Feed Y
Rapid Y
$mom_cycle_rapid_to_pos(1) Position in
Retract Y
Position in

Biên soạn:KS.Phan Văn Tú Page 22


Clearance Y
$mom_cycle_clearance_to_pos(1) Position in
$mom_tool_y_offset Tool Y Offset
Return Home
$mom_sys_home_pos(1) 0
$mom_pos(2) Coordinate
$mom_cycle_feed_to_pos(2) Cycle Feed Z
Rapid Z
$mom_cycle_rapid_to(2) Position in
$mom_cycle_retract_to_pos(2) Position in
Clearance Z
$mom_cycle_clearance_to_pos(2) Position in
$mom_tool_z_offset Tool Z Offset
Return Home
$mom_sys_home_pos(2) 0
$mom_pos(3) 4th Axis
$mom_pos(4) 5th Axis
$mom_out_angle_pos(0) 4th Axis Angle
$mom_out_angle_pos(1) 5th Axis Angle
$mom_pos(3) 4th Axis
$mom_pos(4) 5th Axis
$mom_out_angle_pos(0) 4th Axis Angle
$mom_out_angle_pos(1) 5th Axis Angle
$mom_pos_arc_center(0)- Start of Arc to
$mom_prev_pos(0) Center X-Axis
$mom_pos_arc_center(1)- Start of Arc to

Biên soạn:KS.Phan Văn Tú Page 23


$mom_prev_pos(1) Center Y-Axis

$mom_pos_arc_center(2)- Start of Arc to
$mom_prev_pos(2) Center Z-Axis
$mom_cycle_rapid_to_pos($mom_cycle_ Rapid Position
spindle_axis) in Cycle
$mom_arc_radius Arc Radius
$feed Feed Rate
Cycle Feed
$mom_spindle_speed Spindle Speed
Spindle Max
$mom_tool_number Tool Select
Tool Pre-
Tool Radius
$mom_cutcom_adjust_register 1
Tool Adjust
$mom_tool_adjust_register 1
Cancel Tool
$mom_sys_zero 0
Delay For
Cycle Dwell
$mom_p_cutcom_code Cutcom

Biên soạn:KS.Phan Văn Tú Page 24


Position in
Step Incr
Step Incr
$mom_q_cutcom_code Cutcom
$mom_sys_spindle_direction_code(CLW CLW Spindle
) Direction
$mom_sys_spindle_direction_code(CCL CCLW Spindle
W) Direction
$mom_sys_spindle_direction_code($mo $mom_sys_spindle_directio
m_spindle_direction) n_code(CLW)
$mom_sys_spindle_direction_code(OFF) 5 Spindle Off
Spindle Range
$mom_sys_coolant_code(MIST) 7 Coolant Mist
$mom_sys_coolant_code(ON) 8 Coolant On
$mom_sys_coolant_code(FLOOD) 8 Coolant Flood
$mom_sys_coolant_code(TAP) 8 Coolant Tap
Coolant Code
$mom_sys_coolant_code($mom_coolant $mom_sys_coolant_code(F
_status) LOOD)
$mom_sys_coolant_code(OFF) 9 Coolant Off

Biên soạn:KS.Phan Văn Tú Page 25


$mom_sys_optional_stop_code 1 Optional Stop
$mom_auxfun Aux Function
$mom_sys_program_stop_code 0 Stop Program
End Of
$mom_sys_end_of_program_code 2
$mom_sys_rewind_code 30
$mom_sys_tool_change_code 6 Tool Change
Improve postprocessing performance of Fanuc style posts

This example shows how to improve postprocessing performance of Fanuc style posts for four-
axis and five-axis machines.

1. Open a 4-axis or 5-axis post.

2. On the Program & Tool Path tab, click the Custom Command tab.
3. Click Import.
4. Select the POSTBUILD/pblib/custom_command/pb_cmd_activate_turbo_mode.tcl file
and click Open.
5. In the Import Custom commands from dialog box, click OK to import the command.
6. Click the Program tab.
7. In the Program Sequence Tree, select Program Start Sequence.
8. From the block list, select PB_CMD_activate_Fanuc_turbo_mode.
9. Click Add Block and drag the command to the Start of Program marker.

When you activate turbo mode, the turbo variables ^POS4 and ^POS5 represent the fourth and
fifth axis positions.

Biên soạn:KS.Phan Văn Tú Page 26


The machining cycle type maps the Sinumerik option VARI to the MOM variable

Programming Notes

ROP and APP are always zero in the template.

The MOM procedure MOM_load_lathe_thread_cycle_params supports cycle97 events in your

postprocessor when the Machine Cycle option is specified.

This procedure:

 Returns 1 if the Machine Cycle option is specified and all variables are set successfully.
 Returns 0 otherwise.

Call the procedure MOM_skip_handler_to_event to skip event handling until an event or motion
type that you specify is encountered during processing.

The following variables are available if you create similar user-defined threading cycles:

 mom_lathe_thread_clearance_start
 mom_lathe_thread_clearance_end
 mom_lathe_thread_root_line_start
 mom_lathe_thread_root_line_end

Why should I use it?

The post created by Post Builder using the Siemens 840D option has increased support for
Siemens controllers.

Biên soạn:KS.Phan Văn Tú Page 27


On the shop floor, the machine operator can adjust a single line of code, for example to change
the correct finishing allowance for the contour. To make the same change with conventional
output, you must recalculate many lines of code using NX Post.

Where do I find it?

Application Manufacturing

Prerequisite Create or edit a turning operation of a type listed in the preceding


Location in dialog
box Machine Control→Motion Output→Machine Cycle

Application Post Builder

Prerequisite Create or edit a SIEMENS — SinumeriK_840D_lathe post.

Location in dialog Program & Tool Path→Custom

box Command→PB_CMD_map_cycle97_param

Adding CAM attributes for shop documentation in the post

What is it?

You can now use a Tcl command to set an attribute on a CAM program or operation. You can
read these attributes in a shop documentation template file.

In Post Builder, the Tcl syntax for the command is

MOM_set_attribute <object_name> <attribute_title> <attribute information array>.

The attribute information array has predefined indices, VALUE, TYPE, and CATEGORY. You
must set the value (VALUE) to the value of the attribute, and the type (TYPE) to the NX
attribute type, typically "String". Optionally, you can set an attribute category (CATEGORY).

The shop documentation template format has not changed. To read an attribute, the format is
${mom_attr_<type><name>[<category>]}, where
<name> is the same as the attribute name that you assign in Tcl
[<category>] is an optional attribute category

Biên soạn:KS.Phan Văn Tú Page 28


In the shop documentation template file, use program attributes in the title section or in the table
section. Use operation attributes only in the table section.

A post created the attribute category POSTPROCESSOR_ADDED, two attributes, and values
for the two attributes.
Why should I use it?

You no longer have to create attributes for shop documentation manually. Your post processor
can add any values that it can obtain from MOM variables or calculate in Tcl.

Where do I find it?

Tcl code

Application Post Builder

Shop Documentation Templates

Application Excel

Post Builder Custom Commands

In this NX A to Z article, we are going to talk about writing custom commands in Post Builder.
Custom commands allow you to get just about whatever you want in your machine code file. We
all know that the graphical tools within Post Builder provide a great way to configure the
standard components of a postprocessor, but what about the non-standard stuff – that is what
custom commands are for. For an introduction to Post Builder, click here.

Biên soạn:KS.Phan Văn Tú Page 29



Postprocessors written for NX are written in a language called TCL (Tool Command Language).
TCL is a scripting language, meaning that it is not compiled, and it’s syntax resembles C. TCL is
a fairly straightforward language; however, it’s syntax can be troublesome. The link below is a
very good resource for learning TCL; however, the best method for writing TCL is to copy it
from an existing custom command that implements the same function you are trying to
implement and then change the variables and expressions as required. For example, if you are
trying to write and if…else loop, just find one in an existing custom command and change it as
required to suit your desired functionality. This will help to eliminate a lot of the headaches due
to syntax errors.
Manufacturing Output Manager (MOM)

Before you write custom commands, you first need to understand how NX communicates with
your postprocessor. When you postprocess a program from with NX, NX starts a program called
NX Post. The primary component of NX Post is the Manufacturing Output Manager (MOM).
MOM is described in the NX Help Documentation as follows:

The Manufacturing Output Manager (MOM) is the central core of the NX Post postprocessor
module. MOM converts tool paths from model files into manufacturing output (machine code) by
adding the required functions and data as described below:

 The Event Generator reads through the tool path data, extracts events and their
associated variable information, then passes the events to MOM for processing.
 MOM applies kinematics to the output then passes the event with its associated data to
the Event Handler.
 The Event Handler creates the event, processes it to determine the actions required, then
returns the data to MOM.
 MOM reads the Definition File to determine how to format the output for the machine
tool control.
 MOM writes the formatted output to the specified Output File as machine code.

So, essentially, MOM reads the tool path in NX and then feeds the tool path through the
postprocessor to generate the machine code.

In order to write custom commands, you have to intercept the information that MOM is sending
to the postprocessor and then manipulate it however you want and then send it to the machine
code file.

All of the information that MOM sends is in the form of MOM variables; furthermore, there are
Biên soạn:KS.Phan Văn Tú Page 30

built-in commands available for you to use in your custom command and these are called MOM
commands. You can see all of these variables and built-in commands and their descriptions by
clicking on the Utilities menu in Post Builder and select Browse MOM Variables. You will see
the window shown below.

The built-in commands start with an uppercase MOM and the variables with lowercase mom.
There are way too many built-in commands and variables to go through them. The approach that
we will use is to set out to do something specific with our postprocessor and then used the MOM
Variables browser to find the variables and built-in commands we need.

So the next step is to open our postprocessor and select the Custom Commands tab as shown

Biên soạn:KS.Phan Văn Tú Page 31


This is a postprocessor that comes with NX for a 5-axis table table mill. Most of the custom
commands that you see in the list are created by default when you create a new postprocessor.
Some are used by default in certain parts of the program and the rest are available should you
need them.

For example, the custom command shown below, PB_CMD_tool_change_force_addresses is put

into the tool change event by default when a new post is created. It uses the MOM_force built-in
command to force the output of the tool length compensation data.

Biên soạn:KS.Phan Văn Tú Page 32


Custom commands like PB_CMD_clamp_fourth_axis are driven by machine control events

in NX and do not appear in any tool path events. Custom commands like
PB_CMD_nurbs_initialize are not used by default and must be placed in an event marker after
the post has been created if they are to be used.

There is also a library of custom commands available to be imported into a postprocessor. If you
click Import you will see the list shown below.

Biên soạn:KS.Phan Văn Tú Page 33


There a lot of custom commands available and they are described in the Documentation under
Manufacturing->Post Builder->Program and Tool Path->Custom Command->Custom
Command Library.

So enough about all the custom commands that are already done, let’s write one of our own. It is
just a simple custom command to put name of the program at the start of the machine code file.
In Post Builder, click Create on the Custom Command tab and Post Builder will create a copy of
whatever custom command you have selected as shown below.

Biên soạn:KS.Phan Văn Tú Page 34


So delete all the code and rename the custom command PB_CMD_program_name. Now we
need a variable that comes from NX with the name of the program and a built in command that
will output the name to the machine code file. If you open the MOM Variables Brower and
search program name, you will see that mom_group_name is the variable that we want and if you
set the search category to MOM Command and search for output, you will see that
MOM_output_literal is the build in command that we want.

So in our Custom command, we type

global mom_group_name

MOM_output_literal “Program Name: $mom_group_name”

Biên soạn:KS.Phan Văn Tú Page 35


The first line is a variable declaration. We are declaring the variable mom_group_name and the
global statement indicates the scope of the variable. The global scope is the entire MOM process,
meaning that if there is already a variable with the name mom_group_name that exists anywhere
in the MOM process, we will be accessing that variable. It also means that if we change the
variable, it will be changed for the entire MOM process until it is changed again by MOM. So
essentially we are grabbing the mom_group_name variable from MOM and writing it out the
machine code file. The $ in the second line is a syntax character – it indicates that the word that
follows is a variable name and substitutes the variables value into the output.

This is shown below

Then we place this custom command in the Program Start Sequence as shown below

Biên soạn:KS.Phan Văn Tú Page 36


Then post a program and this is what you get

Biên soạn:KS.Phan Văn Tú Page 37


That’s it. Remember, your best bet is to find an existing custom command that does something
similar to what you want and start changing it to get what you want. We’ll talk about debugging
custom commands in a future article.

Introduction to Post Builder

Continuing with the CAM theme, I am going to introduce Post Builder in this NX A to Z article.
A postprocessor is probably the first customization that everyone does when they get NX CAM,
simply because without a good postprocessor, your CAM programs are useless. Fortunately, NX
comes with a graphical postprocessor editing tool called Post Builder. Furthermore, there are
hundreds of postprocessors available between those that come with NX and those that are
available for download from GTAC.

The Post Builder Interface

If you go to the folder in the Start->All Programs->UGS NX 7.5->Manufacturing Tools and

click on Post Builder, you will see a command prompt pop up and go through some licensing
stuff and then if you have a valid license, you will see the window below come up after
PostBuilder has loaded.

From here you can create a new postprocessor or open an existing one for editing. A

Biên soạn:KS.Phan Văn Tú Page 38


postprocessor is a combination of three files, the tcl file that contains the logic for the post, the
def file that contains the format definitions and the pui file that contains the information used by
Post Builder to display the postprocessor through the graphical interface. The pui file is the one
you select when opening a postprocessor. Shown below are the files for some of the
postprocessors that come with NX.

As you can see, there are some generic posts as well as some machine/controller specific posts.
Since we are not going to be getting into any specific type of postprocessor, I will choose to
create a new 3 axis mill postprocessor and use that to introduce Post Builder. So, click New and
you will see the dialog below.

Biên soạn:KS.Phan Văn Tú Page 39


Give your post a name and a description and click OK and Post Builder will start as shown

Biên soạn:KS.Phan Văn Tú Page 40


The Post Builder interface is set up using tabs. As you can see, the main tabs are Machine Tool,
Program & Tool Path, NC Data Definitions, Output Settings, and Virtual NC Controller. I will
go through each of them briefly.

The Machine Tool tab is used for specifying the parameters and configuration of your machine.
Axis limits, feed rates, home position and for 4 and 5 axis mills, you specify the rotary axis
labels and configuration on this tab.

The Program & Tool Path tab is where the meat of the postprocessor is. This is where you
specify the NC blocks that make up each section of your program. As you can see, there is a
subset of tabs for the Program & Tool Path tab. The first is the Program tab and is shown below.
The Program tab is where you arrange the blocks for each section of your program. In the figure
below, you would select a block from the drop-down that says New Block and then you would
drag it where you want in the list of blocks that make up the Start of Program section. Each item
in the tree view on the left presents more sections of the program where you can add blocks.

Biên soạn:KS.Phan Văn Tú Page 41


The G Codes and M Codes tabs allow you to specify which codes control which functions on
your machine. The G Codes tab is shown below and the M Codes tab is the same.

Biên soạn:KS.Phan Văn Tú Page 42


The Word Summary tab shows the definitions and the formatting for each word in the
postprocessor. It provides a means for quickly reviewing all of the words in the postprocessor. It
isn’t a good idea to make changes to the formatting on this tab because the format of each word
is determined by its format definition, which you define on the N/C Data Definitions tab. If you
start changing to format for a word on the Word Summary tab, you will see other words change
as well because they have the same format definition, but the only way to know what format
definition is assigned to each word is through the N/C Data Definitions tab.

Biên soạn:KS.Phan Văn Tú Page 43


You use the Word Sequencing tab to specify the order in which words are arranged in the blocks.
Most machines require the words to be in a specific order and you control this through the Word
Sequencing tab. The Word Sequencing tab is shown below.

Biên soạn:KS.Phan Văn Tú Page 44


The Custom Command tab is used for writing code to do things that are not typically part of a
post processor. Post Builder is built on a scripting language called TCL and you can write TCL
scripts to do just about anything with Post Builder. There are quite a few custom commands that
come with Post Builder that you can import into a postpocessor for things like a tool list or
enabling helical outputs, etc.

The linked posts tab is used for selecting other posts that you need to link to the post you are
working on. This is primarily when you have a mill turn machine so that you can link a mill post
with a lathe post – this is how you create the postprocessor for a mill turn machine. Because the
machine has different sets of kinematics, it requires multiple postprocessors.

The Macro tab is used for creating and storing expressions that can be used throughout the

The N/C Data Definitions tab is where you define the blocks and words and their formats. The
Block tab is shown below. You create blocks by putting dragging words from the Add Word drop

Biên soạn:KS.Phan Văn Tú Page 45


down. You can assign a name to the block in the tree view on the left and then you can add the
block to different sections of your program from the Program & Tool Path tab.

The Word tab is where you assign the format, the limiting values and the modality to the words.
The Word tab is shown below

Biên soạn:KS.Phan Văn Tú Page 46


The Format tab is where you define the formats for the words. Things like the number of digits
and whether or not to include leading or trailing zeros for numeric formats. The Format tab is
shown below.

Biên soạn:KS.Phan Văn Tú Page 47


The Other Data Elements tab is used to define things like the sequence numbering, the operator
message start and end characters and you can also specify a custom user defined events file you
have one. The Other Data Elements tab is shown below.

Biên soạn:KS.Phan Văn Tú Page 48


The Output Settings tab has two sub-tabs. The Listing File tab allows you to specify whether or
not you want a listing file generated with the NC program and set some options for the listing
file. The Other Options tab allows you to specify the file extension for the postprocessor and a
few other things. One thing of note is the Review Tool. Activating the Review Tool is a very
good way to debug your postprocessor when you are not getting the output you need. The Post
Files Preview tab allows you to see your postprocessor files before and after the changes you
have made. The Other Options tab is shown below.

Biên soạn:KS.Phan Văn Tú Page 49


The Virtial N/C Controller thab is used for creating files that are used for running a
postprocessor driven machine tool simulation. You first select to Create the Virtual N/C
Controller and the you specify the paramters and options needed to simulate how your machine
functions. The Virtual N/C Controller Configuration tab is shown below.

Biên soạn:KS.Phan Văn Tú Page 50


That is Post Builder in a nutshell. Stay tuned for more articles on how to actually write

Dave Holland

Creating a 5-Axis Mill Postprocessor

In this NX A to Z article, we are essentially going to talk about what the differences are between
a typical 3 axis mill postprocessor and a 5 axis mill postprocessor. We are going to use the
generic 5-axis table-table postprocessor that comes with NX.

Machine Configuration

So, fire up Post Builder and open m5actt.ui. This is one of the postprocessors that comes with
NX and if you installed NX in the default directory, it will be in C:\Program Files\UGS\NX
7.5\MACH\resource\postprocessor. The m5actt stands for mill, 5-axis, A and C are the rotational

Biên soạn:KS.Phan Văn Tú Page 51


axes and it is a table-table machine.

The General Parameters page doesn’t have anything specific to a 5-axis machine, so we will start
with the Fourth Axis page. By the way, you decide the type of machine (table-table, head-table,
etc.) when you create the postprocessor.

On the Fourth Axis page, other than the standard rotary axis settings, the important setting is the
Machine Zero To 4th Axis Center. Typically, this is set to 0, 0, 0 and the G54 (or whatever offset
you’re using) on the machine is located where the rotational axes intersect (keep in mind the
Home Position on the General Parameters page will not be zero in this case). So if you have an
A, C table-table machine, then G54 correlates to the point where the A and C axes of rotation
intersect. The axes of rotation will not intersect perfectly, and most machines specify the distance
between the axes of rotation and you put this number in the 4th Axis Center to 5th Axis Center
setting on the Fifth Axis page as shown below. You will only have one value, so if your 4th axis
rotates about X and your 5th axis rotates about Z, then you would put the 4th axis to 5th axis

Biên soạn:KS.Phan Văn Tú Page 52


distance in Y.

The last thing that you have to do configuration wise is specify the axis leaders and the planes of
rotation. You do this by clicking Configure on the Fourth Axis or Fifth Axis page (both buttons
bring up the same dialog) and setting the configuration options as shown below.

Biên soạn:KS.Phan Văn Tú Page 53


One thing to note, if one of your axes does not rotate in one of the principal planes, you would
select Other in the Plane of Rotation menu and then punch in the IJK components for the plane

Program Settings

For the most part, all you have to change in the program is add the 4th and 5th axis leaders to the
blocks where you want them to move. So if you have a block in the Program Start Sequence that
homes everything, makes sure the A and C axes are in the block. Obviously, you also need the
rotary axes in the Linear Move and Rapid Move blocks as shown below.

Biên soạn:KS.Phan Văn Tú Page 54


In the Machine Control section of the Program, you need to set up the Feedrates. So click on
Feedrates and you’ll see the dialog below. Typically, you’ll use IPM for the Linear Only moves
and FRN for everything else. You use FRN (inverse time federate) because if you use IPM or
DPM and the move contains both linear and rotary movement, then the speed will be tied to
either the rotary or linear axes and you will not get the desired surface speed – not only that, but
the surface speed could potentially change during the ratio of linear movement to rotary
movement changes. Using FRN ensures a constant surface speed.

Biên soạn:KS.Phan Văn Tú Page 55


One last thing unique to a 4 or 5 axis post is the clamp/unclamp commands. These are not
included in the list of standard M codes and therefore are Custom Commands. So if you look at
the Custom Commands, you’ll see Clamp Unclamp for each rotary axis. Often times, the
Unclamp command is required by the machine in order to move a rotary axis while cutting. You
just need to check the Custom Commands to make sure the M codes are right.

Biên soạn:KS.Phan Văn Tú Page 56


That's it. Have fun.

Creating a Mill-Turn Postprocessor Part 1

This is the first in a series of articles on creating a Mill Turn postprocessor. In this article, I will
go through creating the postprocessors and configuring the Mill Turn NX CAM template file. In
future articles, I will address customizing the postprocessor.

Mill-Turn CAM Template

The first thing that we need to do is set up the NX CAM Configuration file and the NX CAM
template part. Refer to Creating a Custom NX Cam Configuration File and Creating a Custom
CAM Template for instructions on how to do this. The only additional thing you need to do in
you NX CAM Template part is assign the different postprocessors to the different methods in
your NX CAM file. So for our example, we are going to have 3 postprocessors, one lathe and
two mills. Therefore, at the very least, we need three methods in or NX CAM file; however, you

Biên soạn:KS.Phan Văn Tú Page 57


would probably have more because you have would rough, semi-finish and finish methods for
both milling and turning as well as methods for Polar coordinates and XYZC coordinates

As always, the easiest way to customize NX CAM is to copy the default file into the appropriate
directory in your custom CAM directory and then change it. So, copy MillTurn_Exp.prt from the
default template_part directory and put in your custom template_part directory, rename it to
whatever you want and add it to your custom CAM configuration file. Then open it and select
the Method view for the Operation Navigator – it should look like what you see below.

As you can see, there are both Mill methods (which include the drill methods) and lathe methods.
These methods include settings such as tolerances, stock and feedrates just like any other
methods; however, they also include Start Events that alert the postprocessor as to which

Biên soạn:KS.Phan Văn Tú Page 58


postprocessor each operation needs to use. So you create all your CAM operations and assign
them to the appropriate method groups and then before each operation, NX alerts the
postprocessor as to what type of operation is coming next and which postprocessor is needed.
Right click on one of the methods and go to Object and then Click Start Events and you should
see a screen like the one below. I chose a Lathe method, so the head name passed with the event
is TURN. This tells the postprocessor that it needs to be using the postprocessor associated with
TURN. For the milling methods, the head names that we need are xhead and zhead (these
correspond with the default postprocessor that we will be looking at). This particular CAM
template is intended for a machine that only has milling capabilities in the Z axis; therefore, we
are going to need to add/edit the milling methods.

So, copy all of the milling methods and then rename them so that half of them have ZHEAD on
the end and the other half have XHEAD on the end. Then you need to edit the start event for
each of them and put in the appropriate head name. You can also delete the Live Tooling Mode
event because we are looking at a machine with only one turret. The Start Events for one of the
ZHEAD method is shown.

Biên soạn:KS.Phan Văn Tú Page 59


That’s it for the CAM template. Now you can create a CAM file with your template and start
putting in turning and milling ops and all you have to do is make sure they are in the right
method and the right MCS (depending on how you set up the coordinate systems on the

Mill-Turn Postprocessor

Now let’s look at the postprocessor. Again, we will start with a postprocessor that is supplied
with NX and take a look at how it works with the CAM template. If you take a look in default
postprocessor directory, you will see a few mill turn postprocessors. Some are generic (they just
say millturn) and some are machine specific (like the Mori NL1500Y). We are going to look at
millturn_4axis_mill, so open up Postprocessor Builder and select Open and then browse to the
default postprocessor directory and select the millturn_4axis_mill postprocessor and you should
see the screen below.

Biên soạn:KS.Phan Văn Tú Page 60


So, essentially, this is a 4 axis mill postprocessor. The only difference is on this screen, you have
the option of specifying whether this is a Simple Mill-Turn or an XZC Mill, you specify whether
or not the machine can position the tool in the Y-axis and whether or not your machine can take
Cartesian coordinates. For this particular postprocessor, we have an Initial Spindle Axis of Z and
the Default Coordinate mode is Polar and the Machine Mode is XZC Mill. If your machine is
essentially a lathe with live tooling, then you could select Simple Mill-Turn and choose
lathe_tool_tip for the lathe postprocessor and then the postprocessor uses the operation type to
switch between your mill postprocessor and your lathe postprocessor, so you don’t need the Start

Biên soạn:KS.Phan Văn Tú Page 61


Events in the Methods in the NX CAM template part; however, because we are also going to
configure a postprocessor for milling with tools perpendicular to the spindle, we need to check
XZC Mill and link 3 postprocessors together.

In milling mode, an XYZC Mill-Turn machine is just a XYZ Mill with a 4th axis mounted on the
table, so if you click Rotary Axis in the tree view, you see the same options that you would for a
4 axis mill. The options set below are typical.

Because we did not select the Simple Mill-Turn option, we need to go to the Linked
Postprocessors tab on the Program & Tool Path tab and specify the lathe postprocessor that we
want to use as well as the postprocessor that will be used for milling perpendicular to the lathe

Biên soạn:KS.Phan Văn Tú Page 62


spindle axis. This is shown below. Whenever you have linked postprocessors, one postprocessor
is the master postprocessor. The master postprocessor is the postprocessor that is used for the
Start of Program sequence and is also the only postprocessor that has linked postprocessors
specified. So the millturn_4axis_mll postprocessor is the master postprocessor and the
lathe_tool_tip and millturn_side_spindle postprocessors are the linked postprocessors

The lathe_tool_tip postprocessor is just a basic lathe postprocessor. Remember, the Start of

Biên soạn:KS.Phan Văn Tú Page 63


Program and End of Program event sequences are taken from the master postprocessor, which in
this case is the millturn_4axis_mill postprocessor. The few settings on the Machine Tool –
General Parameters tab and the linked postprocessors are all that set this postprocessor apart
from any other 4 axis mill postprocessor.

Let’s take a quick look at the millturn_side_spindle postprocessor. As you can see, the settings
are the same as those for the millturn_4axis_mill postprocessor, except the Initial Spindle Axis is
now +X and the Position in Y-Axis setting is no longer greyed out. If your machine can position
in Y, then check this box.

Other than that, this postprocessor is just a 4 axis mill postprocessor. It does not have any linked
postprocessors, because only the master postprocessor has linked postprocessors.

So, NX essentially comes with enough postprocessors and CAM templates to cover the majority
of mill-turn machines out there, you may just have to do a little tweaking to get what you want.

Biên soạn:KS.Phan Văn Tú Page 64


The millturn_3axis_mill postprocessor covers a simple lathe with live tooling where the tooling
axis is Z only. The millturn_4axis_mill postprocessor covers a mill-turn machine like we have
been talking about here. The millturn_baxis_5axis postprocessor covers a mill-turn machine with
a milling head that rotates in the XZ plane. This postprocessor is simply a 5 axis milling
postprocessor that is linked to a lathe postprocessor. Then, if you have multiple spindles and
multiple turrets, you just link additional postprocessors to the master for all the different sets of

Next time, we will take a closer look at the postprocessors that we talked about here and
customize them a little.

Biên soạn:KS.Phan Văn Tú Page 65