Showing results for 
Search instead for 
Did you mean: 

nc-code problem in NX simulation

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

I have a minor problem with machine simulation in NX. It is a two-channel lathe with a spindle. I have complete machining. I have a problem with simulating synchronization operations, specifically for a drilling operation against a spindle. When I do postprocess only on the operation itself, everything is fine even when I run it in the simulation of the machine, but when I start the complete machining of both channels, there are quite a different coordinate of the holes (spindle positions of the C-axis) at the counter-spindle operation. When I post a synchronization postprocess, it's all right in the output. I attach a video. Would anyone not know where the bug is?

Thank you


Re: nc-code problem in NX simulation

Siemens Legend Siemens Legend
Siemens Legend



this problem is a post problem. When the post generate output for second channel not all variables have initial status. You have to ensure in your post that all variables and kinematic are in an initial state for each channel.


Background is the working of the Sync-Manager with Tcl interpreter. If you post single operations or click the post process button in Sync manager each channel have a own Tcl interpreter and all variables are in initial state for each channel. So you get the correct output.


When the Sync manager starts and post into the list in the user interface there is only one Tcl interpreter. So all output is generated with the same interpreter. That means in channel 1 all variables are in an initial state but for the second channel variables have the last values from the first channel. That's the reason for example wrong coordinates like you have for the C-axis.


To avoid this you have to implement a reset command for all variables (especially kinematic variables) in your post.

Hope this hint will help you to solve that.


Best regards


Re: nc-code problem in NX simulation

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Thank you Thomas,

I have a reset at the end of each operation, but it's still the same.


global mom_prev_pos
   global mom_pos
   global mom_prev_out_angle_pos
   global mom_out_angle_pos
   global mom_prev_rot_ang_4th
   global mom_prev_rot_ang_5th
   global mom_rotation_angle
   global mom_sys_circle_code

   set mom_sys_circle_code(CLW)    "2"
   set mom_sys_circle_code(CCLW)   "3"

   set mom_prev_pos(0) 0.0
   set mom_prev_pos(1) 0.0
   set mom_prev_pos(2) 0.0
   set mom_prev_pos(3) 0.0
   set mom_prev_pos(4) 0.0

   set mom_pos(0) 0.0
   set mom_pos(1) 0.0
   set mom_pos(2) 0.0
   set mom_pos(3) 0.0
   set mom_pos(4) 0.0

   set mom_prev_out_angle_pos(0) 0.0
   set mom_prev_out_angle_pos(1) 0.0

   set mom_out_angle_pos(0) 0.0
   set mom_out_angle_pos(1) 0.0

   set mom_prev_rot_ang_4th 0.0
   set mom_prev_rot_ang_5th 0.0

   set mom_rotation_angle 0.0

   #MOM_reload_variable -a mom_prev_pos
   #MOM_reload_variable -a mom_pos
   #MOM_reload_variable -a mom_prev_out_angle_pos
   #MOM_reload_variable -a mom_out_angle_pos
   #MOM_reload_variable mom_prev_rot_ang_4th
   #MOM_reload_variable mom_prev_rot_ang_5th
   #MOM_reload_variable mom_rotation_angle


Re: nc-code problem in NX simulation

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

All the "MOM_reload_variable" calls are commented out.

So you haven't really reset anything.

remove the "#" from those lines & see if anything changes.

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled

Learn online

Solution Information