MACHINE  wedm

INCLUDE { $UGII_CAM_USER_DEF_EVENT_DIR/ude.cdl }

FORMATTING
{
  WORD_SEPARATOR " "
  END_OF_LINE ""
  SEQUENCE sequence_number 10  10 1 9999

################ FORMAT DECLARATIONS #################
  FORMAT AbsCoord "&__5.4_"
  FORMAT Coordinate "&__4.4_"
  FORMAT Digit_2 "&_02_00"
  FORMAT Digit_4 "&_04_00"
  FORMAT Digit_5 "&__5_00"
  FORMAT Dwell_SECONDS "&__5.3_"
  FORMAT Dwell_sec "&__5.3_"
  FORMAT EventNum "&+03_00"
  FORMAT Feed "&__7.2_"
  FORMAT Feed_IPM "&__4.1_"
  FORMAT Feed_IPR "&__1.4_"
  FORMAT Rev "&__4_00"
  FORMAT Rotary "&__5.3_"
  FORMAT String "%s"
  FORMAT Tcode "&_02_00"
  FORMAT Zero_int "&_01_0_"
  FORMAT Zero_real "&_01.10"

################ ADDRESS DECLARATIONS ################
  ADDRESS G_cutcom 
  {
      FORMAT      Digit_2
      FORCE       off
      MAX         999999999.9999 Truncate
      MIN         -999999999.9999 Truncate
      LEADER      "G"
  }

  ADDRESS G_motion 
  {
      FORMAT      Digit_2
      FORCE       off
      MAX         9999 Truncate
      MIN         -9999 Truncate
      LEADER      "G"
  }

  ADDRESS G_mode 
  {
      FORMAT      Digit_2
      FORCE       off
      LEADER      "G"
  }

  ADDRESS G 
  {
      FORMAT      Digit_2
      FORCE       off
      MAX         99 Truncate
      MIN         0 Truncate
      LEADER      "G"
  }

  ADDRESS X 
  {
      FORMAT      Coordinate
      FORCE       off
      MAX         9999.9999 Truncate
      MIN         -9999.9999 Truncate
      LEADER      [$mom_sys_leader(X)]
      ZERO_FORMAT Zero_real
  }

  ADDRESS Y 
  {
      FORMAT      Coordinate
      FORCE       off
      MAX         9999.9999 Truncate
      MIN         -9999.9999 Truncate
      LEADER      [$mom_sys_leader(Y)]
      ZERO_FORMAT Zero_real
  }

  ADDRESS Z 
  {
      FORMAT      Coordinate
      FORCE       off
      MAX         9999.9999 Truncate
      MIN         -9999.9999 Truncate
      LEADER      [$mom_sys_leader(Z)]
      ZERO_FORMAT Zero_real
  }

  ADDRESS fourth_axis 
  {
      FORMAT      Coordinate
      FORCE       off
      MAX         9999.9999 Truncate
      MIN         -9999.9999 Truncate
      LEADER      [$mom_sys_leader(fourth_axis)]
      ZERO_FORMAT Zero_real
  }

  ADDRESS fifth_axis 
  {
      FORMAT      Coordinate
      FORCE       off
      MAX         9999.9999 Truncate
      MIN         -9999.9999 Truncate
      LEADER      [$mom_sys_leader(fifth_axis)]
      ZERO_FORMAT Zero_real
  }

  ADDRESS I 
  {
      FORMAT      Coordinate
      FORCE       off
      MAX         9999.9999 Truncate
      MIN         -9999.9999 Truncate
      LEADER      "I"
      ZERO_FORMAT Zero_real
  }

  ADDRESS J 
  {
      FORMAT      Coordinate
      FORCE       off
      MAX         9999.9999 Truncate
      MIN         -9999.9999 Truncate
      LEADER      "J"
      ZERO_FORMAT Zero_real
  }

  ADDRESS F 
  {
      FORMAT      Feed
      FORCE       off
      MAX         999999.9999 Truncate
      MIN         0.0001 Truncate
      LEADER      "F"
      ZERO_FORMAT Zero_real
  }

  ADDRESS D 
  {
      FORMAT      Digit_2
      FORCE       off
      MAX         99 Truncate
      MIN         0 Truncate
      LEADER      "D"
  }

  ADDRESS dwell 
  {
      FORMAT      Dwell_sec
      FORCE       off
      MAX         99999.999 Truncate
      MIN         0.001 Truncate
      LEADER      "P"
      ZERO_FORMAT Zero_real
  }

  ADDRESS M 
  {
      FORMAT      Digit_2
      FORCE       off
      LEADER      "M"
  }

  ADDRESS N 
  {
      FORMAT      Digit_4
      FORCE       always
      MAX         9999 Truncate
      LEADER      [$mom_sys_leader(N)]
  }

  ADDRESS Text 
  {
      FORMAT      String
      FORCE       always
      LEADER      ""
  }

  ADDRESS R 
  {
      FORMAT      Coordinate
      FORCE       off
      MAX         9999.9999 Truncate
      MIN         -9999.9999 Truncate
      LEADER      "R"
      ZERO_FORMAT Zero_real
  }


################ ADDRESS DECLARATIONS ################
  ADDRESS LF_AAXIS 
  {
      FORMAT      AbsCoord
      FORCE       always
      LEADER      ""
      ZERO_FORMAT Zero_real
  }

  ADDRESS LF_ENUM 
  {
      FORMAT      Digit_5
      FORCE       always
      LEADER      ""
      ZERO_FORMAT Zero_int
  }

  ADDRESS LF_BAXIS 
  {
      FORMAT      AbsCoord
      FORCE       always
      LEADER      ""
      ZERO_FORMAT Zero_real
  }

  ADDRESS LF_XABS 
  {
      FORMAT      AbsCoord
      FORCE       always
      LEADER      ""
      ZERO_FORMAT Zero_real
  }

  ADDRESS LF_FEED 
  {
      FORMAT      Feed
      FORCE       always
      LEADER      ""
      ZERO_FORMAT Zero_real
  }

  ADDRESS LF_YABS 
  {
      FORMAT      AbsCoord
      FORCE       always
      LEADER      ""
      ZERO_FORMAT Zero_real
  }

  ADDRESS LF_SPEED 
  {
      FORMAT      Rev
      FORCE       always
      LEADER      ""
      ZERO_FORMAT Zero_int
  }

  ADDRESS LF_ZABS 
  {
      FORMAT      AbsCoord
      FORCE       always
      LEADER      ""
      ZERO_FORMAT Zero_real
  }


############ BLOCK TEMPLATE DECLARATIONS #############
  BLOCK_TEMPLATE circular_move 
  {
       G_cutcom[$mom_sys_cutcom_code($mom_wire_cutcom_mode)]\opt
       G_motion[$mom_sys_circle_code($mom_arc_direction)]\opt
       G_mode[$mom_sys_output_code($mom_output_mode)]
       X[$mom_pos(0)]
       Y[$mom_pos(1)]
       fourth_axis[$mom_pos(3)]
       fifth_axis[$mom_pos(4)]
       I[$mom_prev_pos(0) - $mom_pos_arc_center(0)]
       J[$mom_prev_pos(1) - $mom_pos_arc_center(1)]
  }

  BLOCK_TEMPLATE cut_wire 
  {
       M[$mom_sys_cut_wire]
  }

  BLOCK_TEMPLATE end_of_program 
  {
       M[$mom_sys_end_of_program_code]
  }

  BLOCK_TEMPLATE linear_move 
  {
       G_cutcom[$mom_sys_cutcom_code($mom_wire_cutcom_mode)]\opt
       G_motion[$mom_sys_linear_code]
       G_mode[$mom_sys_output_code($mom_output_mode)]
       X[$mom_pos(0)]
       Y[$mom_pos(1)]
       fourth_axis[$mom_pos(3)]
       fifth_axis[$mom_pos(4)]
  }

  BLOCK_TEMPLATE rapid_move 
  {
       G_motion[$mom_sys_rapid_code]
       G_mode[$mom_sys_output_code($mom_output_mode)]\opt
       X[$mom_pos(0)]
       Y[$mom_pos(1)]
       fourth_axis[$mom_pos(3)]
       fifth_axis[$mom_pos(4)]
  }

  BLOCK_TEMPLATE sequence_number 
  {
       N[$mom_seqnum]
  }

  BLOCK_TEMPLATE start_of_program 
  {
       G_cutcom[$mom_sys_cutcom_code(OFF)]
       G_mode[$mom_sys_output_code(ABSOLUTE)]
       G[$mom_sys_unit_code($mom_output_unit)]\opt
  }

  BLOCK_TEMPLATE thread_wire 
  {
       M[$mom_sys_thread_wire]
  }

  BLOCK_TEMPLATE wire_guides 
  {
       G[$mom_sys_reset_code]
       X[0]
       Y[0]
       Z[0]
       R[$mom_wire_guides_upper_plane]
  }

  BLOCK_TEMPLATE comment_data 
  {
       LF_XABS[$mom_pos(0)]
       LF_YABS[$mom_pos(1)]
  }

}
