Showing results for 
Search instead for 
Did you mean: 

Tool orientation axis in NX and post builder


Hi all!

When I create manufacturing in CAM Express I do positioning of MCS and WCS as it would be on real machine. Then I create operation. And then tool for the operation. And when I create a tool the new coordinate system linked with that tool displayed. It have axes XC, YC, ZC. I don't understand what this coordinate system stand for. I can rotate and shift it relatively to MCS. BUT the direction of the tool and spindle always coincides with ZC axis of this coordinate system. And i don't see any way to change this.

And so i have BIG problem with mom_cycle_spindle_axis, mom_mill_spindle_axis and mom_spindle_axis.

I have 5-axis post. As i understand, mom_pos(3) and mom_pos(4) is the angles of tool axis in machine coordinate system (MCS). And they are right. And I use they in commands for initial orientation of spindle in machine. In OKUMA MULTUS this BT=xxx BA=xxx But in ALL OPERATIONS what i did irrespective of the  mom_pos(3) and mom_pos(4) i has:
mom_cycle_spindle_axis = 2,
mom_mill_spindle_axis = 2
 mom_spindle_axis(0) = 0
mom_spindle_axis(1) = 0
mon_spindle_axis(2) = 1.

And I think that this is because the tool is always oriented along ZC in CAM Express.

So all the command that utilize this variables, e.g. PB_CMD_set_principal_axis or PB_CMD_set_cycle_plane give me improper results.

As I can see in the NX/Post Review Tool at the "Start of path" section and even at begining of "Initial Move" section this variables have proper values. But at the end of "Initial Move" section they have improper values. Although nowhere in this section i did not commands for they redefinition. Where they redefined?

What i must do in this situation? I must set this variables to proper values by myself in "Initial Move" event of post or there is some trick?




Re: Tool orientation axis in NX and post builder


I am not sure I understand what you are saying - but here are a couple notes or opinions:


1.) mom_tool_axis is an array that represents the tool axis in cl terms (relative to owning mcs.)

2.) All other variables (you mention) are affected by kinematics.

3.) mom_pos(3) and (4) are rotary positions to achieve the tool axis based on kinimatic settings. mom_out_angle_pos(0) and (1) are typically used for output (instead) as they are managed in the post code.

4.) My experience with WCS has not been that it affects tool axis or rotary position (in the post - sounds like it does in CAM express NX.) If I replay and see the tool point a certain way - then I see mom_tool_axis vector according to the frame of the parent mcs. WCS does affect turning more than milling.

Windows 10 Pro

Re: Tool orientation axis in NX and post builder


I will try to explain it more clear.

Is you can see at the picture i have floor_wall milling operation. In real machine at the beginig the mill spindle is oriented along -ZM axis and can rotate in XM-ZM plane around YM axis.


So at the begining of operation i must rotate the mill spindle around YM axis at 90 deg CCW (BT= BA= commands in listing bellow) and rotate workpiece around 145 deg CW about ZM axis (M146 G00 C145 M146 commands). So all variables must be
mom_cycle_spindle_axis = 0,
mom_mill_spindle_axis = 0
 mom_spindle_axis(0) = 1
mom_spindle_axis(1) = 0
mon_spindle_axis(2) = 0.

And cutcom plane YZ!

In post builder I receive mom_out_angle_pos(0) and (1) and according to it orient m-tool spindle (BT= BA= commands in listing bellow). And later do the rotation of main spindle (in which workpiece is installed) by M146 G00 C145 M146 commands.  At the end of "before motion" event post builder calls function "PB_CMD_set_principal_axis" by himself. And as you can see all this variables is correct at this stage.

N0022 (set_csys)
N0023 (reload_iks_parameters)
N0024 (reverse_rotation_vector)
N0025 (first tool change)
N0026 MT=0401
N0027 M321
N0028 (before_motion)
N0029 (dpp_ude_tool_path_type)
N0030 (dpp_ge_set_tcp_code)
N0031 (set_principal_axis)
N0032 (dpp_ge(coord_rot) = NONE)
N0033 (spindle_axis(0) = 1.00000000000000000)
N0034 (spindle_axis(1) = -0.00000000000000128)
N0035 (spindle_axis(2) = 0.00000000000000000)
N0036 (mom_cycle_spindle_axis = 0)
N0037 mom_cycle_spindle_axis = 0
N0038 mom_cutcom_plane = YZ
N0039 (Initial move)
N0040 (toolpath_axis_num = 3)
N0041 (mom_kin_machine_type = 5_axis_head_table)
N0042 (YZ)
N0043 (B = 90.00000000000004300; C= 145.00000000000023000)
N0044 TL=040404 BT=1
N0045 G138
N0046 M146
N0047 G0 C145. M15
N0048 M147
N0049 (set_m_tool_spindle_range)
N0050 SB=0 M13
N0051 M08
N0052 (set_principal_axis)
N0053 (dpp_ge(coord_rot) = AUTO_3D)
N0054 (spindle_axis(0) = 1.00000000000000000)
N0055 (spindle_axis(1) = -0.00000000000000128)
N0056 (spindle_axis(2) = 0.00000000000000000)
N0057 (mom_cycle_spindle_axis = 0)
N0058 (mom_cycle_spindle_axis = 2!!!!!!!!!!)
N0059 mom_cycle_spindle_axis = 2
N0060 mom_cutcom_plane = XY
N0061 (rapid)
N0062 (rapid_move)
N0063 G94 G90 Z28.997
N0064 X35. Y-20.732
N0065 (Approach Move)
N0066 (before_motion)
N0067 (dpp_ge_set_tcp_code)

But at the end of "initial move" event right after M08 code post builder again calls this function and in it sets mom_cycle_spindle_axis = 2!!!. I dont ynderstand why? And what mean dpp_ge(coord_rot) = AUTO_3D?

This is listing of PB_CMD_set_principal_axis form post:

MOM_output_literal "(set_principal_axis)"

  global mom_cycle_spindle_axis
  global mom_spindle_axis
  global mom_cutcom_plane mom_pos_arc_plane
  global dpp_ge

MOM_output_literal "(dpp_ge(coord_rot) = $dpp_ge(coord_rot))"

  # Initialization spindle axis
  global mom_kin_spindle_axis
  global mom_sys_spindle_axis
  if { ![info exists mom_kin_spindle_axis] } {
     set mom_kin_spindle_axis(0) 0.0
     set mom_kin_spindle_axis(1) 0.0
     set mom_kin_spindle_axis(2) 1.0
        MOM_output_literal "(mom_kin_spindle_axis(0) = $mom_kin_spindle_axis(0))"
        MOM_output_literal "(mom_kin_spindle_axis(1) = $mom_kin_spindle_axis(1))"
        MOM_output_literal "(mom_kin_spindle_axis(2) = $mom_kin_spindle_axis(2))"
  if { ![info exists mom_sys_spindle_axis] } {
     VMOV 3 mom_kin_spindle_axis mom_sys_spindle_axis
     MOM_output_literal "(mom_sys_spindle_axis(0) = $mom_sys_spindle_axis(0))"
        MOM_output_literal "(mom_sys_spindle_axis(1) = $mom_sys_spindle_axis(1))"
        MOM_output_literal "(mom_sys_spindle_axis(2) = $mom_sys_spindle_axis(2))"

  if { ![info exists mom_spindle_axis] } {
     VMOV 3 mom_sys_spindle_axis mom_spindle_axis
     MOM_output_literal "(mom_spindle_axis(0) = $mom_spindle_axis(0))"
        MOM_output_literal "(mom_spindle_axis(1) = $mom_spindle_axis(1))"
        MOM_output_literal "(mom_spindle_axis(2) = $mom_spindle_axis(2))"

  # Default cycle spindle axis to Z
  set mom_cycle_spindle_axis 2

  #<03-10-10 gsl> pb751 - Respect tool axis for 3-axis & XZC
  global mom_kin_machine_type mom_tool_axis
  if [string match "3_axis*" $mom_kin_machine_type] {
     VMOV 3 mom_tool_axis spindle_axis
         MOM_output_literal "(spindle_axis(0) = $spindle_axis(0))"
        MOM_output_literal "(spindle_axis(1) = $spindle_axis(1))"
        MOM_output_literal "(spindle_axis(2) = $spindle_axis(2))"
  } else {
     VMOV 3 mom_spindle_axis spindle_axis
         MOM_output_literal "(spindle_axis(0) = $spindle_axis(0))"
        MOM_output_literal "(spindle_axis(1) = $spindle_axis(1))"
        MOM_output_literal "(spindle_axis(2) = $spindle_axis(2))"

  if { [EQ_is_equal [expr abs($spindle_axis(0))] 1.0] } {
     set mom_cycle_spindle_axis 0
         MOM_output_literal "(mom_cycle_spindle_axis = 0)"

  if { [EQ_is_equal [expr abs($spindle_axis(1))] 1.0] } {
     set mom_cycle_spindle_axis 1
MOM_output_literal "(mom_cycle_spindle_axis = 1)"

  if { $dpp_ge(coord_rot) !="NONE" || $dpp_ge(toolpath_axis_num) == 5 } {
     set mom_cycle_spindle_axis 2
MOM_output_literal "(mom_cycle_spindle_axis = 2!!!!!!!!!!)"

  switch $mom_cycle_spindle_axis {
     0 {
        set mom_cutcom_plane  YZ
     1 {
        set mom_cutcom_plane  ZX
     2 {
        set mom_cutcom_plane  XY
     default {
        set mom_cutcom_plane  UNDEFINED

  # Set arc plane when it's not defined
  if { ![info exists mom_pos_arc_plane] || $mom_pos_arc_plane == "" } {
     set mom_pos_arc_plane $mom_cutcom_plane

MOM_output_literal "mom_cycle_spindle_axis = $mom_cycle_spindle_axis"
MOM_output_literal "mom_cutcom_plane = $mom_cutcom_plane"

Re: Tool orientation axis in NX and post builder


Ok - the writers of this underneath code are on this forum - they should answer this. If WCS affects tool vectors and rotary positions - I would be interested to know.

Windows 10 Pro

Re: Tool orientation axis in NX and post builder

I don't understand the details here, but I will offer some general comments:


CSYS behavior in CAM Express and NX CAM is identical.


There is always one WCS. It is temporary and used for user input.

In CAM, orientations are saved in the absolute CSYS.


The CSYS with dynamic handles that you see when you edit a tool, is not saved with the tool - it is only temporary so you have something to grab if you want to drag the tool around.


If you really need an answer, please log a call with GTAC. This forum is a great place for discussion, but I would not expect developers to monitor the discussions - we keep them very busy writing code ;*)

Mark Rief
Retired Siemens

Re: Tool orientation axis in NX and post builder

Hi Mark!

Your answer in very helpful! Thanks!

I have next question. Where I can find documentation about PB_CMD function (e.g. PB_CMD_rotate_cycle_coordinate) which comes with default post processors? There is many functions and I can't understand which of them must be used in different cases and for what purposes.

Re: Tool orientation axis in NX and post builder


That variable "dpp_ge" shows up in no postprocessors in the OTB 8.5 install. It could be that someone put it in a post along the way that yours is drawn from.

Windows 10 Pro

Re: Tool orientation axis in NX and post builder

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

@alexanderBBB wrote:
Where I can find documentation about PB_CMD function (e.g. PB_CMD_rotate_cycle_coordinate) which comes with default post processors?

There is usually no documentation other than the comments included in the procedures.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.2, FBM, MRL 3.1.7 | TcUA 10.1 MP7 Patch 0 ( | TcVis 11.4
Development: C (ITK), .NET, Tcl/Tk Testing: NX12.0 | AWC 3.4 Preparing: NX12.0

Employees of the customers, together we are strong Smiley Wink
How to Get the Most from Your Signature in the Community
NX Customization - Best Practice Guide

Learn online

Solution Information