<?xml version="1.0" ?>

<!-- Robot 6X -->
<machine xmlns="x-schema:PowermillMachineTool" POST="SimPost.">

  <!-- Where things are attached to the machine -->
  <head_attach_point PART="head" X="1518.790407" Y="-1.99" Z="1634.684614" I="0" J="0" K="1" U="1" V="0" W="0" />
  <table_attach_point PART="table" X="0" Y="0" Z="0" I="0" J="0" K="1" U="1" V="0" W="0" />

  <!-- List containing the entity groups to exclude from collision checking-->
  <collision_exclusion_list>
    <!-- no collision checking between "LinearTrackBase" and "LinearTrack"
         as this kind of collision is actually impossible -->
    <collision_exclusion_group>
      <collision_exclusion_part NAME="LinearTrackBase" />
      <collision_exclusion_part NAME="LinearTrack" />
    </collision_exclusion_group>
  </collision_exclusion_list>

  <!--Robot joint motions used during tool change procedure -->
  <!--NOTE: there can be more than one toolchange section to allow for tools to be stored in multiple tool changers using seperate pre and post moves -->
  <!--This example is specific to a toolchanger mounted on a linear axis allowing the tools to move with the robot -->
  <tool_change>

    <!-- Actions performed on currently selected tools run regardless of tool number -->
    <!--This can be used to move the robot to a safe position to make the tool change procedure more predictable and safe from collisions -->
    <!--The robot will always move to the given positions, before a tool change occurs, these are ignored between dropping the tool off and picking up a new tool, shortening the tool change procedure. -->
    <!-- MOVETO followed the axis address and a numerical value will move that axis to the given position -->
    <tool_change_pre_moves>
      MOVETO A-90.0 B-11.45 C-9.61 D180.0 E-21.07 F-180.0
      MOVETO A-77.06 B4.47 C-3.67 D90.18 E-102.94 F-89.19
      MOVETO A-77.06 B17.566 C23.078 D98.512 E-99.783 F-48.627
    </tool_change_pre_moves>

    <!-- Moves performed during tool change -->
    <!-- Default behaviour for any tool with a number not explicitly identified in a subsequent operation -->
    <tool_change_moves>
      TOOLCHANGE
    </tool_change_moves>

    <!-- Behaviour only called when the tool being returned or retrieved is Tool 1 -->
    <!-- Commands Following PUTONLY: only run when the identified tool is returned to the carousel -->
    <!-- Commands Following GETONLY: only run when the identified tool is retrieved from the carousel -->
    <!-- Any command not preceded by GETONLY or PUTONLY will be performed regardless of whether the tool is being returned or picked up -->
    <tool_change_moves NUMBER="1">
      <!-- First PUTONLY places the head of the robot horizontally just outside the tool holder -->
      PUTONLY: MOVETO A-75.524 B37.194 C30.734 D103.456 E-95.39 F-21.437
      <!-- First GETONLY places the head of the robot vertically just above the tool holder -->
      GETONLY: MOVETO A-73.557 B25.74 C41.429 D105.217 E-96.306 F-21.987
      <!-- Moves the spindle head to the location of the top of the tool in the rack ready to pick up/drop off the tool -->
      MOVETO A-73.557 B33.403 C40.97 D105.865 E-94.373 F-15.018
      <!-- TOOLPASS links the tool to a named machinepart and the tool will move with that machinepart in all subsequent moves -->
      <!-- Using TOOLPASS ensures that once the tool is returned to the rack it will continue to move along the linear axis -->
      PUTONLY: TOOLPASS "LinearTrack"
      <!-- TOOLCHANGE attaches the tool to the head attach point on get moves; and to the stationary machine tool coordinate system on put moves -->
      <!-- In this instance this line of code will not be run on put moves due to the GETONLY statement -->
      GETONLY: TOOLCHANGE
      <!-- These commands are the reverse of the first getonly and putonly commands -->
      PUTONLY: MOVETO A-73.557 B25.74 C41.429 D105.217 E-96.306 F-21.987
      GETONLY: MOVETO A-75.524 B37.194 C30.734 D103.456 E-95.39 F-21.437
    </tool_change_moves>

    <!-- Behaviour only called when the tool being returned or retrieved is Tool 2 -->
    <tool_change_moves NUMBER="2">
      PUTONLY:  MOVETO A-81.957 B36.423 C32.712 D97.522 E-92.856 F-20.677
      GETONLY: MOVETO A-80.824 B24.703 C43.585 D98.534 E-93.382 F-21.46
      MOVETO A-80.824 B32.685 C43.109 D98.9 E-92.244 F-14.032
      <!-- TOOLPASS links the tool to a named machinepart and the tool will move with that machinepart in all subsequent moves -->
      <!-- Using TOOLPASS ensures that once the tool is returned to the rack it will continue to move along the linear axis -->
      PUTONLY: TOOLPASS "LinearTrack"
      <!-- TOOLCHANGE attaches the tool to the head attach point on get moves and to the stationary machine tool coordinate system on put moves -->
      <!-- In this instance this line of code will not be run on put moves due to the GETONLY statement -->
      GETONLY: TOOLCHANGE
      PUTONLY: MOVETO A-80.824 B24.703 C43.585 D98.534 E-93.382 F-21.46
      GETONLY: MOVETO A-81.957 B36.423 C32.712 D97.522 E-92.856 F-20.677
    </tool_change_moves>

    <!-- Behaviour only called when the tool being returned or retrieved is Tool 3 -->
    <tool_change_moves NUMBER="3">
      PUTONLY: MOVETO A-88.599 B36.106 C33.54 D91.314 E-90.487 F-20.35
      GETONLY: MOVETO A-88.399 B24.268 C44.491 D91.493 E-90.581 F-21.234
      MOVETO A-88.399 B32.392 C44.009 D91.557 E-90.376 F-13.595
      <!-- TOOLPASS links the tool to a named machinepart and the tool will move with that machinepart in all subsequent moves -->
      <!-- Using TOOLPASS ensures that once the tool is returned to the rack it will continue to move along the linear axis -->
      PUTONLY: TOOLPASS "LinearTrack"
      <!-- TOOLCHANGE attaches the tool to the head attach point on get moves and to the stationary machine tool coordinate system on put moves -->
      <!-- In this instance this line of code will not be run on put moves due to the GETONLY statement -->
      GETONLY: TOOLCHANGE
      PUTONLY: MOVETO A-88.399 B24.268 C44.491 D91.493 E-90.581 F-21.234
      GETONLY: MOVETO A-88.599 B36.106 C33.54 D91.314 E-90.487 F-20.35
    </tool_change_moves>

    <!-- Behaviour only called when the tool being returned or retrieved is Tool 4 -->
    <tool_change_moves NUMBER="4">
      PUTONLY: MOVETO A-95.28 B36.236 C33.2 D85.055 E-88.147 F-20.484
      GETONLY: MOVETO A-96.03 B24.447 C44.118 D84.384 E-87.8 F-21.328
      MOVETO A-96.03 B32.511 C43.639 D84.144 E-88.559 F-13.777
      <!-- TOOLPASS links the tool to a named machinepart and the tool will move with that machinepart in all subsequent moves -->
      <!-- Using TOOLPASS ensures that once the tool is returned to the rack it will continue to move along the linear axis -->
      PUTONLY: TOOLPASS "LinearTrack"
      <!-- TOOLCHANGE attaches the tool to the head attach point on get moves and to the stationary machine tool coordinate system on put moves -->
      <!-- In this instance this line of code will not be run on put moves due to the GETONLY statement -->
      GETONLY: TOOLCHANGE
      PUTONLY: MOVETO A-96.03 B24.447 C44.118 D84.384 E-87.8 F-21.328
      GETONLY: MOVETO A-95.28 B36.236 C33.2 D85.055 E-88.147 F-20.484
    </tool_change_moves>

    <!-- Behaviour only called when the tool being returned or retrieved is Tool 5 -->
    <tool_change_moves NUMBER="5">
      PUTONLY: MOVETO A-101.82 B36.816 C31.7 D78.98 E-85.697 F-21.068
      GETONLY: MOVETO A-103.454 B25.235 C42.479 D77.518 E-84.938 F-21.733
      MOVETO A-103.454 B33.049 C42.012 D76.985 E-86.562 F-14.547
      <!-- TOOLPASS links the tool to a named machinepart and the tool will move with that machinepart in all subsequent moves -->
      <!-- Using TOOLPASS ensures that once the tool is returned to the rack it will continue to move along the linear axis -->
      PUTONLY: TOOLPASS "LinearTrack"
      <!-- TOOLCHANGE attaches the tool to the head attach point on get moves and to the stationary machine tool coordinate system on put moves -->
      <!-- In this instance this line of code will not be run on put moves due to the GETONLY statement -->
      GETONLY: TOOLCHANGE
      PUTONLY: MOVETO A-103.454 B25.235 C42.479 D77.518 E-84.938 F-21.733
      GETONLY: MOVETO A-101.82 B36.816 C31.7 D78.98 E-85.697 F-21.068
    </tool_change_moves>

    <!-- Actions performed on new tool to return it to the machine head -->
    <!-- TOOLCHANGE attaches the tool to the correct head attach point, regardless of current tool location -->
    <tool_change_post_moves>
      MOVETO A-77.06 B17.566 C23.078 D98.512 E-99.783 F-48.627
      MOVETO A-77.06 B4.47 C-3.67 D90.18 E-102.94 F-89.19
      MOVETO A-90.0 B-11.45 C-9.61 D180.0 E-21.07 F-180.0
    </tool_change_post_moves>
  </tool_change>

  <machine_part NAME="table" />

  <!-- The base is static -->
  <machine_part NAME="LinearTrackBase">
    <model_list>
      <dmt_file>
        <path FILE="Robot/RailY.dmt" />
        <rgb R="100" G="100" B="100" />
      </dmt_file>
      <dmt_file>
        <path FILE="Robot/RailYNames.dmt" />
        <rgb R="255" G="0" B="0" />
      </dmt_file>
    </model_list>
  </machine_part>

  <!-- The arm is controlled by 6 rotary axes -->
  <machine_part NAME="LinearTrack">
    <axis>
      <control_info ADDRESS="Y" MIN="-1600" MAX="1600" PRIORITY="STATIC" HOME="0"/>
      <simple_linear I="0" J="1" K="0" />
    </axis>
    <model_list>
      <dmt_file>
        <path FILE="Robot/ARail_Extended.dmt" />
        <rgb R="0" G="130" B="255" />
      </dmt_file>
      <dmt_file>
        <path FILE="Robot/ARail_ToolChanger.dmt" />
        <rgb R="0" G="130" B="255" />
      </dmt_file>
      <dmt_file>
        <path FILE="Robot/ARailEngine.dmt" />
        <rgb R="80" G="80" B="80" />
      </dmt_file>
    </model_list>

    <machine_part NAME="RobotAxis1">
      <axis>
        <control_info ADDRESS="A" MIN="-185" MAX="185" PRIORITY="AUTO" HOME="0"/>
        <simple_rotary X="0.0" Y="0.0" Z="0.0" I="0" J="0" K="-1" />
      </axis>
      <model_list>
        <dmt_file>
          <path FILE="Robot/AB.dmt" />
          <rgb R="0" G="130" B="255" />
        </dmt_file>
        <dmt_file>
          <path FILE="Robot/ABEngine.dmt" />
          <rgb R="80" G="80" B="80" />
        </dmt_file>
        <dmt_file>
          <path FILE="Robot/ABNames.dmt" />
          <rgb R="255" G="0" B="0" />
        </dmt_file>
        <dmt_file>
          <path FILE="Robot/ABNumbers.dmt" />
          <rgb R="255" G="255" B="0" />
        </dmt_file>
      </model_list>

      <machine_part NAME="RobotAxis2">
        <axis>
          <control_info ADDRESS="B" MIN="-50" MAX="100" PRIORITY="AUTO" HOME="-30" />
          <simple_rotary X="327.145" Y="0.0" Z="916.1" I="0" J="1" K="0" />
        </axis>
        <model_list>
          <dmt_file>
            <path FILE="Robot/BC.dmt" />
            <rgb R="0" G="130" B="255" />
          </dmt_file>
          <dmt_file>
            <path FILE="Robot/BCNames.dmt" />
            <rgb R="255" G="0" B="0" />
          </dmt_file>
          <dmt_file>
            <path FILE="Robot/BCNumbers.dmt" />
            <rgb R="255" G="255" B="0" />
          </dmt_file>
          <dmt_file>
            <path FILE="Robot/BCLogo.dmt" />
            <rgb R="20" G="20" B="20" />
          </dmt_file>
        </model_list>

        <machine_part NAME="RobotAxis3">
          <axis>
            <control_info ADDRESS="C" MIN="-215" MAX="70" PRIORITY="AUTO" HOME="30"/>
            <simple_rotary X="327.145" Y="0.0" Z="1829.79" I="0" J="1" K="0" />
          </axis>
          <model_list>
            <dmt_file>
              <path FILE="Robot/CD.dmt" />
              <rgb R="0" G="130" B="255" />
            </dmt_file>
            <dmt_file>
              <path FILE="Robot/CDEngine.dmt" />
              <rgb R="80" G="80" B="80" />
            </dmt_file>
            <dmt_file>
              <path FILE="Robot/CDNames.dmt" />
              <rgb R="255" G="0" B="0" />
            </dmt_file>
            <dmt_file>
              <path FILE="Robot/CDNumbers.dmt" />
              <rgb R="255" G="255" B="0" />
            </dmt_file>
          </model_list>

          <machine_part NAME="RobotAxis4">
            <axis>
              <control_info ADDRESS="D" MIN="-360" MAX="360" PRIORITY="AUTO" HOME="0"/>
              <simple_rotary X="0.0" Y="0.0" Z="1850" I="-1" J="0" K="0" />
            </axis>
            <model_list>
              <dmt_file>
                <path FILE="Robot/DE.dmt" />
                <rgb R="0" G="130" B="255" />
              </dmt_file>
              <dmt_file>
                <path FILE="Robot/DENames.dmt" />
                <rgb R="255" G="0" B="0" />
              </dmt_file>
              <dmt_file>
                <path FILE="Robot/DENumbers.dmt" />
                <rgb R="255" G="255" B="0" />
              </dmt_file>
            </model_list>

            <machine_part NAME="RobotAxis5">
              <axis>
                <control_info ADDRESS="E" MIN="-130" MAX="130" PRIORITY="AUTO" HOME="-20"/>
                <simple_rotary X="1229.5" Y="0.0" Z="1850" I="0" J="1" K="0" />
              </axis>
              <model_list>
                <dmt_file>
                  <path FILE="Robot/EF.dmt" />
                  <rgb R="0" G="130" B="255" />
                </dmt_file>
                <dmt_file>
                  <path FILE="Robot/EFNames.dmt" />
                  <rgb R="255" G="0" B="0" />
                </dmt_file>
                <dmt_file>
                  <path FILE="Robot/EFNumbers.dmt" />
                  <rgb R="255" G="255" B="0" />
                </dmt_file>
                <dmt_file>
                  <path FILE="Robot/EFEngine.dmt" />
                  <rgb R="80" G="80" B="80" />
                </dmt_file>
              </model_list>

              <machine_part NAME="RobotAxis6">
                <axis>
                  <control_info ADDRESS="F" MIN="-360" MAX="360" PRIORITY="AUTO" HOME="0"/>
                  <simple_rotary X="0" Y="0" Z="1850" I="-1" J="0" K="0" />
                </axis>
                <model_list>
                  <dmt_file>
                    <path FILE="Robot/F.dmt" />
                    <rgb R="140" G="140" B="140" />
                  </dmt_file>
                  <dmt_file>
                    <path FILE="Robot/SpindleR2.dmt" />
                    <rgb R="80" G="80" B="80" />
                  </dmt_file>
                </model_list>

                <machine_part NAME="head" />

              </machine_part>
            </machine_part>
          </machine_part>
        </machine_part>
      </machine_part>
    </machine_part>
  </machine_part>

</machine>
