Cancel
Showing results for 
Search instead for 
Did you mean: 

PB procedure for MILL / TURN

Pioneer
Pioneer

Hello.
I create a postprocessor for the mill / turn XZC machine
I can not help saving the procedure that will change the tool axis between X and Z.

I wrote this procedure for mill postprocessor:

global mom_tool_axis

#MOM_output_literal "$ mom_tool_axis (0)"
#MOM_output_literal "$ mom_tool_axis (1)"
#MOM_output_literal "$ mom_tool_axis (2)"

set tool_axis [format "% 2.2f" $ mom_tool_axis (2)]

MOM_output_literal "$ tool_axis"


if {$ tool_axis! = 1.00} {

  
set mom_sys_spindle_axis (0) "1.0"
  
set mom_sys_spindle_axis (1) "0.0"
  
set mom_sys_spindle_axis (2) "0.0"

  
set mom_kin_spindle_axis (0) "1.0"
  
set mom_kin_spindle_axis (1) "0.0"
  
set mom_kin_spindle_axis (2) "0.0"

} else {

  
set mom_sys_spindle_axis (0) "0.0"
  
set mom_sys_spindle_axis (1) "0.0"
  
set mom_sys_spindle_axis (2) "1.0"


  
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_reload_kinematics


I've added it to Start of Path, but it's wrong, what should this procedure look like?

1.gif

 

 

6 REPLIES

Re: PB procedure for MILL / TURN

Gears Phenom Gears Phenom
Gears Phenom

mom tool axis  - do not try to overwrite it. only read it.

in initial move or first move - you can read it  - it is the first existing point of the path. Read it sooner is nonsense.

And in initial and first move is too late to reload kinematics.

 

This would be my approach:

1.

in start of program you have to decide what tool axis you want - X or Z.

! By ude or whatever... (Not by mom tool axis.)

2.

Then set kin spindle axis and try to reload kinematics.

 

---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #

Re: PB procedure for MILL / TURN

Phenom
Phenom

Here is a little section of code from the "MILL_TURN" proc from the template post when you set this kinematic:

 

set mom_out_angle_pos(0) [ROTSET $mom_pos(3) $mom_prev_rot_ang_4th $mom_kin_4th_axis_direction\
  $mom_kin_4th_axis_leader mom_sys_leader(fourth_axis)\
  $mom_kin_4th_axis_min_limit $mom_kin_4th_axis_max_limit]

set mom_prev_pos(3) $mom_out_angle_pos(0)
set mom_pos(3) $mom_out_angle_pos(0)

MOM_reload_variable -a mom_out_angle_pos
MOM_reload_variable -a mom_pos
MOM_reload_variable -a mom_prev_pos

 

This post template will determe rotary angles in the postprocessor. I don't think manipulating NX kinematics will have a desired effect. Look at what is in the proc "PB_CMD_kin_before_motion" in the tcl for details.

NX10.03
Windows 7 Pro

Re: PB procedure for MILL / TURN

Pioneer
Pioneer

I put in your procedure but nothing has changed.
I want to create a postprocessor for driven tools in a lathe. But I can not define how the postprocessor can see tools working in the Z axis and the X axis.
If I create two postprocessors, one for the tools in the Z axis and the tool axis for the X axis is all good.
But how to combine it into one postorcesor?

 

 

 

proc PB_CMD_kin_before_motion { } {
#=============================================================
# This command is called before every motion. It converts the
# xyz input from UG to xzc for the mill/turn. It also processes
# the tool axis and verifies its correctness.
#
# --> Do NOT rename this command!
#

global mom_kin_machine_type

if { [info exists mom_kin_machine_type] } {
if { ![string match "*3_axis_mill_turn*" $mom_kin_machine_type] } {
return
}
}


global mom_out_angle_pos mom_sys_coordinate_output_mode mom_sys_output_mode mom_pos
global mom_mcs_goto mom_tool_axis mom_prev_pos mom_sys_millturn_yaxis
global mom_kin_arc_output_mode

if { ![string compare "POLAR" $mom_sys_coordinate_output_mode] } {

if { [string compare "TRUE" $mom_sys_millturn_yaxis] } { MOM_suppress always Y }
if { [string compare "POLAR" $mom_sys_output_mode] } {
#
# This section outputs the code needed to change the control to polar
# output mode.
#
PB_CMD_init_polar_mode
set mom_sys_output_mode "POLAR"
}

MILL_TURN

MOM_reload_variable -a mom_out_angle_pos
set mom_prev_pos(3) $mom_out_angle_pos(0)
set mom_pos(3) $mom_out_angle_pos(0)
MOM_reload_variable -a mom_pos
MOM_reload_variable -a mom_prev_pos

} elseif { ![string compare "CARTESIAN" $mom_sys_coordinate_output_mode] } {

if { [string compare "TRUE" $mom_sys_millturn_yaxis] } { MOM_suppress off Y }
if { [string compare "CARTESIAN" $mom_sys_output_mode] } {
#
# This section outputs the code needed to change the control to cartesian
# output mode.
#
PB_CMD_init_cartesian_mode
set mom_sys_output_mode "CARTESIAN"
}
}
}

Re: PB procedure for MILL / TURN

Phenom
Phenom
That code should have already been inside the tcl when you created a mill-turn xzc type post. I was stating that it is not ideal to switch in one post with that post template. If you have two posts you like - I would link them. Inside Postbuilder - make the more common one (along Z maybe) the master and pick the other post as linked. Switch between using the head ude.
NX10.03
Windows 7 Pro

Re: PB procedure for MILL / TURN

Pioneer
Pioneer
I thought it would be possible to do this without linking postprocessors, so that I would not have to remember to add events.

Re: PB procedure for MILL / TURN

Phenom
Phenom

I have changed kinematics a lot on the fly. I recently tried to change the initial spindle direction with the variables you are using "on the fly." My goal was to load a "device" which turns the spindle 90 (right angle head.) I had an HT kinematic. I set the following at start of path (and tried some other places) and it did not change anything:

 

set ::mom_kin_spindle_axis(0) "0.0"
set ::mom_kin_spindle_axis(1) "1.0"
set ::mom_kin_spindle_axis(2) "0.0"

MOM_reload_variable -a ::mom_kin_spindle_axis

MOM_reload_kinematics


I ended up having to use "mom_head_spindle_axis" and it would work if early enough (I think it doesn't at start of path.)

 

Generally - I think mom_kin_spindle_axis works if set right away in the program (maybe by MOM_machine_mode) but after that may not work. I am not sure though. The "Head" object in the tool objects works for this (as well.) It sets mom_head_spindle_axis and a MOM_head event is raised.

 

I think it will get harder to know much about the details of any UGPost feature (events, variables, timing) going forward. I assume that the method to do things in PC will be the usual response when requesting support. So - we will have to test to find out how it works (those of us that need to code some things.)

NX10.03
Windows 7 Pro

Learn online





Solution Information