# File Name:    user defined name (ADM machine config. file).
# File Purpose: This file is a configuration file which holds all the parameters required by the A.D.M. process
#               to set-up the drilling machine and to create the drill output file.
# Written by:   Ian Ticehurst (Autom8 Ltd.)
# Version 1A.:  Date: 05.10.00 - Initial design and development.
# Version 1B.:  Date: 26.10.00 - Re-written to move comments to the outside of the parameter definition sections.
# Version 1C.:  Date: 27.10.00 - This file renamed pluritec_giga88 and modified to meet machine parameters supplied by pluritec and a user.
############################# Start of notes ###############################
# There can be many of these files located within the sys/hooks/ncd/config/machines directory. Each file is designed
# to hold information relevant to a specific drilling machine. Thus the drill output that is generated by the A.D.M.
# process will be customised to match that machine. This file sets up the panel location on the machine, the tool
# sorting order, the optimisation routines, and any peck/nibble drilling functions etc. The name of the file will
# typically reflect the name of the machine being used. Thus, if a factory has different machine types it can be
# quite easy to create different files specific to different machines.
# (Note that the comments are outside of the parameter sections as some problems were found with inclusion of comment
# lines within the "{}" sections).
############################# End of notes ###############################

# Registration section.
# This section describes the drill machine table geometry and the panel position 
# on the drilling machine table. This section can also define the second spindle
# table of the drill machine in order to allow automatic split drilling of large
# panels across two spindles. If this is never used the values xsize2, xover, dx1,
# dx2, dy2 will all be 0.
#
# Parameters are:-
#  xsize1   - the size of the X axis drilling area of spindle 1.
#  xsize2   - the size of the X axis drilling area of spindle 2. 
#  ysize    - the size of the Y axis drilling area of the machine.
#  xover    - the overlap of the spindle 1 and 2 drilling areas (xsize1 and xsize2 above).
#  angle    - the default angle to place the panel on the drill table (0,90,180,270).
#  mirror   - if set to yes the panel will be mirrored (i.e. drilled from reverse side).
#  xoff     - the offset distance from the drill table zero (the bottom left) to the panel datum (in X).
#             (Moves the panel on the drill table).
#  yoff     - the offset distance from the drill table zero (the bottom left) to the panel datum (in Y).
#             (Moves the panel on the drill table).
#  version  - the default drilling version to be used (1-8). (See on-line manual 0703 chapter 4 for details).
#  xorigin  - the offset of the drill file X0 position from the drill table zero (the bottom left).
#             (Does not move the panel, but moves the effective X/Y zero point).
#  yorigin  - the offset of the drill file Y0 position from the drill table zero (the bottom left).
#             (Does not move the panel, but moves the effective X/Y zero point).
#  dx1      - a special extra co-ordinate (datum) shift used in split panel situations.
#             This is applied to spindle area 1 X co-ordinates (typically set to 0).
#  dx2      - a special extra co-ordinate (datum) shift used in split panel situations.
#             This is applied to spindle area 2 X co-ordinates (typically set to 0).
#  dy1      - a special extra co-ordinate (datum) shift used in split panel situations.
#             This is applied to spindle area 1 Y co-ordinates (typically set to 0).
#  dy2      - a special extra co-ordinate (datum) shift used in split panel situations.
#             This is applied to spindle area 2 Y co-ordinates (typically set to 0).
#  xscale   - the scaling to apply to the X co-ordinates at output.
#  yscale   - the scaling to apply to the Y co-ordinates at output.
#  xscale_o - the origin for the scaling of the X co-ordinates (distance from machine table bottom left)
#  yscale_o - the origin for the scaling of the Y co-ordinates (distance from machine table bottom left)

reg {
  xsize1   = 28.34  
  xsize2   = 0
  ysize    = 22.44
  xover    = 0
  angle    = 270 
  mirror   = no
  xoff     = 2.0
  yoff     = 1.0
  version  = 3
  xorigin  = 2.0
  yorigin  = 1.0
  dx1      = 0
  dx2      = 0
  dy1      = 0
  dy2      = 0
  xscale   = 1.0
  yscale   = 1.0
  xscale_o = 0.0
  yscale_o = 0.0
}

# Format section.
# This section describes how the output drill file should be formatted, including
# language, units, zeroes etc. (Note that further modifications to the output drill
# file can be made using the out_file hook).
#
# Parameters are:-
#  format         - the output file format (for example: Excellon1, Excellon2, Siebmeyer etc.) 
#  zeroes         - how to include non-functional zeroes in the output file (trailing/leading/none).
#  units          - the output file units (inch/mm). 
#  tool_units     - the output file tool units (inch/mm).
#  nf1            - the number of numbers to use before the decimal point (i.e. 2 in 2.4 format).  
#  nf2            - the number of numbers to use after the decimal point (i.e. 4 in 2.4 format).
#  decimal        - if set to yes, a decimal point will be added in the output co-ordinates.
#  modal_coords   - if set to yes will not re-state duplicated co-ordinates in the output file.
#  incremental    - if set to yes the output file will use incremental co-ordinates.
#                   (each co-ordinate given as a distance from the previous) (typically set to no).
#  repetitions    - default is sr, if set to subroutine will output the drill file using drill patterns in sub-routines.
#                   (only with Hitachi format). 
#  single_sr      - if set to yes, even drill patterns without any repeat will be included within step and repeat codes.
#  sr_start_code  - defines the correct step and repeat start code for excellon format (set to 25 or 31).
#  sr_zero_set    - default is no, if set to yes the step and repeat co-ordinates will be set relative to a specified datum. 
#                   (uses the attribute .drill_sr_zero. See on-line manual 0703 chapter 5 for details).

format {
  format        = sm3000
  zeroes        = none
  units         = mm
  tool_units    = mm
  nf1           = 4
  nf2           = 2
  decimal       = no
  modal_coords  = yes
  incremental   = no
  repetitions   = sr
  single_sr     = no
  sr_start_code = 25
  sr_zero_set   = no
}

# Optimisation section.
# This section sets the optimisation methods to be used. Note that the license option "drlopti" must
# exist (and be valid). If not then the file creation will end with an error.
#
# Parameters are:-
#  optimize          - switch optimisation on or off (yes = optimise on, no = optimise off).
#  break_sr          - if set to no, optimisation will be done only within the step and repeat patterns. If set to yes,
#                      optimisation will be carried out for all drills (no step and repeat codes in the final file).
#  xspeed            - the speed of the machine in the X axis (in order to optimise the path with preference to the fastest axis.
#  yspeed            - the speed of the machine in the Y axis (in order to optimise the path with preference to the fastest axis.
#  iterations        - the number of times the system should try to improve the drill path.
#  reduction_percent - the minimum percentage improvement required before the system assumes that the path is as ood as possible.
#  diag_mode         - to assist with the optimise algorithm, this is set according to the way that the drill machine moves
#                      from hole to hole:-
#                      (a) 45ort - machine moves at 45 degree until it can travel in 0/90 degrees along the X or Y axis.
#                      (b) ort45 - machine moves at 0/90 degrees in X or Y axis until it can travel at 45 degrees.
#                      (c) direct - machine travels in X and Y simultaneously until next hole position is reached.

optimize {
  optimize          = yes
  break_sr          = no
  xspeed            = 100
  yspeed            = 100
  iterations        = 5
  reduction_percent = 1
  diag_mode         = ort45
}

# Settings section.
# This section sets some general parameters used in Auto Drill Manager functions.
#
# Parameters are:-
#  rout_layer   - the name of the rout layer to be created if any hole / slot requires moving to a rout layer.
#  hook_units   - the units for the hooks to operate in.
#  no_touch_cpr - default is no, if set to yes the check for non-plated holes touching copper is turned off.
#  tent_ar      - the minimum distance required between a non-plated hole and copper for the hole to be considered as not
#                 touching the copper.

rout_layer    = drl2rt
hook_units    = inch
no_touch_cpr  = no
tent_ar       = 2

# Nibble drill hole definition section.
# This section defines how to perform nibble drilling on holes. The nibble switch needs to be set by the set_table hook
# (or manually within the ADM screen), and the sections below determine how the nibble drilling will be defined. Note
# that there can be mutliple hole size ranges, each with slightly different parameters (defined by the "val{}" sections).
#
# Parameters are:-
#  custom    - if set to no, output will use standard machine canned cycle (or a pre-defined set of hole co-ordinates if
#              the machine format does not support a canned cycle). If set to yes the system will pass each hole details
#              to the create_nibble hook, which is used to calculate all the hole positions required according to site
#              specification (note that in this case all other parameters are ignored).
#  min_size  - the lower end of the hole size range to apply these parameters to.
#  max_size  - the higher end of the hole size range to apply these parameters to.
#  num_holes - the number of holes to use when creating a nibble drill for a hole in this size range.

nibble {
  custom = no
  val {
    min_size = 0
    max_size = 200
    num_holes = 40
  }
  val {
    min_size = 200
    max_size = 999
    num_holes = 80
  }
}

# Peck drilled slot definition section.
# This section defines how to perform peck drilling on slots. The nibble switch needs to be set by the set_table hook
# (or manually within the ADM screen), and the sections below determine how the peck drilling will be defined.
#
# Parameters are:-
#  custom         - if set to no, output will use standard machine canned cycle (or a pre-defined set of hole co-ordinates if
#                   the machine format does not support a canned cycle). If set to yes the system will pass each slot details
#                   to the create_slot hook, which is used to calculate all the hole positions required according to site
#                   specification (note that in this case all other parameters are ignored).
#  overlap        - the percentage overlap required on the drill hole positions.
#  total_overlap  - if the percentage overlap between the start and end of the slot is less than this number the slot will
#                   be drilled "in-line", if more than this number the end points will be drilled first.

slot {
  custom        = no
  overlap       = 8.0
  total_overlap = 10.0
}

# Z-axis clearance section.
# This section defines areas of the board where a clearance between the tool and the board is required to be set.
# (Note that in the example below the zone size is zero, and thus this section is example only). Mutliple zones can be
# defined using the "zone {}" sections.
#
# Parameters are:-
#  z_head - the clearance between the tool and the board (note that there is a default setting, and then each zone can have
#           a new setting).
#  x_min  - the X minimum edge of the defined zone.
#  y_min  - the Y minimum edge of the defined zone.
#  x_max  - the X maximum edge of the defined zone.
#  y_max  - the Y maximum edge of the defined zone.

z_axis {
  z_head   = 10
  zone {
    x_min  = 0
    y_min  = 0
    x_max  = 0
    y_max  = 0
    z_head = 10
  }
  zone {
    x_min  = 0
    y_min  = 0
    x_max  = 0
    y_max  = 0
    z_head = 10
  }
}

# Time section.
# This section sets some default timing settings to be used to help with true cycle time calculation.
#
# Parameters are:-
#  bit_change   - the time (in minutes) required to change the drill bit.
#  tool_change  - the time (in minutes) required to perform a tool change.

time {
  bit_change  = 1.0
  tool_change = 1.0
}

# Fixed tool assignment section.
# This section is used to define the tool sorting order (increasing size, decreasing size etc.) and also to define any holes
# that should occur with a fixed tool number within the output file. This is typically used to ensure that panel holes / alignment
# holes occur at the beginning of the drill program. For every fixed tool there needs to be a tool_entry section which defines the
# tool size and the tool number it should be allocated to.
#
# Parameters are:-
#  mode          - the tool sorting method to use (increasing size / count, decreasing size / count).
#  use_hole_tol  - default is no (use default tolerance of +/- 0.5 mils on a hole size to find a match). If set to yes, use
#                  the tolerance as defined in the tool table.
#  choice_method - if several hole sizes fall within the selectable range for the fixed tool size if value is default_fit
#                  (this is default value) use the smallest of the hole sizes within the range. If set to "closest_tool_fit"
#                  use the tool size that is closest to the defined value.
#  tool          - within each tool_entry section this is the tool number that will be allocated.
#  size          - within each tool_entry section this is the tool size that will be fixed to the tool number.

tools_assign {
   mode          = increasing_size
   use_hole_tol  = no
   choice_method = default_fit
   tool_entry {
      tool = 1
      size = 120
   }
   tool_entry {
      tool = 2
      size = 160
   }
}

# First/last hole definition section.
# This section can be used to automatically add first and/or last check holes to the drill file. These holes will appear within
# a specified area (it is also possible to define a seperate area for the last holes - this uses the x1_end, y1_end etc. parameters
# - if these do not appear then all holes will be within the area defined by x1, y1, x2, y2).
#
# Parameters are:-
#  start    - if set to yes, then first holes require to be added.
#  end      - if set to yes, then last holes require to be added.
#  min_dist - distance between the holes.
#  x1       - the X minimum edge of the bounding box for the first holes (and last holes if y2_end is not defined)
#  y1       - the Y minimum edge of the bounding box for the first holes (and last holes if y2_end is not defined)
#  x2       - the X maximum edge of the bounding box for the first holes (and last holes if y2_end is not defined)
#  y2       - the Y maximum edge of the bounding box for the first holes (and last holes if y2_end is not defined)
#  x1_end   - the X minimum edge of the bounding box for the last holes
#  y1_end   - the Y minimum edge of the bounding box for the last holes
#  x2_end   - the X maximum edge of the bounding box for the last holes
#  y2_end   - the Y maximum edge of the bounding box for the last holes
#  min_hits - if the number of hits is less than this value no first / last holes will be added.

start_end {
   split {
      start    = no
      end      = no
      min_dist = 20
      x1       = 2.0
      y1       = 0.2
      x2       = 3.5
      y2       = 0.6
      x1_end   = 10.0
      y1_end   = 0.2
      x2_end   = 14.0
      y2_end   = 0.6
      min_hits = 10
   }
}

# Output hook section.
# This section determines if the out_file hook exists and should be used, and if so which sections should be used in order to
# modify the final output file.
#
# Parameters are:-
#  exists        - if yes, the out_file is to be used for any sections selected "yes" below.
#  header        - if yes, use the header blocks as defined by the out_file hook.
#  eof           - if yes, use the end of file blocks as defined by the out_file hook.
#  tool_change   - if yes, use the tool change blocks as defined by the out_file hook.
#  tool_finish   - if yes, use the tool finish blocks as defined by the out_file hook.
#  full_sr_start - if yes, use the step and repeat start blocks as defined by the out_file hook (only active if full S&R is chosen).
#  full_sr_end   - if yes, use the step and repeat end blocks as defined by the out_file hook (only active if full S&R is chosen).

out_hook {
   exists        = yes
   header        = yes
   eof           = yes
   tool_change   = yes
   tool_finish   = no
   full_sr_start = no
   full_sr_end   = no
}

# Panel section.
# The panel section can be used to modify and (or all) of the parameters given above when a particular panel size is loaded.
# Typically this is used to modify the placement of the panel on the machine dependant on the panel size. However, it should
# be noted that any of the sections used above can appear within the panel section. Thus the only parameters of note in this
# section are the xsize and ysize which are checked against the step (panel) size being used. If it matches then any parameters
# defined in the panel section are used. Any parameters not defined in the panel section are taken from those above.
# In the examples below all lines are commented out (example only).
#panel {
#   xsize = 28
#   ysize = 14
#   reg {
#     angle = 270
#     mirror = no
#     xoff = 12
#     yoff = 7
#     dx1  = 0
#     dy1  = 0
#  }
#   optimize {
#     optimize = yes
#     break_sr = no
#     xspeed = 100
#     yspeed = 100
#     iterations = 5
#     reduction_percent = 1
#     diag_mode = 45ort
#  }
#}
#
#panel {
#   xsize = 24
#   ysize = 24
#   reg {
#     angle = 180
#     mirror = no
#     xoff = 0
#     yoff = 12
#     dx1  = 0
#     dy1  = 0
#   }
#}

