Documente Academic
Documente Profesional
Documente Cultură
0 POST BUIDER
View a topic
Sinumerik_802D_3axis
Sinumerik_828D
Sinumerik_840D
Sinumerik_840D_millturn
Sinumerik Sets default settings including tolerance, high speed machining parameters,
840D five axis orientation parameters, and whether the feed rate is defined in a
variable.
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.
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:
;HEADER-START
;NODENAME=$mom_dnc_machine_name
;NCDATANAME=$mom_dnc_program_name
;NCDATATYPE=$mom_dnc_data_type
;VERSION=$mom_dnc_version_number
;RELEASEID=$mom_dnc_release_number
;DEVELNAME=$mom_dnc_user_name
;HEADER-END
;NC-START
%
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.
Menu Insert→Operation
Location in dialog
box Operation dialog box→Machine Control group→Edit (Start of Path
Events)
Procedures and settings
PB_CMD_set_Sinumerik_default_setting
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.
PB_CMD_set_Sinumerik_V7_default_setting
PB_CMD_set_Sinumerik_Version
Sinumerik version 6 and later support CYCLE832 high speed machining G code output.
Cycle832
Sinumerik
Output example differences
version
FGREF[C]=10
FGREF[A]=10
$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
NEWCONF
FFWON
UPATH
SOFT
COMPCURV
G642
FGREF[C]=10
FGREF[A]=10
CYCLE832(_camtolerance,112100)
V6
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
method.
CYCLE832(_camtolerance,0,1)
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 .
Cycle95
The NX turning processor supports output for the Siemens Sinumeric 840d’s CYCLE95 stock
removing cycle in the following operation types:
FACING ROUGH_BACK_BORE
ROUGH_TURN_OD FINISH_TURN_OD
ROUGH_BACK_TURN FINISH_BORE_ID
ROUGH_BORE_ID FINISH_BACK_BORE
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:
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.
Location in dialog
box Machine Control→Motion Output→Machine Cycle
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.
Consult your current Sinumerik manuals for explanations of the purpose and usage of
each option.
1. In an operation dialog box, in the Path Settings group, from the Method list, select the
appropriate method.
3. In the Mill Method dialog box, in the Path Settings group, click Edit .
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
o OPD0_00022, semi-finishing
o OPD0_00023, finishing
o OTHERS, prismatic
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:
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\‖
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:
SUPA G0 Z=_Z_HOME D0
SUPA G0 X=_X_HOME Y=_Y_HOME C=_C_HOME A=_A_HOME D1
Note D is the Tool Adjust Register value set in the operation.
_X_HOME=999999.9
_Y_HOME=999999.9
_Z_HOME=999999.9
View a topic
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.
These legacy custom commands are no longer needed but are retained with the posts for your
reference. You can delete them manually.
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.
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.
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.
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
}
Example
#=============================================================
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"} {
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 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.
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.
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
orientation.
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
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
manufacturer
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.
Use the New command in the Post Builder application to define the following:
You can also choose to enable the user defined event editor and user cycle editing by default
anytime the post is opened for edit.
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.
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.
NX/Post Builder→File→Open
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.
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.
NX/Post Builder→File→Open
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.
(XY/ZX/YZ)
Cutcom Plane
$mom_sys_cutcom_plane_code($mom_c $mom_sys_cutcom_plane_c
Code
utcom_plane) ode(XY)
(XY/ZX/YZ)
G_adju
st
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
G_feed
IPM Feed Rate
$mom_sys_feed_rate_mode_code(IPM) 94
Mode
IPR Feed Rate
$mom_sys_feed_rate_mode_code(IPR) 95
Mode
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
)
G_spin
Spindle output
$mom_sys_spindle_mode_code(SFM) 96
(CSS)
Spindle output
$mom_sys_spindle_mode_code(RPM) 97
(RPM)
Spindle output
$mom_sys_spindle_mode_code($mom_s $mom_sys_spindle_mode_c
Mode
pindle_status) ode(RPM)
(RPM/SFM)
G_retur
n
Cycle Retract
$mom_sys_cycle_ret_code(AUTO) 99
(Auto)
Cycle Retract
$mom_sys_cycle_ret_code(MANUAL) 98
(MANUAL)
$mom_sys_cycle_ret_code($mom_cycle_ $mom_sys_cycle_ret_code( Cycle Retract
retract_mode) MANUAL) (AUTO/MAN
UAL)
G_moti
on
$mom_sys_linear_code 1 Linear Move
$mom_sys_rapid_code 0 Rapid Move
Circular
$mom_sys_circle_code(CLW) 2 Interpolation
CLW
Circular
$mom_sys_circle_code(CCLW) 3 Interpolation
CCLW
Circular
$mom_sys_circle_code($mom_arc_direct $mom_sys_circle_code(CL
Interpolation
ion) W)
(CLW/CCLW)
$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
Code
Cycle Code
$mom_sys_cycle_reps_code x
Representative
G_mod
e
$mom_sys_output_code(ABSOLUTE) 90 Absolute Mode
$mom_sys_output_code(INCREMENTA Incremental
91
L) Mode
$mom_sys_output_code($mom_output_ $mom_sys_output_code(AB Absolute/Incre
mode) SOLUTE) mental Mode
G
$mom_prefun Pre Function
Delay in
$mom_sys_delay_code(SECONDS) 4
Seconds
$mom_sys_delay_code(REVOLUTIONS Delay in
4
) Revloutions
Delay
$mom_sys_delay_code($mom_delay_mo $mom_sys_delay_code(SEC
(Seconds/Revo
de) ONDS)
lutions)
Spindle Max
$mom_sys_spindle_max_rpm_code 54
RPM
Absolute
$mom_sys_reset_code 92
Position Reset
Output Unit
$mom_sys_unit_code(IN) 70
(Inch)
Output Unit
$mom_sys_unit_code(MM) 71
(Metric)
$mom_sys_unit_code($mom_output_unit Output Unit
$mom_sys_unit_code(IN)
) (Inch/Metric)
$mom_sys_return_code 28 Return Home
X
$mom_pos(0) Coordinate
$mom_cycle_feed_to_pos(0) Cycle Feed X
Rapid X
$mom_cycle_rapid_to_pos(0) Position in
Cycle
Retract X
$mom_cycle_retract_to_pos(0) Position in
Cycle
Clearance X
$mom_cycle_clearance_to_pos(0) Position in
Cycle
$mom_tool_x_offset Tool X Offset
Return Home
$mom_sys_home_pos(0) 0
X
Y
$mom_pos(1) Coordinate
$mom_cycle_feed_to_pos(1) Cycle Feed Y
Rapid Y
$mom_cycle_rapid_to_pos(1) Position in
Cycle
Retract Y
$mom_cycle_retract_to_pos(1)
Position in
Cycle
Clearance Y
$mom_cycle_clearance_to_pos(1) Position in
Cycle
$mom_tool_y_offset Tool Y Offset
Return Home
$mom_sys_home_pos(1) 0
Y
Z
$mom_pos(2) Coordinate
$mom_cycle_feed_to_pos(2) Cycle Feed Z
Rapid Z
$mom_cycle_rapid_to(2) Position in
Cycle
Retract
$mom_cycle_retract_to_pos(2) Position in
Cycle
Clearance Z
$mom_cycle_clearance_to_pos(2) Position in
Cycle
$mom_tool_z_offset Tool Z Offset
Return Home
$mom_sys_home_pos(2) 0
Z
fourth_
axis
$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
fifth_ax
is
$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
I
$mom_pos_arc_center(0)- Start of Arc to
$mom_prev_pos(0) Center X-Axis
J
$mom_pos_arc_center(1)- Start of Arc to
e
Retract
$mom_cycle_retract_to_pos($mom_cycle
Position in
_spindle_axis)
Cycle
cycle_st
ep1
Step Incr
$mom_cycle_step2
Modifier
cycle_st
ep
Step Incr
$mom_cycle_step1
Value
Q_cutc
om
$mom_q_cutcom_code Cutcom
E
Thread
$mom_thread_increment
Increment
M_spin
dle
$mom_sys_spindle_direction_code(CLW CLW Spindle
3
) Direction
$mom_sys_spindle_direction_code(CCL CCLW Spindle
4
W) Direction
Spindle
$mom_sys_spindle_direction_code($mo $mom_sys_spindle_directio
Direction
m_spindle_direction) n_code(CLW)
(CLW/CCLW)
$mom_sys_spindle_direction_code(OFF) 5 Spindle Off
$mom_sys_spindle_range_code($mom_s
Spindle Range
pindle_range)
M_cool
ant
$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
(FLOOD/MIS
_status) LOOD)
T/ON..)
$mom_sys_coolant_code(OFF) 9 Coolant Off
M
$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
program
Rewind
$mom_sys_rewind_code 30
Program
$mom_sys_tool_change_code 6 Tool Change
N
Sequence
$mom_seqnum
Number
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.
When you activate turbo mode, the turbo variables ^POS4 and ^POS5 represent the fourth and
fifth axis positions.
The machining cycle type maps the Sinumerik option VARI to the MOM variable
mom_turn_cycle97_machining_type.
Programming Notes
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
The post created by Post Builder using the Siemens 840D option has increased support for
Siemens controllers.
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.
Location in dialog
box Machine Control→Motion Output→Machine Cycle
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.
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
<type> is PROGRAMVIEW or OPER
<name> is the same as the attribute name that you assign in Tcl
[<category>] is an optional attribute category
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.
Tcl code
Application Excel
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.
TCL
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.
http://tmml.sourceforge.net/doc/tcl/index.html
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
NX 10.0 POST BUIDER
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
below.
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.
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.
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.
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.
global mom_group_name
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.
Then we place this custom command in the Program Start Sequence as shown below
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.
From here you can create a new postprocessor or open an existing one for editing. A
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.
Give your post a name and a description and click OK and Post Builder will start as shown
below.
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.
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.
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.
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.
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
postprocessor.
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
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
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.
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.
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.
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.
That is Post Builder in a nutshell. Stay tuned for more articles on how to actually write
postprocessors.
Dave Holland
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
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
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.
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
normal.
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.
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.
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.
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.
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
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
potentially.
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
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.
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
machine).
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.
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
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
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
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.
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
kinematics.
Next time, we will take a closer look at the postprocessors that we talked about here and
customize them a little.