    machine fanuc15m 

    real 16 = 10000.0
    split move = 1
    spindle output = (2  0  1  0)
    coolant output = ( 1 0 )
    integer 51 = 4
    message output = false

    define codes
        comp on left  = G2   41
        comp on right = G2   42   
        coolant on       = M2 8
        coolant off      = M2 9
    end define

  define word TD
       address letter = "( DIM="
       address width  = 6
       scale factor   = 2
  end define

  define word TR
       address letter = "      TIP="
       address width  = 10
  end define

  define word TH
        address letter  = "    THICK="
        address width   = 10
  end define

  define word TOL
        address letter  = "      TOL="
        address width   = 10
  end define

    define word TM
     address letter = "( Time= "
    address width  = 8
    scale divisor   = 60
    end define
    
    define format (G1 G2 G3 G4 G5 G7 H )
       leading zeros = true
       modal
    end define

    define format (M2)
       leading zeros = false
       address width = 2
       field width = 1
       tape position = 1
       modal
    end define

     define format ( O TD TR TH TOL TM )
       not modal
       field width    = 10
      metric formats
       decimal point  = true
       decimal places = 2
       trailing zeros = false
       sign = if negative
   end define

     word order = (  N G1 G7 G3 G5 G4 G6 G2)
     word order = (+ T H D X Y Z B C I J K R  )
     word order = (+ S M1 OP )
     word order = (+  Q Q1 Z2 R2  ID F O )
     word order = ( + TD TR TH TOL TM  msg )

    define block tape start
       "%"
    end define

    define block tool change first
       TD ToolRadius[ToolNum] ; TR TipRadius[ToolNum] ; TH Thickness ; 
       TOL Tolerance  ; ")"
       TM ToolPathTime ; " Min )"
       "G00 G40 G49 G17 G80 G90 G54"
       "G91 G28 Z0"
       G1 0 ; G5 90 ; G4 54 ; X FromX ; Y FromY
       S ToolSpeed ; M1 3 
       G6 43 ; H ToolNum ; Z FromZ        
    end define
    
    define block move circle
        G1 ; G2 ; G3 ;  X ; Y ; Z ; R  =C ; F ; D ;
        B ; C
    end define

    define block move rapid
       G1 ; G2 ; G3 ; X ; Y ; Z 
    end define

    define block move linear
        G1 ; G2 ; G3 ; D ;
        X ; Y ; Z ; F ; coolant on
    end define

    define block tape end
       M1 5
       M1 30
      "%"
    end define
  end

# modify by michael Chen               
# email:    c850h002@yahoo.com.tw
