I thought it would be helpful to have a place where people can contribute macros they use on their machines to make their work flow simpler and easier.
The following changes need to be made to your .ini configuration file in order to call macros and sub-routines.
Under the [RS274NGC] section
change/add/use SUBROUTINE_PATH to point to the location where these subroutines are located. In the example below, there is a folder named "macros" in the folder housing the configuration files
[RS274NGC]
.....
SUBROUTINE_PATH = macros
If you want these to be visible when you are in the MDI screen, add the following, and identify the name of the macro as it is saved in the folder;
[MACROS]
MACRO = spindle_warm_up
MACRO = go_to_position
MACRO = touch_plate_x+
MACRO = touch_plate_y+
MACRO = touch_plate_z
Added by @kotlikm (Using with LinuxCNC)
I run this macro when I first get to my machine to warm the spindle bearings up. It moves my spindle to a safe location identfied in the macro, then starts at 8k rpm and jumps up 2k rpm every 60 seconds until it gets to max 24k, and then completes without moving to not risk collision.
You will need to identify within the macro your safe travel Z height as well as your safe warm up location for X and Y in machine ABS coordinates.
O<spindle_warm_up> sub
(Macro to warm up the spindle prior to cutting)
(Input your own "Safe" location for where the spindle can go through this cycle in <_SafeX> and <_SafeY>)
(Input a safe Z travel height to avoid anything in your workspace with <_TravelZ>)
(Machine will rapid to your safe travel Z height, and then will rapid to your "safe" location)
(The code will start the spindle at 8K rpm and increases by 2k every 60 seconds)
(There aren't any fail safes for making sure you have a tool that can handle the max 24K RPM)
(!!!! Use at your own risk following your own safety precautions !!!!)
#<SafeX> = 16 ( Machine ABS X coordinate where spindle can safely warm up )
#<SafeY> = 25 ( Machine ABS Y coordinate where spindle can safely warm up )
#<TravelZ> = -.25 ( machine ABS Z coordinate for travelling, typically near max Z to avoid ever hitting the work )
G90
G53 G0 Z[#<TravelZ]
G53 G0 X[#<SafeX>] Y[#<SafeY]
S8000 M3
G04 P60
S10000
G04 P60
S12000
G04 P60
S14000
G04 P60
S16000
G04 P60
S18000
G04 P60
S20000
G04 P60
S22000
G04 P60
S24000
G04 P60
M5
O<spindle_warm_up> endsub
M2
The following is code that I have written to work with a tool height setter at a known location on your spoilboard. It uses the probe_screen addon in LinuxCNC and has variables written into it as well. Modification to your setup will be needed, don't just take this code and expect to use it with your machine. X,Y location of your touch plate, as well as other minor modifications will need to be made.
G91
G28 Z0
G90
G53 G0 X80 Y38
#<z>=#<_z> (save current Z position)
G91
F #<_hal[probe.ps_searchvel]>
G38.2 Z[-#<_hal[probe.ps_probe_max]>]
G92 Z67.135
G1 Z[#<_hal[probe.ps_probe_latch]>] F#<_ini[TOOLSENSOR]RAPID_SPEED>
G4 P0.5
G38.2 Z[-#<_hal[probe.ps_probe_latch]>*2]
G92 Z67.135
G4 P0.5
G1 Z15 F1000
The information below if for users who want to add additional content to this page in similar formatting. When editing the page, just copy and past the content from below and populate your own information.
Describe the functionality of the macro and any additional details a user may need to configure or steps to run it.
Paste your macro code directly in here
Insert your asset here as stored in the macro folder