Cancel
Showing results for 
Search instead for 
Did you mean: 

trying to activate LOCK AXIS UDE from Post

Valued Contributor
Valued Contributor

 I am creating a XZC mill turn post from a mill turn that had both x and y axis. in order to use g112 interpolation I have to lock the axis and set to polar. in an XZC post without any Y, I need to keep the Y axis locked which I prefer to do automatically

 

 I was able to set to polar coordinates without a problem. My problem is with the MOM lock axis UDE. I am putting the following code in a custom command

in start of path and I am getting an error. When I use the lock axis with the UDE, the post works fine.

 

 

lock axis UDE

 

EVENT lock_axis
{
   UI_LABEL "Lock Axis"
   CATEGORY MILL DRILL LATHE
   PARAM command_status
   {
      TYPE o
      DEFVAL "Active"
      OPTIONS "Active","Inactive"
      UI_LABEL "Status"
   }
   PARAM lock_axis
   {
      TYPE o
      DEFVAL "Xaxis"
      OPTIONS "Xaxis","Yaxis","Zaxis","Aaxis","Baxis","Caxis","Fourth","Fifth","Off"
      UI_LABEL "Locked Axis"
   }
   PARAM lock_axis_plane
   {
      TYPE o
      DEFVAL "NONE"
      OPTIONS "XYPLAN","YZPLAN","ZXPLAN","NONE"
      UI_LABEL "Locked Plane"
   }
   PARAM lock_axis_value
   {
      TYPE d
      DEFVAL "0.0000"
      TOGGLE Off
      UI_LABEL "Angle or Coordinate"
   }
}

 

 

following I made added to start of path.

   global mom_lock_axis
   global mom_lock_axis_plane
   global mom_lock_axis_value


set mom_lock_axis "YAXIS"
set mom_lock_axis_plane "XYPLAN"
set mom_lock_axis_value "0.0000"


MOM_lock_axis

 

 system lock axis commands from tcl file.

 

#=============================================================
proc MOM_lock_axis { } {
#=============================================================
   global mom_lock_axis
   global mom_lock_axis_plane
   global mom_lock_axis_value
   PB_CMD_MOM_lock_axis
}




#=============================================================
proc PB_CMD_MOM_lock_axis { } {
#=============================================================
# Default handler for UDE MOM_lock_axis
# - Do not attach it to any event!
#

  global mom_sys_lock_value mom_sys_lock_plane
  global mom_sys_lock_axis mom_sys_lock_status

   set status [SET_LOCK axis plane value]

   if { ![string compare "error" $status] } {
      global mom_warning_info
      CATCH_WARNING $mom_warning_info

      set mom_sys_lock_status OFF
   } else {
      set mom_sys_lock_status $status
      if { [string compare "OFF" $status] } {
         set mom_sys_lock_axis $axis
         set mom_sys_lock_plane $plane
         set mom_sys_lock_value $value

         LOCK_AXIS_INITIALIZE
      }
   }
}



#=============================================================
proc LOCK_AXIS_INITIALIZE {  } {
#=============================================================
# called by MOM_lock_axis
# ==> It's only used by MOM_lock_axis, perhaps it should be defined within.

   global mom_sys_lock_plane
   global mom_sys_lock_axis
   global mom_sys_unlocked_axis
   global mom_sys_unlock_plane
   global mom_sys_4th_axis_index
   global mom_sys_5th_axis_index
   global mom_sys_linear_axis_index_1
   global mom_sys_linear_axis_index_2
   global mom_sys_rotary_axis_index
   global mom_kin_4th_axis_plane
   global mom_kin_5th_axis_plane
   global mom_kin_machine_type

   if { $mom_sys_lock_plane == -1 } {
      if { ![string compare "XY" $mom_kin_4th_axis_plane] } {
         set mom_sys_lock_plane 2
      } elseif { ![string compare "ZX" $mom_kin_4th_axis_plane] } {
         set mom_sys_lock_plane 1
      } elseif { ![string compare "YZ" $mom_kin_4th_axis_plane] } {
         set mom_sys_lock_plane 0
      }
   }

   set mom_sys_4th_axis_index -1
   if { ![string compare "XY" $mom_kin_4th_axis_plane] } {
      set mom_sys_4th_axis_index 2
   } elseif { ![string compare "ZX" $mom_kin_4th_axis_plane] } {
      set mom_sys_4th_axis_index 1
   } elseif { ![string compare "YZ" $mom_kin_4th_axis_plane] } {
      set mom_sys_4th_axis_index 0
   }


  # Check whether the machine type is 5-axis.
   set mom_sys_5th_axis_index -1
   if { [string match "5_axis_*" $mom_kin_machine_type] && [info exists mom_kin_5th_axis_plane] } {
      if { ![string compare "XY" $mom_kin_5th_axis_plane] } {
         set mom_sys_5th_axis_index 2
      } elseif { ![string compare "ZX" $mom_kin_5th_axis_plane] } {
         set mom_sys_5th_axis_index 1
      } elseif { ![string compare "YZ" $mom_kin_5th_axis_plane] } {
         set mom_sys_5th_axis_index 0
      }
   }


   if { $mom_sys_lock_plane == 0 } {
      set mom_sys_linear_axis_index_1 1
      set mom_sys_linear_axis_index_2 2
   } elseif { $mom_sys_lock_plane == 1 } {
      set mom_sys_linear_axis_index_1 2
      set mom_sys_linear_axis_index_2 0
   } elseif { $mom_sys_lock_plane == 2 } {
      set mom_sys_linear_axis_index_1 0
      set mom_sys_linear_axis_index_2 1
   }

   if { $mom_sys_5th_axis_index == -1 } {
      set mom_sys_rotary_axis_index 3
   } else {
      set mom_sys_rotary_axis_index 4
   }

   set mom_sys_unlocked_axis [expr $mom_sys_linear_axis_index_1 + $mom_sys_linear_axis_index_2 - $mom_sys_lock_axis]
}


 

Using NX 8.0.3.4
5 REPLIES

Re: trying to activate LOCK AXIS UDE from Post

Phenom
Phenom

What does the log file say?

NX10.03
Windows 7 Pro

Re: trying to activate LOCK AXIS UDE from Post

Valued Contributor
Valued Contributor

I should have looked at the log file from the start. I only got an error message with a code in NX. it told me that mom_lock_axis_value_defined wasn't defined. I defined it and now it works. Thanks.

Using NX 8.0.3.4

Re: trying to activate LOCK AXIS UDE from Post

Phenom
Phenom

As I understand it

Lock axis is an alternative to G112 (g12.1)

With lock axis the post is doing the conversion from XY to XC

Polar G112 the output from ugpost is Cartesian an the control does the maths

Im not sure what the XZC mill turn post do.

I have this solution when polar is called.

 

 

Move to X0 Y0 C0

Call G112

Change Y axis Leader to C 

Disable fourth_axis output

At end of path

Enable fourth_axis

Change Y leader back to C

 

Also need checking for operation type and or check change in C (tool axis)

 

 

Re: trying to activate LOCK AXIS UDE from Post

Valued Contributor
Valued Contributor

Thanks for bringing that up. The initial machine post was purchased and seems to be in Polar for some reason. The machine I am making a post for does look more like Cartesian with C being Y and some R values. Both are fanuc OI controls, but the original post for these machines are done in gibbs by different people from different decades.

Using NX 8.0.3.4

Re: trying to activate LOCK AXIS UDE from Post

Phenom
Phenom

My most recent experience has been that both XZC mode template and lock axis will linearize arcs and do the polar conversion in the post (not by cam processor.) For situations where the control does this math - these would not be needed. The siemens TRANSMIT mode takes XY input and arcs and converts to XCZ polar dynamically. The post generally only has to handle initial rotary positioning - turning on this mode - and cancelling. For situations where there is not a control function for the conversion - both the lock axis and XZC fall short of linearizing the path enough - they allow linear segments beyond an acceptable tolerance to come to post - and there is not code that handles it that I been able to tap. For these situations - for milling - there are some operations that allow breaking up the segments (fixed profile.) Or - code could be written in the post to take a tolerance and look at how far the path is from rotation center and break up segments that are too long and deviate from recieved path (considering kinematics.)

NX10.03
Windows 7 Pro

Learn online





Solution Information