Centroid CNC12 Script Package

Our current Centroid script package consists of scripts and a configuration file for configuring and employing automatic tool changes with RapidChange ATC. Although our Centroid solution does not contain a GUI, it is easy to configure using the provided configuration file.

Video Tutorial

Set up and configuration for Centroid CNC12 set up in depth.
A big Thank You! to Wes Hansen who produced this video and a wide range of other installation videos that we will be adding soon. The only difference is how we distribute the CNC 12 scripts

Contents

When you download and unzip the file for Centroid CNC12 Scripts you will find the following files:

  • rapidchangeatc/
    • rc_config.mac
    • rc_cover_control.mac
    • rc_modal_state.mac
    • rc_set_tool_offset.mac
    • rc_tool_recognition.mac
  • mfunc6.mac
  • mfunc51.mac
  • mfunc52.mac
  • mfunc53.mac
  • mfunc54.mac
  • README.txt

rapidchangeatc/

This folder contains the configuration file and much of the logic that our custom M-functions consume. Place this folder and it’s contents in your Centroid CNC12 root directory.

rc_config.mac

This is the configuration file for declaring your RapidChange ATC settings. It contains the assignment of all of the variables used by our scripts to perform automatic tool changes. Each variable is assigned a value and then has an inline comment starting with a semi-colon declaring the associated setting. To assign a value, simply replace the default value of 0 with the appropriate value for your configuration.

RapidChange ATC Macros

These files contain much of the logic for performing automatic tool changes with RapidChange ATC. They are required by the provided custom M-functions.

  • rc_cover_control.mac
  • rc_modal_state.mac
  • rc_set_tool_offset.mac
  • rc_tool_recognition.mac

Custom M-functions

Along with a script for M6, our current Centroid CNC12 Scripts include four other custom M-functions. Centroid CNC12 allows custom functionality to be scripted for M-functions from 0 through 90. Our custom functions use 51-54. We chose these functions because they did not overwrite any existing functionality. If you wish to use a different code for any of the provided M-functions simply rename the mfuncXX.mac file replacing the existing number with whatever allowed number you choose. The M-function files should also be placed in the Centroid CNC12 root directory.

mfunc6.mac

This is the M6 macro. Using the macros provided in the rapidchangeatc/ folder, this function performs the automatic tool change function. The function in it’s current state will do the following:

  • Move to the Z axis home position. This is default Centroid CNC12 behavior called internally before the M6 function is executed.
  • Validate that a new tool has been selected and a tool change is required.
  • Record the current units and distance mode and change to millimeters and absolute (G21 G90).
  • Turn off the spindle and coolant.
  • Unloads the current tool, if it has one and it is numbered within the magazines range. If out of range, it pauses with a message for manual removal. If tool recognition is enabled and it fails to unload properly after two attempts, it rises and pauses with a message for manual removal. When the dust cover is enabled the M6 handles opening the dust cover when required.
  • Loads the new tool selection, unless changing to tool zero. If out of range, it pauses with a message for manual attachment. If tool recognition is enabled and it fails to load properly after one attempt, it rises and pauses with a message for manual attachment.
  • Performs a tool touch off routine to record the tool length offset for the new tool if Tool Setter Mode is enabled. This package was originally designed to use a reference point that is established using our mfunc53.mac function, however we have determined that this is unnecessary. This will be removed in the next update, but for now that function can be ignored. You may also use your own tool touch off routine by providing your macro file in the rc_config.mac configuration file. The provided tool touch off macro employs tool length offsets using G43 Hn. You can learn more about this method and how we use it here.
  • Move to the configured Z Safe Clearance.
  • Restore the recorded units and distance mode.
  • Note: M6 does not turn the coolant or the spindle back on if they were on when the M6 is called. This will need to be handled in the post processor.
  • Return to program execution.

mfunc51.mac

This macro sets the current tool for the system. Run this macro with a tool selection (M51 T1) to initialize the current tool to persistent storage. After it is set, the current tool should be persisted across tool changes and power cycles.

mfunc52.mac

This macro calls the provided tool touch off macro without running a tool change. Please note that the provided tool touch off macro may be overridden during a tool change within the rc_config.mac configuration file but will NOT override this macro. If you are using your own tool touch off macro you should call that macro independently.

mfunc53.mac

This macro was initially designed to set a tool touch off reference for setting tool length offsets. We have since determined that this is unnecessary. It can be ignored and will be removed in the next update.

mfunc54.mac

This macro toggles the dust cover open and closed.

README.txt

This text file contains a condensed version of the information found on this page.

Configuration Settings

Below you will find the configurable settings contained in the rc_config.mac file. It is important to note that currently the Centroid CNC12 Scripts must be configured in millimeters. The next update will allow for configuring in either units.

Pocket Count

#100 = 0            ; Pocket Count

Enter the number of tool pockets in the magazine. Do not include a pocket occupied by a tool setter.

Pocket Offset

#101 = 0            ; Pocket Offset

Enter the distance between pockets when measuring from center to center. The offset for your magazine can be found here.

Pocket Alignment

#102 = 0            ; Pocket Alignment

Enter the corresponding value (0 = X, 1 = Y) for the axis along which the tool pockets of the magazine are aligned in the XY plane.

Pocket Direction

#104 = 0            ; Pocket Direction

Enter the corresponding value (1 = Positive, -1 = Negative) for the direction of travel along the Pocket Alignment axis when moving from Pocket 1 to Pocket 2. You can choose the first tool pocket from either end of the magazine to be Pocket 1.

X Pocket 1

#105 = 0            ; X Pocket 1 Machine Coordinate(mm)

Enter the X Axis machine coordinate of the center of the Pocket 1. You can find information on determining this value here.

Y Pocket 1

#106 = 0            ; Y Pocket 1 Machine Coordinate(mm)

Enter the Y Axis machine coordinate of the center of Pocket 1. You can find information on determining this value here.

Z Engage

#107 = 0            ; Z Engage Machine Coordinate(mm)

Enter the Z axis machine coordinate of the engagement target position. This is the position that the spindle will plunge to when engaging the RapidChange ATC Socket. You can find information on determining this value here.

Z Move To Load

#108 = 0            ; Z Move To Load Machine Coordinate(mm)

Enter the Z axis machine coordinate of the position to which the spindle should rise after unloading a tool before traversing the magazine to the pocket of the tool to be loaded. You can find information on determining this value here.

Z Safe Clearance

#109 = 0            ; Z Safe Clearance Machine Coordinate(mm)

Enter the Z axis position for the safe clearance of all potential obstacles.

Engage Feed Rate

#110 = 0            ; Engage Feed Rate(mm/min)

Enter the feed rate to use for the engagement process. This feed rate will be employed for the plunge and retreat portion of the loading/unloading process. You can find information on determining this value here.

Unload RPM

#111 = 0            ; Unload RPM

Enter the RPM to spin counter-clockwise when unloading a tool. You can find information on determining this value here.

Load RPM

#112 = 0            ; Load RPM

Enter the RPM to spin clockwise when loading a tool. You can find information on determining this value here.

Spin Up Delay

#113 = 0            ; Spin Up Delay (seconds)

Enter the amount of time to dwell while the spindle spins up to speed before plunging to load or unload a tool. Use this delay to ensure that the spindle comes to full Unload RPM or Load RPM before plunging to engagement.

Pre-Tool Change Spin Down Delay

#114 = 0            ; Pre-Tool Change Spin Down Delay (seconds) 

Enter the amount of time to dwell while the spindle spins down at the beginning of a call to M6. Use this delay to ensure that the spindle has completely stopped spinning before executing a tool change.

Unload Engage Delay

#115 = 0            ; Unload Engage Delay (seconds)

This setting provides the opportunity to increase the amount of time of engagement when unloading a tool. This will cause the spindle to dwell at Z Engage for the specified amount of time before retreating during the unloading process. In most applications, no dwell time is needed, so in most cases this value should remain 0.

Tool Setter Mode

#116 = 0            ; Tool Setter Mode

This setting is provided for convenience in disabling the tool touch off macro from being called after a tool change. This can be useful when configuring your magazine or performing diagnostics to shorten the tool change cycle. Enter 0 to disable, 1 to enable.

X Tool Setter

#117 = 0            ; X Tool Setter Machine Coordinate(mm)

Enter the X axis machine coordinate of the center of your tool setter.

Y Tool Setter

#118 = 0            ; Y Tool Setter Machine Coordinate(mm)

Enter the Y axis machine coordinate of the center of your tool setter.

Z Start Seek

#119 = 0            ; Z Start Seek Machine Coordinate(mm)

Enter the Z axis machine coordinate of the position at which to begin the initial straight probe toward the tool setter. You can find information on determining this value here.

Z Move To Tool Setter (Z Move To Probe)

#120 = 0            ; Z Move To Tool Setter Machine Coordinate(mm)

Enter the Z axis machine coordinate of the position to rise to before moving above the tool setter. You can find information on determining this value here.

Seek Feed Rate

#121 = 0            ; Seek Feed Rate(mm/min)

Enter the feed rate for the initial straight probe for the tool touch off. You can find information on determining this value here.

Seek Max Distance

#122 = 0            ; Seek Max Distance(mm)

This setting is not currently used by the tool touch off macro and can be ignored.

Retreat Distance (Seek Retreat)

#123 = 0            ; Retreat Distance(mm)

Enter the distance to retreat after making contact with the tool setter on the initial straight probe down, before probing again. Note that this is an incremental distance and not a machine coordinate position.

Input Number

#124 = 0            ; Input Number

Enter the number of the input configured for your tool setter as indicated in the wizard. INPUT1 = 1, INPUT2 = 2, etc.

Set Feed Rate

#125 = 0            ; Set Feed Rate(mm/min)

Enter the feed rate for the second straight probe for the tool touch off. You can find information on determining this value here.

Dust Cover Mode

#130 = 0            ; Dust Cover Mode

Enter the value corresponding to the mode of dust cover control that you are employing (Disabled = 0, Axis Controlled = 1, Output Controlled = 2). You can learn more about dust cover controls here.

Dust Cover Axis

#131 = 0            ; Dust Cover Axis

This setting applies to Axis Controlled Dust Cover Mode only. Enter the value corresponding to the axis being used to control the dust cover (A = 0, B = 1, C = 2).

Dust Cover Axis Closed

#132 = 0            ; Dust Cover Axis Closed Machine Coordinate(mm)

This setting applies to Axis Controlled Dust Cover Mode only. Enter the machine coordinate of the position at which the dust cover is fully closed. This value should usually be 0. You can find information on determining this value here.

Dust Cover Axis Open

#133 = 0            ; Dust Cover Axis Open Machine Coordinate(mm)

This setting applies to Axis Controlled Dust Cover Mode only. Enter the machine coordinate of the position at which the dust cover is fully open. You can find information on determining this value here.

Dust Cover Output

#134 = 0            ; Dust Cover Output

This setting applies to Output Controlled Dust Cover Mode only. Enter the number of the output you have configured for controlling the dust cover as indicated in the wizard. OUTPUT1 = 1, OUTPUT2 = 2, etc.

Dust Cover Dwell Time

#135 = 0            ; Dust Cover Output Dwell Time(seconds)

This setting applies to Output Controlled Dust Cover Mode only. Enter the time to dwell while the dust cover is opening or closing. This value should correspond to the time it takes to fully open or close the dust cover. This prevents any movement from executing until the dust cover motion is complete.

Tool Recognition Mode

#136 = 0            ; Tool Recognition Mode

Use this setting to enable or disable tool recognition (0 = Disabled, 1 = Enabled). It is important to note that if tool recognition is disabled, program execution WILL NOT pause upon failure to load or unload. The next update for Centroid CNC12 will include another mode providing a pause in program execution upon each load or unload for user confirmation as a safety feature.

Z Zone 1

#137 = 0            ; Z Zone 1 Machine Coordinate(mm)

Enter the Z axis machine coordinate position for Tool Recognition Zone 1. You can find information on determining this value here.

Z Zone 2

#138 = 0            ; Z Zone 2 Machine Coordinate(mm)

Enter the Z axis machine coordinate position for Tool Recognition Zone 2. You can find information on determining this value here.

Tool Recognition Input

#139 = 0            ; Tool Recognition Input

Enter the number of the input configured for your tool recognition IR sensor as indicated in the wizard. INPUT1 = 1, INPUT2 = 2, etc.

Tool Touch Off Macro Path

#300 = "/cncm/rapidchangeatc/rc_set_tool_offset.mac"  ; Tool touch off macro path

Enter here the path of the tool touch off macro that should be called from M6 after loading a tool. The default value is shown above and references the provided Tool Touch Off macro. You may override the provided macro and use a custom one in it’s place by indicating the path to the macro within the quotation marks.

Updated on February 13, 2024

Still looking for answers? Ask our community on Discord.