Re: Planet CNC ATC Script
You cam modify M6 script to add carousel rotation.
Re: Planet CNC ATC Script
Quote:
Originally Posted by
impi62
Hello. Is there someone who can help me with Carousel type ATC. Ive been struggling along for weeks with this. I have fitted a carousel type ATC to my mill running Mk3/9
The corousel is driven by servo motor.
If im correct in my thinking, once the carousel is homed and at position 1, the rest of the tools will be at a certain degree of rotation of the carousel? So for a 12 position carousel that would be every 30 degrees? Sounds pretty straight forward unless im over simplifying this? If this is indeed the case, what im having an issue with is in the tool table theres only options to assign XYZ to the tool. No option for rotary axis in degrees? Ive searched the internet for weeks and find very little info on planet cnc with carousel. Found a video with a geneva drive (not rotary) and a video in German which ive looked at over and over and cant make sense of. If there someone who can shed some light id be truly grateful
Thank you in advance
Which controller you using ??? explain me everything at [email protected]
Re: Planet CNC ATC Script
Thank you. Yes i figured that, but dont know how to modify script. Thats exactly what i need help with. Maybe if i can see a working M6 script with carousel so i can get an idea to modify for my use....
When i look at default M6 script i dont see anything about carousel
Re: Planet CNC ATC Script
I recommend taking a look at the M6 script file code, and locate the "Move To" section. Here you can add the move lines of gcode for your A axis.
Guide on how to access script code:
https://cnc.zone/kb/tutorials/easy/how_to_edit_built-in_script_files
Re: Planet CNC ATC Script
Thank you for reply. I tried this. I added tool at top of script and at the point in the script "Move To" I added the line G53 G00 A#<tool>
So that seems to do something right. When i run the script the A axis moves to "20". But now how do I add other tool locations? I tried adding a tool at A=40 as below but how to point to that in script when tool No.2 is called?
#<tool> = 20.000 (Tool No.1)
;#<tool> = 40.000 (Tool No.2)
o<chk> if[LNOT[ACTIVE[]]]
M6
M99
o<chk> endif
o<chk> if [LNOT[#<_tc_enable>]]
M6
M99
o<chk> endif
o<PlanetCNC> if[[#<_tc_toolmeasure>] AND [#<_probe_pin_1> EQ 0] AND [#<_probe_pin_2> EQ 0]]
(msg,Sensor is not configured)
M2
o<PlanetCNC> endif
M73
G17 G08 G15 G90 G91.1 G90.2 G94
M50P0
M55P0
M56P0
M57P0
M10P1
M11P1
(print,Toolchange)
#<toisset>=0
#<wstarta> = #<_a>
#<wstarty> = #<_y>
#<wstartz> = #<_z>
#<spindle> = #<_spindle>
o<sp> if [#<_tc_spindlecheck> AND [#<spindle> NE 5]]
(print, Spindle is ON)
M5
o<sp> endif
o<st> if [#<_tc_skipsame> AND [#<_current_tool> EQ #<_selected_tool>]]
(print, Skip same tool)
M99
o<st> endif
o<sh> if [#<_tc_safeheight_en>]
(print, Move to safe height)
G53 G00 Z#<_tc_safeheight>
o<sh> endif
;o<po> if [#<_tc_pos_en>]
;(print, Move to position)
;o<sh> if [#<_tc_safeheight_en>]
;G53 G00 A#<test_a> Y#<_tc_pos_y>
;G53 G00 Z#<_tc_pos_z>
o<sh> if [#<_tc_safeheight_en>]
G53 G00 A#<tool>
o<sh> endif
;o<po> endif
G09
o<ac> if [AND[#<_tc_action>, 1]]
o<tn> if [#<_toolchangename>]
(msg,Change tool to\ $<toolchangename>)
o<tn> else
(msg,Change tool:\ #<_current_tool,0>: $<current_toolname>\to\ #<_selected_tool,0>: $<selected_toolname>)
o<tn> endif
o<ac> else
o<tn> if [#<_toolchangename>]
(print, Change tool to $<toolchangename>)
o<tn> else
(print, Change tool #<_current_tool,0> to #<_selected_tool,0>)
o<tn> endif
o<ac> endif
o<ac> if [AND[#<_tc_action>, 2]]
M0
o<ac> endif
G09
o<atcen> if [#<_tc_atc_en>]
(print, ATC enabled)
o<un> if [#<_current_tool> GT 0]
(print, Unload tool #<_current_tool,0>)
o<ex> if [#<_tool_exists|#<_current_tool>> EQ 0]
(msg,Current tool #<_current_tool,0> does not exist in tool table)
M2
o<ex> endif
o<skp> if [#<_tool_skipchange_num|#<_current_tool>> EQ 0]
#<unposx> = #<_tool_tc_x_num|#<_current_tool>>
#<unposy> = #<_tool_tc_y_num|#<_current_tool>>
#<unposz> = #<_tool_tc_z_num|#<_current_tool>>
#<unposx_in1> = [#<unposx> - #<_tc_unload_in1_x>]
#<unposy_in1> = [#<unposy> - #<_tc_unload_in1_y>]
#<unposz_in1> = [#<unposz> - #<_tc_unload_in1_z>]
#<unposx_in2> = [#<unposx_in1> - #<_tc_unload_in2_x>]
#<unposy_in2> = [#<unposy_in1> - #<_tc_unload_in2_y>]
#<unposz_in2> = [#<unposz_in1> - #<_tc_unload_in2_z>]
(print, Unload in2 position X#<unposx_in2> Y#<unposy_in2> Z#<unposz_in2>)
(print, Unload in1 position X#<unposx_in1> Y#<unposy_in1> Z#<unposz_in1>)
(print, Unload position X#<unposx> Y#<unposy> Z#<unposz>)
o<unpos> if [#<_tc_safeheight_en>]
G53 G00 X#<unposx_in2> Y#<unposy_in2>
G53 G00 Z#<unposz_in2>
o<unpos> else
G53 G00 X#<unposx_in2> Y#<unposy_in2> Z#<unposz_in2>
o<unpos> endif
G53 G01 X#<unposx_in1> Y#<unposy_in1> Z#<unposz_in1> F#<_tc_atc_speed2>
G53 G01 X#<unposx> Y#<unposy> Z#<unposz> F#<_tc_atc_speed>
o<unp11> if [[#<_tc_unload_pin1> GT 0] AND [#<_tc_unload_pin1set1> GT 0]]
M62 P#<_tc_unload_pin1> Q[#<_tc_unload_pin1set1>-1]
o<unp11> endif
o<und11> if [#<_tc_unload_pin1delay1> GT 0]
G04 P#<_tc_unload_pin1delay1>
o<und11> endif
o<unp12> if [[#<_tc_unload_pin1> GT 0] AND [#<_tc_unload_pin1set2> GT 0]]
M62 P#<_tc_unload_pin1> Q[#<_tc_unload_pin1set2>-1]
o<unp12> endif
o<und12> if [#<_tc_unload_pin1delay2> GT 0]
G04 P#<_tc_unload_pin1delay2>
o<und12> endif
o<unp21> if [[#<_tc_unload_pin2> GT 0] AND [#<_tc_unload_pin2set1> GT 0]]
M62 P#<_tc_unload_pin2> Q[#<_tc_unload_pin2set1>-1]
o<unp21> endif
o<und21> if [#<_tc_unload_pin2delay1> GT 0]
G04 P#<_tc_unload_pin2delay1>
o<und21> endif
o<unp22> if [[#<_tc_unload_pin2> GT 0] AND [#<_tc_unload_pin2set2> GT 0]]
M62 P#<_tc_unload_pin2> Q[#<_tc_unload_pin2set2>-1]
o<unp22> endif
o<und22> if [#<_tc_unload_pin2delay2> GT 0]
G04 P#<_tc_unload_pin2delay2>
o<und22> endif
#<unposx_out1> = [#<unposx> + #<_tc_unload_out1_x>]
#<unposy_out1> = [#<unposy> + #<_tc_unload_out1_y>]
#<unposz_out1> = [#<unposz> + #<_tc_unload_out1_z>]
#<unposx_out2> = [#<unposx_out1> + #<_tc_unload_out2_x>]
#<unposy_out2> = [#<unposy_out1> + #<_tc_unload_out2_y>]
#<unposz_out2> = [#<unposz_out1> + #<_tc_unload_out2_z>]
(print, Unload out1 position X#<unposx_out1> Y#<unposy_out1> Z#<unposz_out1>)
(print, Unload out2 position X#<unposx_out2> Y#<unposy_out2> Z#<unposz_out2>)
G53 G01 X#<unposx_out1> Y#<unposy_out1> Z#<unposz_out1> F#<_tc_atc_speed>
G53 G01 X#<unposx_out2> Y#<unposy_out2> Z#<unposz_out2> F#<_tc_atc_speed2>
o<sh> if [#<_tc_safeheight_en>]
G53 G00 Z#<_tc_safeheight>
o<sh> endif
o<skp> endif
o<un> endif
o<ld> if [#<_selected_tool> GT 0]
(print, Load tool #<_selected_tool,0>)
o<ex> if [#<_tool_exists|#<_selected_tool>> EQ 0]
(msg,Selected tool #<_selected_tool,0> does not exist in tool table)
M2
o<ex> endif
o<skp> if [#<_tool_skipchange_num|#<_selected_tool>> EQ 0]
#<ldposx> = #<_tool_tc_x_num|#<_selected_tool>>
#<ldposy> = #<_tool_tc_y_num|#<_selected_tool>>
#<ldposz> = #<_tool_tc_z_num|#<_selected_tool>>
#<ldposx_in1> = [#<ldposx> - #<_tc_load_in1_x>]
#<ldposy_in1> = [#<ldposy> - #<_tc_load_in1_y>]
#<ldposz_in1> = [#<ldposz> - #<_tc_load_in1_z>]
#<ldposx_in2> = [#<ldposx_in1> - #<_tc_load_in2_x>]
#<ldposy_in2> = [#<ldposy_in1> - #<_tc_load_in2_y>]
#<ldposz_in2> = [#<ldposz_in1> - #<_tc_load_in2_z>]
(print, Load in2 position X#<ldposx_in2> Y#<ldposy_in2> Z#<ldposz_in2>)
(print, Load in1 position X#<ldposx_in1> Y#<ldposy_in1> Z#<ldposz_in1>)
(print, Load position X#<ldposx> Y#<ldposy> Z#<ldposz>)
o<ldpos> if [#<_tc_safeheight_en>]
G53 G00 X#<ldposx_in2> Y#<ldposy_in2>
G53 G00 Z#<ldposz_in2>
o<ldpos> else
G53 G00 X#<ldposx_in2> Y#<ldposy_in2> Z#<ldposz_in2>
o<ldpos> endif
G53 G01 X#<ldposx_in1> Y#<ldposy_in1> Z#<ldposz_in1> F#<_tc_atc_speed2>
G53 G01 X#<ldposx> Y#<ldposy> Z#<ldposz> F#<_tc_atc_speed>
o<ldp11> if [[#<_tc_load_pin1> GT 0] AND [#<_tc_load_pin1set1> GT 0]]
M62 P#<_tc_load_pin1> Q[#<_tc_load_pin1set1>-1]
o<ldp11> endif
o<ldd11> if [#<_tc_load_pin1delay1> GT 0]
G04 P#<_tc_load_pin1delay1>
o<ldd11> endif
o<ldp12> if [[#<_tc_load_pin1> GT 0] AND [#<_tc_load_pin1set2> GT 0]]
M62 P#<_tc_load_pin1> Q[#<_tc_load_pin1set2>-1]
o<ldp12> endif
o<ldd12> if [#<_tc_load_pin1delay2> GT 0]
G04 P#<_tc_load_pin1delay2>
o<ldd12> endif
o<ldp21> if [[#<_tc_load_pin2> GT 0] AND [#<_tc_load_pin2set1> GT 0]]
M62 P#<_tc_load_pin2> Q[#<_tc_load_pin2set1>-1]
o<ldp21> endif
o<ldd21> if [#<_tc_load_pin2delay1> GT 0]
G04 P#<_tc_load_pin2delay1>
o<ldd21> endif
o<ldp22> if [[#<_tc_load_pin2> GT 0] AND [#<_tc_load_pin2set2> GT 0]]
M62 P#<_tc_load_pin2> Q[#<_tc_load_pin2set2>-1]
o<ldp22> endif
o<ldd22> if [#<_tc_load_pin2delay2> GT 0]
G04 P#<_tc_load_pin2delay2>
o<ldd22> endif
#<ldposx_out1> = [#<ldposx> + #<_tc_load_out1_x>]
#<ldposy_out1> = [#<ldposy> + #<_tc_load_out1_y>]
#<ldposz_out1> = [#<ldposz> + #<_tc_load_out1_z>]
#<ldposx_out2> = [#<ldposx_out1> + #<_tc_load_out2_x>]
#<ldposy_out2> = [#<ldposy_out1> + #<_tc_load_out2_y>]
#<ldposz_out2> = [#<ldposz_out1> + #<_tc_load_out2_z>]
(print, Unload out1 position X#<ldposx_out1> Y#<ldposy_out1> Z#<ldposz_out1>)
(print, Unload out2 position X#<ldposx_out2> Y#<ldposy_out2> Z#<ldposz_out2>)
G53 G01 X#<ldposx_out1> Y#<ldposy_out1> Z#<ldposz_out1> F#<_tc_atc_speed>
G53 G01 X#<ldposx_out2> Y#<ldposy_out2> Z#<ldposz_out2> F#<_tc_atc_speed2>
o<sh> if [#<_tc_safeheight_en>]
G53 G00 Z#<_tc_safeheight>
o<sh> endif
o<skp> endif
o<ld> endif
M6
o<atcen> else
M6
o<atcen> endif
o<tm> if [[#<_tc_toolmeasure> GT 0] AND [#<_tool_skipmeasure_num|#<_current_tool>> EQ 0]]
G09
(print, Measure tool)
#<sox> = [DEF[#<_tool_so_x_num|#<_current_tool>>,0]]
#<soy> = [DEF[#<_tool_so_y_num|#<_current_tool>>,0]]
#<soz> = [DEF[#<_tool_so_z_num|#<_current_tool>>,0]]
G53 G00 Z#<_tooloff_safeheight>
G53 G00 X[#<_tooloff_sensorx> - #<sox>] Y[#<_tooloff_sensory> - #<soy>]
G53 G00 Z#<_tooloff_rapidheight>
M11P0
G53 G38.2 Z-100000 F#<_tooloff_speed>
G91 G53 G01 Z[+#<_tooloff_swdist>]
o<low> if [#<_tooloff_speed_low> GT 0]
G90 G53 G38.2 Z-100000 F#<_tooloff_speed_low>
G91 G53 G01 Z[+#<_tooloff_swdist>] F#<_tooloff_speed>
o<low> endif
M11P1 G90
G53 G00 Z#<_tooloff_safeheight>
o<chk> if[ACTIVE[] AND NOTEXISTS[#<_probe_z>]]
(msg,Measuring failed)
M2
o<chk> endif
#<off> = [#<_probe_z> - #<_tooloff_sensorz> - #<soz>]
o<tmset> if [#<_tc_toolmeasure> EQ 2]
(print, Set tooltable Z#<off>)
G10 L1 P#<_current_tool> Z#<off>
#<toisset>=2
o<tmset> elseif [#<_tc_toolmeasure> EQ 1]
(print, Set tool offset Z#<off>)
G43.1 Z#<off>
#<toisset>=1
o<tmset> endif
o<tm> endif
o<toen> if [#<_tc_tooloff_en>]
M72
M71
(print, Enable tool offset)
o<tois> if [#<_tc_tooloff_en> EQ 2]
G43
o<tois> elseif [#<_tc_tooloff_en> EQ 1]
G43.1
o<tois> endif
o<toen> endif
o<ar> if [#<_tc_autoreturn>]
(print,AutoReturn)
o<chk> if [#<_z> LT #<wstartz>]
G00 Z#<wstartz>
o<chk> endif
G00 X#<wstartx> Y#<wstarty>
G00 Z#<wstartz>
o<ar> endif
o<sp> if [#<_tc_spindlecheck> AND [#<spindle> EQ 3]]
(print, Turn spindle CW)
M3
o<sp> elseif [#<_tc_spindlecheck> AND [#<spindle> EQ 4]]
(print, Turn spindle CCW)
M4
o<sp> endif
Re: Planet CNC ATC Script
Re: Planet CNC ATC Script
_tool_par1_num, _tool_par2_num, _tool_par3_num
Must i put this parameters.txt?
I already set tool 1 to par1
Re: Planet CNC ATC Script
These are changes to script - see below in purple
Must i add _tool_par1_num to the parameter.txt file? and what is num??
o<chk> if[LNOT[ACTIVE[]]]
M6
M99
o<chk> endif
o<chk> if [LNOT[#<_tc_enable>]]
M6
M99
o<chk> endif
o<PlanetCNC> if[[#<_tc_toolmeasure>] AND [#<_probe_pin_1> EQ 0] AND [#<_probe_pin_2> EQ 0]]
(msg,Sensor is not configured)
M2
o<PlanetCNC> endif
M73
G17 G08 G15 G90 G91.1 G90.2 G94
M50P0
M55P0
M56P0
M57P0
M10P1
M11P1
(print,Toolchange)
#<toisset>=0
#<wstarta> = #<_a>
#<wstarty> = #<_y>
#<wstartz> = #<_z>
#<spindle> = #<_spindle>
o<sp> if [#<_tc_spindlecheck> AND [#<spindle> NE 5]]
(print, Spindle is ON)
M5
o<sp> endif
o<st> if [#<_tc_skipsame> AND [#<_current_tool> EQ #<_selected_tool>]]
(print, Skip same tool)
M99
o<st> endif
o<sh> if [#<_tc_safeheight_en>]
(print, Move to safe height)
G53 G00 Z#<_tc_safeheight>
o<sh> endif
o<po> if [#<_tc_pos_en>]
(print, Move to position)
o<sh> if [#<_tc_safeheight_en>]
G53 G00 A#<_tc_pos_a> Y#<_tc_pos_y>
G53 G00 Z#<_tc_pos_z>
o<sh> else
G53 G00 A#<_tc_pos_a> Y#<_tc_pos_y> Z#<_tc_pos_z>
o<sh> endif
o<po> endif
G09
o<ac> if [AND[#<_tc_action>, 1]]
o<tn> if [#<_toolchangename>]
(msg,Change tool to\ $<toolchangename>)
o<tn> else
(msg,Change tool:\ #<_current_tool,0>: $<current_toolname>\to\ #<_selected_tool,0>: $<selected_toolname>)
o<tn> endif
o<ac> else
o<tn> if [#<_toolchangename>]
(print, Change tool to $<toolchangename>)
o<tn> else
(print, Change tool #<_current_tool,0> to #<_selected_tool,0>)
o<tn> endif
o<ac> endif
o<ac> if [AND[#<_tc_action>, 2]]
M0
o<ac> endif
G09
o<atcen> if [#<_tc_atc_en>]
(print, ATC enabled)
o<un> if [#<_current_tool> GT 0]
(print, Unload tool #<_current_tool,0>)
o<ex> if [#<_tool_exists|#<_current_tool>> EQ 0]
(msg,Current tool #<_current_tool,0> does not exist in tool table)
M2
o<ex> endif
o<skp> if [#<_tool_skipchange_num|#<_current_tool>> EQ 0]
#<unposx> = #<_tool_tc_x_num|#<_current_tool>>
#<unposy> = #<_tool_tc_y_num|#<_current_tool>>
#<unposz> = #<_tool_tc_z_num|#<_current_tool>>
#<unposx_in1> = [#<unposx> - #<_tc_unload_in1_x>]
#<unposy_in1> = [#<unposy> - #<_tc_unload_in1_y>]
#<unposz_in1> = [#<unposz> - #<_tc_unload_in1_z>]
#<unposx_in2> = [#<unposx_in1> - #<_tc_unload_in2_x>]
#<unposy_in2> = [#<unposy_in1> - #<_tc_unload_in2_y>]
#<unposz_in2> = [#<unposz_in1> - #<_tc_unload_in2_z>]
(print, Unload in2 position X#<unposx_in2> Y#<unposy_in2> Z#<unposz_in2>)
(print, Unload in1 position X#<unposx_in1> Y#<unposy_in1> Z#<unposz_in1>)
(print, Unload position X#<unposx> Y#<unposy> Z#<unposz>)
o<unpos> if [#<_tc_safeheight_en>]
G53 G00 X#<unposx_in2> Y#<unposy_in2>
G53 G00 Z#<unposz_in2>
o<unpos> else
G53 G00 X#<unposx_in2> Y#<unposy_in2> Z#<unposz_in2>
o<unpos> endif
G53 G01 X#<unposx_in1> Y#<unposy_in1> Z#<unposz_in1> F#<_tc_atc_speed2>
G53 G01 X#<unposx> Y#<unposy> Z#<unposz> F#<_tc_atc_speed>
o<unp11> if [[#<_tc_unload_pin1> GT 0] AND [#<_tc_unload_pin1set1> GT 0]]
M62 P#<_tc_unload_pin1> Q[#<_tc_unload_pin1set1>-1]
o<unp11> endif
o<und11> if [#<_tc_unload_pin1delay1> GT 0]
G04 P#<_tc_unload_pin1delay1>
o<und11> endif
o<unp12> if [[#<_tc_unload_pin1> GT 0] AND [#<_tc_unload_pin1set2> GT 0]]
M62 P#<_tc_unload_pin1> Q[#<_tc_unload_pin1set2>-1]
o<unp12> endif
o<und12> if [#<_tc_unload_pin1delay2> GT 0]
G04 P#<_tc_unload_pin1delay2>
o<und12> endif
o<unp21> if [[#<_tc_unload_pin2> GT 0] AND [#<_tc_unload_pin2set1> GT 0]]
M62 P#<_tc_unload_pin2> Q[#<_tc_unload_pin2set1>-1]
o<unp21> endif
o<und21> if [#<_tc_unload_pin2delay1> GT 0]
G04 P#<_tc_unload_pin2delay1>
o<und21> endif
o<unp22> if [[#<_tc_unload_pin2> GT 0] AND [#<_tc_unload_pin2set2> GT 0]]
M62 P#<_tc_unload_pin2> Q[#<_tc_unload_pin2set2>-1]
o<unp22> endif
o<und22> if [#<_tc_unload_pin2delay2> GT 0]
G04 P#<_tc_unload_pin2delay2>
o<und22> endif
#<unposx_out1> = [#<unposx> + #<_tc_unload_out1_x>]
#<unposy_out1> = [#<unposy> + #<_tc_unload_out1_y>]
#<unposz_out1> = [#<unposz> + #<_tc_unload_out1_z>]
#<unposx_out2> = [#<unposx_out1> + #<_tc_unload_out2_x>]
#<unposy_out2> = [#<unposy_out1> + #<_tc_unload_out2_y>]
#<unposz_out2> = [#<unposz_out1> + #<_tc_unload_out2_z>]
(print, Unload out1 position X#<unposx_out1> Y#<unposy_out1> Z#<unposz_out1>)
(print, Unload out2 position X#<unposx_out2> Y#<unposy_out2> Z#<unposz_out2>)
G53 G01 X#<unposx_out1> Y#<unposy_out1> Z#<unposz_out1> F#<_tc_atc_speed>
G53 G01 X#<unposx_out2> Y#<unposy_out2> Z#<unposz_out2> F#<_tc_atc_speed2>
o<sh> if [#<_tc_safeheight_en>]
G53 G00 Z#<_tc_safeheight>
o<sh> endif
o<skp> endif
o<un> endif
o<ld> if [#<_selected_tool> GT 0]
(print, Load tool #<_selected_tool,0>)
o<ex> if [#<_tool_exists|#<_selected_tool>> EQ 0]
(msg,Selected tool #<_selected_tool,0> does not exist in tool table)
M2
o<ex> endif
o<skp> if [#<_tool_skipchange_num|#<_selected_tool>> EQ 0]
#<ldposx> = #<_tool_tc_x_num|#<_selected_tool>>
#<ldposy> = #<_tool_tc_y_num|#<_selected_tool>>
#<ldposz> = #<_tool_tc_z_num|#<_selected_tool>>
#<ldposx_in1> = [#<ldposx> - #<_tc_load_in1_x>]
#<ldposy_in1> = [#<ldposy> - #<_tc_load_in1_y>]
#<ldposz_in1> = [#<ldposz> - #<_tc_load_in1_z>]
#<ldposx_in2> = [#<ldposx_in1> - #<_tc_load_in2_x>]
#<ldposy_in2> = [#<ldposy_in1> - #<_tc_load_in2_y>]
#<ldposz_in2> = [#<ldposz_in1> - #<_tc_load_in2_z>]
(print, Load in2 position X#<ldposx_in2> Y#<ldposy_in2> Z#<ldposz_in2>)
(print, Load in1 position X#<ldposx_in1> Y#<ldposy_in1> Z#<ldposz_in1>)
(print, Load position X#<ldposx> Y#<ldposy> Z#<ldposz>)
o<ldpos> if [#<_tc_safeheight_en>]
G53 G00 X#<ldposx_in2> Y#<ldposy_in2>
G53 G00 Z#<ldposz_in2>
o<ldpos> else
G53 G00 X#<ldposx_in2> Y#<ldposy_in2> Z#<ldposz_in2>
o<ldpos> endif
G53 G01 X#<ldposx_in1> Y#<ldposy_in1> Z#<ldposz_in1> F#<_tc_atc_speed2>
G53 G01 X#<ldposx> Y#<ldposy> Z#<ldposz> F#<_tc_atc_speed>
o<ldp11> if [[#<_tc_load_pin1> GT 0] AND [#<_tc_load_pin1set1> GT 0]]
M62 P#<_tc_load_pin1> Q[#<_tc_load_pin1set1>-1]
o<ldp11> endif
o<ldd11> if [#<_tc_load_pin1delay1> GT 0]
G04 P#<_tc_load_pin1delay1>
o<ldd11> endif
o<ldp12> if [[#<_tc_load_pin1> GT 0] AND [#<_tc_load_pin1set2> GT 0]]
M62 P#<_tc_load_pin1> Q[#<_tc_load_pin1set2>-1]
o<ldp12> endif
o<ldd12> if [#<_tc_load_pin1delay2> GT 0]
G04 P#<_tc_load_pin1delay2>
o<ldd12> endif
o<ldp21> if [[#<_tc_load_pin2> GT 0] AND [#<_tc_load_pin2set1> GT 0]]
M62 P#<_tc_load_pin2> Q[#<_tc_load_pin2set1>-1]
o<ldp21> endif
o<ldd21> if [#<_tc_load_pin2delay1> GT 0]
G04 P#<_tc_load_pin2delay1>
o<ldd21> endif
o<ldp22> if [[#<_tc_load_pin2> GT 0] AND [#<_tc_load_pin2set2> GT 0]]
M62 P#<_tc_load_pin2> Q[#<_tc_load_pin2set2>-1]
o<ldp22> endif
o<ldd22> if [#<_tc_load_pin2delay2> GT 0]
G04 P#<_tc_load_pin2delay2>
o<ldd22> endif
#<ldposx_out1> = [#<ldposx> + #<_tc_load_out1_x>]
#<ldposy_out1> = [#<ldposy> + #<_tc_load_out1_y>]
#<ldposz_out1> = [#<ldposz> + #<_tc_load_out1_z>]
#<ldposx_out2> = [#<ldposx_out1> + #<_tc_load_out2_x>]
#<ldposy_out2> = [#<ldposy_out1> + #<_tc_load_out2_y>]
#<ldposz_out2> = [#<ldposz_out1> + #<_tc_load_out2_z>]
(print, Unload out1 position X#<ldposx_out1> Y#<ldposy_out1> Z#<ldposz_out1>)
(print, Unload out2 position X#<ldposx_out2> Y#<ldposy_out2> Z#<ldposz_out2>)
G53 G01 X#<ldposx_out1> Y#<ldposy_out1> Z#<ldposz_out1> F#<_tc_atc_speed>
G53 G01 X#<ldposx_out2> Y#<ldposy_out2> Z#<ldposz_out2> F#<_tc_atc_speed2>
o<sh> if [#<_tc_safeheight_en>]
G53 G00 Z#<_tc_safeheight>
o<sh> endif
o<skp> endif
o<ld> endif
M6
o<atcen> else
M6
o<atcen> endif
o<tm> if [[#<_tc_toolmeasure> GT 0] AND [#<_tool_skipmeasure_num|#<_current_tool>> EQ 0]]
G09
(print, Measure tool)
#<sox> = [DEF[#<_tool_so_x_num|#<_current_tool>>,0]]
#<soy> = [DEF[#<_tool_so_y_num|#<_current_tool>>,0]]
#<soz> = [DEF[#<_tool_so_z_num|#<_current_tool>>,0]]
G53 G00 Z#<_tooloff_safeheight>
G53 G00 X[#<_tooloff_sensorx> - #<sox>] Y[#<_tooloff_sensory> - #<soy>]
G53 G00 Z#<_tooloff_rapidheight>
M11P0
G53 G38.2 Z-100000 F#<_tooloff_speed>
G91 G53 G01 Z[+#<_tooloff_swdist>]
o<low> if [#<_tooloff_speed_low> GT 0]
G90 G53 G38.2 Z-100000 F#<_tooloff_speed_low>
G91 G53 G01 Z[+#<_tooloff_swdist>] F#<_tooloff_speed>
o<low> endif
M11P1 G90
G53 G00 Z#<_tooloff_safeheight>
o<chk> if[ACTIVE[] AND NOTEXISTS[#<_probe_z>]]
(msg,Measuring failed)
M2
o<chk> endif
#<off> = [#<_probe_z> - #<_tooloff_sensorz> - #<soz>]
o<tmset> if [#<_tc_toolmeasure> EQ 2]
(print, Set tooltable Z#<off>)
G10 L1 P#<_current_tool> Z#<off>
#<toisset>=2
o<tmset> elseif [#<_tc_toolmeasure> EQ 1]
(print, Set tool offset Z#<off>)
G43.1 Z#<off>
#<toisset>=1
o<tmset> endif
o<tm> endif
o<toen> if [#<_tc_tooloff_en>]
M72
M71
(print, Enable tool offset)
o<tois> if [#<_tc_tooloff_en> EQ 2]
G43
o<tois> elseif [#<_tc_tooloff_en> EQ 1]
G43.1
o<tois> endif
o<toen> endif
o<ar> if [#<_tc_autoreturn>]
(print,AutoReturn)
o<chk> if [#<_z> LT #<wstartz>]
G00 Z#<wstartz>
o<chk> endif
G00 X#<wstartx> Y#<wstarty>
G00 Z#<wstartz>
o<ar> endif
o<sp> if [#<_tc_spindlecheck> AND [#<spindle> EQ 3]]
(print, Turn spindle CW)
M3
o<sp> elseif [#<_tc_spindlecheck> AND [#<spindle> EQ 4]]
(print, Turn spindle CCW)
M4
o<sp> endif
Re: Planet CNC ATC Script
Please can you give some kind of actual example. I'm struggling with this for weeks now
3 Attachment(s)
Re: Planet CNC ATC Script
Re: Planet CNC ATC Script
This is my M6 script now
o<chk> if[LNOT[ACTIVE[]]]
M6
M99
o<chk> endif
o<chk> if [LNOT[#<_tc_enable>]]
M6
M99
o<chk> endif
o<PlanetCNC> if[[#<_tc_toolmeasure>] AND [#<_probe_pin_1> EQ 0] AND [#<_probe_pin_2> EQ 0]]
(msg,Sensor is not configured)
M2
o<PlanetCNC> endif
M73
G17 G08 G15 G90 G91.1 G90.2 G94
M50P0
M55P0
M56P0
M57P0
M10P1
M11P1
(print,Toolchange)
#<toisset>=0
#<wstarta> = #<_a>
#<wstarty> = #<_y>
#<wstartz> = #<_z>
#<spindle> = #<_spindle>
o<sp> if [#<_tc_spindlecheck> AND [#<spindle> NE 5]]
(print, Spindle is ON)
M5
o<sp> endif
o<st> if [#<_tc_skipsame> AND [#<_current_tool> EQ #<_selected_tool>]]
(print, Skip same tool)
M99
o<st> endif
o<sh> if [#<_tc_safeheight_en>]
(print, Move to safe height)
G53 G00 Z#<_tc_safeheight>
o<sh> endif
o<po> if [#<_tc_pos_en>]
(print, Move to position)
o<sh> if [#<_tc_safeheight_en>]
G53 G00 A#<_tool_par1_num> Y#<_tc_pos_y>
G53 G00 Z#<_tc_pos_z>
o<sh> else
G53 G00 A#<_tool_par1_num> Y#<_tc_pos_y> Z#<_tc_pos_z>
o<sh> endif
o<po> endif
G09
o<ac> if [AND[#<_tc_action>, 1]]
o<tn> if [#<_toolchangename>]
(msg,Change tool to\ $<toolchangename>)
o<tn> else
(msg,Change tool:\ #<_current_tool,0>: $<current_toolname>\to\ #<_selected_tool,0>: $<selected_toolname>)
o<tn> endif
o<ac> else
o<tn> if [#<_toolchangename>]
(print, Change tool to $<toolchangename>)
o<tn> else
(print, Change tool #<_current_tool,0> to #<_selected_tool,0>)
o<tn> endif
o<ac> endif
o<ac> if [AND[#<_tc_action>, 2]]
M0
o<ac> endif
G09
o<atcen> if [#<_tc_atc_en>]
(print, ATC enabled)
o<un> if [#<_current_tool> GT 0]
(print, Unload tool #<_current_tool,0>)
o<ex> if [#<_tool_exists|#<_current_tool>> EQ 0]
(msg,Current tool #<_current_tool,0> does not exist in tool table)
M2
o<ex> endif
o<skp> if [#<_tool_skipchange_num|#<_current_tool>> EQ 0]
#<unposx> = #<_tool_tc_x_num|#<_current_tool>>
#<unposy> = #<_tool_tc_y_num|#<_current_tool>>
#<unposz> = #<_tool_tc_z_num|#<_current_tool>>
#<unposx_in1> = [#<unposx> - #<_tc_unload_in1_x>]
#<unposy_in1> = [#<unposy> - #<_tc_unload_in1_y>]
#<unposz_in1> = [#<unposz> - #<_tc_unload_in1_z>]
#<unposx_in2> = [#<unposx_in1> - #<_tc_unload_in2_x>]
#<unposy_in2> = [#<unposy_in1> - #<_tc_unload_in2_y>]
#<unposz_in2> = [#<unposz_in1> - #<_tc_unload_in2_z>]
(print, Unload in2 position X#<unposx_in2> Y#<unposy_in2> Z#<unposz_in2>)
(print, Unload in1 position X#<unposx_in1> Y#<unposy_in1> Z#<unposz_in1>)
(print, Unload position X#<unposx> Y#<unposy> Z#<unposz>)
o<unpos> if [#<_tc_safeheight_en>]
G53 G00 X#<unposx_in2> Y#<unposy_in2>
G53 G00 Z#<unposz_in2>
o<unpos> else
G53 G00 X#<unposx_in2> Y#<unposy_in2> Z#<unposz_in2>
o<unpos> endif
G53 G01 X#<unposx_in1> Y#<unposy_in1> Z#<unposz_in1> F#<_tc_atc_speed2>
G53 G01 X#<unposx> Y#<unposy> Z#<unposz> F#<_tc_atc_speed>
o<unp11> if [[#<_tc_unload_pin1> GT 0] AND [#<_tc_unload_pin1set1> GT 0]]
M62 P#<_tc_unload_pin1> Q[#<_tc_unload_pin1set1>-1]
o<unp11> endif
o<und11> if [#<_tc_unload_pin1delay1> GT 0]
G04 P#<_tc_unload_pin1delay1>
o<und11> endif
o<unp12> if [[#<_tc_unload_pin1> GT 0] AND [#<_tc_unload_pin1set2> GT 0]]
M62 P#<_tc_unload_pin1> Q[#<_tc_unload_pin1set2>-1]
o<unp12> endif
o<und12> if [#<_tc_unload_pin1delay2> GT 0]
G04 P#<_tc_unload_pin1delay2>
o<und12> endif
o<unp21> if [[#<_tc_unload_pin2> GT 0] AND [#<_tc_unload_pin2set1> GT 0]]
M62 P#<_tc_unload_pin2> Q[#<_tc_unload_pin2set1>-1]
o<unp21> endif
o<und21> if [#<_tc_unload_pin2delay1> GT 0]
G04 P#<_tc_unload_pin2delay1>
o<und21> endif
o<unp22> if [[#<_tc_unload_pin2> GT 0] AND [#<_tc_unload_pin2set2> GT 0]]
M62 P#<_tc_unload_pin2> Q[#<_tc_unload_pin2set2>-1]
o<unp22> endif
o<und22> if [#<_tc_unload_pin2delay2> GT 0]
G04 P#<_tc_unload_pin2delay2>
o<und22> endif
#<unposx_out1> = [#<unposx> + #<_tc_unload_out1_x>]
#<unposy_out1> = [#<unposy> + #<_tc_unload_out1_y>]
#<unposz_out1> = [#<unposz> + #<_tc_unload_out1_z>]
#<unposx_out2> = [#<unposx_out1> + #<_tc_unload_out2_x>]
#<unposy_out2> = [#<unposy_out1> + #<_tc_unload_out2_y>]
#<unposz_out2> = [#<unposz_out1> + #<_tc_unload_out2_z>]
(print, Unload out1 position X#<unposx_out1> Y#<unposy_out1> Z#<unposz_out1>)
(print, Unload out2 position X#<unposx_out2> Y#<unposy_out2> Z#<unposz_out2>)
G53 G01 X#<unposx_out1> Y#<unposy_out1> Z#<unposz_out1> F#<_tc_atc_speed>
G53 G01 X#<unposx_out2> Y#<unposy_out2> Z#<unposz_out2> F#<_tc_atc_speed2>
o<sh> if [#<_tc_safeheight_en>]
G53 G00 Z#<_tc_safeheight>
o<sh> endif
o<skp> endif
o<un> endif
o<ld> if [#<_selected_tool> GT 0]
(print, Load tool #<_selected_tool,0>)
o<ex> if [#<_tool_exists|#<_selected_tool>> EQ 0]
(msg,Selected tool #<_selected_tool,0> does not exist in tool table)
M2
o<ex> endif
o<skp> if [#<_tool_skipchange_num|#<_selected_tool>> EQ 0]
#<ldposx> = #<_tool_tc_x_num|#<_selected_tool>>
#<ldposy> = #<_tool_tc_y_num|#<_selected_tool>>
#<ldposz> = #<_tool_tc_z_num|#<_selected_tool>>
#<ldposx_in1> = [#<ldposx> - #<_tc_load_in1_x>]
#<ldposy_in1> = [#<ldposy> - #<_tc_load_in1_y>]
#<ldposz_in1> = [#<ldposz> - #<_tc_load_in1_z>]
#<ldposx_in2> = [#<ldposx_in1> - #<_tc_load_in2_x>]
#<ldposy_in2> = [#<ldposy_in1> - #<_tc_load_in2_y>]
#<ldposz_in2> = [#<ldposz_in1> - #<_tc_load_in2_z>]
(print, Load in2 position X#<ldposx_in2> Y#<ldposy_in2> Z#<ldposz_in2>)
(print, Load in1 position X#<ldposx_in1> Y#<ldposy_in1> Z#<ldposz_in1>)
(print, Load position X#<ldposx> Y#<ldposy> Z#<ldposz>)
o<ldpos> if [#<_tc_safeheight_en>]
G53 G00 X#<ldposx_in2> Y#<ldposy_in2>
G53 G00 Z#<ldposz_in2>
o<ldpos> else
G53 G00 X#<ldposx_in2> Y#<ldposy_in2> Z#<ldposz_in2>
o<ldpos> endif
G53 G01 X#<ldposx_in1> Y#<ldposy_in1> Z#<ldposz_in1> F#<_tc_atc_speed2>
G53 G01 X#<ldposx> Y#<ldposy> Z#<ldposz> F#<_tc_atc_speed>
o<ldp11> if [[#<_tc_load_pin1> GT 0] AND [#<_tc_load_pin1set1> GT 0]]
M62 P#<_tc_load_pin1> Q[#<_tc_load_pin1set1>-1]
o<ldp11> endif
o<ldd11> if [#<_tc_load_pin1delay1> GT 0]
G04 P#<_tc_load_pin1delay1>
o<ldd11> endif
o<ldp12> if [[#<_tc_load_pin1> GT 0] AND [#<_tc_load_pin1set2> GT 0]]
M62 P#<_tc_load_pin1> Q[#<_tc_load_pin1set2>-1]
o<ldp12> endif
o<ldd12> if [#<_tc_load_pin1delay2> GT 0]
G04 P#<_tc_load_pin1delay2>
o<ldd12> endif
o<ldp21> if [[#<_tc_load_pin2> GT 0] AND [#<_tc_load_pin2set1> GT 0]]
M62 P#<_tc_load_pin2> Q[#<_tc_load_pin2set1>-1]
o<ldp21> endif
o<ldd21> if [#<_tc_load_pin2delay1> GT 0]
G04 P#<_tc_load_pin2delay1>
o<ldd21> endif
o<ldp22> if [[#<_tc_load_pin2> GT 0] AND [#<_tc_load_pin2set2> GT 0]]
M62 P#<_tc_load_pin2> Q[#<_tc_load_pin2set2>-1]
o<ldp22> endif
o<ldd22> if [#<_tc_load_pin2delay2> GT 0]
G04 P#<_tc_load_pin2delay2>
o<ldd22> endif
#<ldposx_out1> = [#<ldposx> + #<_tc_load_out1_x>]
#<ldposy_out1> = [#<ldposy> + #<_tc_load_out1_y>]
#<ldposz_out1> = [#<ldposz> + #<_tc_load_out1_z>]
#<ldposx_out2> = [#<ldposx_out1> + #<_tc_load_out2_x>]
#<ldposy_out2> = [#<ldposy_out1> + #<_tc_load_out2_y>]
#<ldposz_out2> = [#<ldposz_out1> + #<_tc_load_out2_z>]
(print, Unload out1 position X#<ldposx_out1> Y#<ldposy_out1> Z#<ldposz_out1>)
(print, Unload out2 position X#<ldposx_out2> Y#<ldposy_out2> Z#<ldposz_out2>)
G53 G01 X#<ldposx_out1> Y#<ldposy_out1> Z#<ldposz_out1> F#<_tc_atc_speed>
G53 G01 X#<ldposx_out2> Y#<ldposy_out2> Z#<ldposz_out2> F#<_tc_atc_speed2>
o<sh> if [#<_tc_safeheight_en>]
G53 G00 Z#<_tc_safeheight>
o<sh> endif
o<skp> endif
o<ld> endif
M6
o<atcen> else
M6
o<atcen> endif
o<tm> if [[#<_tc_toolmeasure> GT 0] AND [#<_tool_skipmeasure_num|#<_current_tool>> EQ 0]]
G09
(print, Measure tool)
#<sox> = [DEF[#<_tool_so_x_num|#<_current_tool>>,0]]
#<soy> = [DEF[#<_tool_so_y_num|#<_current_tool>>,0]]
#<soz> = [DEF[#<_tool_so_z_num|#<_current_tool>>,0]]
G53 G00 Z#<_tooloff_safeheight>
G53 G00 X[#<_tooloff_sensorx> - #<sox>] Y[#<_tooloff_sensory> - #<soy>]
G53 G00 Z#<_tooloff_rapidheight>
M11P0
G53 G38.2 Z-100000 F#<_tooloff_speed>
G91 G53 G01 Z[+#<_tooloff_swdist>]
o<low> if [#<_tooloff_speed_low> GT 0]
G90 G53 G38.2 Z-100000 F#<_tooloff_speed_low>
G91 G53 G01 Z[+#<_tooloff_swdist>] F#<_tooloff_speed>
o<low> endif
M11P1 G90
G53 G00 Z#<_tooloff_safeheight>
o<chk> if[ACTIVE[] AND NOTEXISTS[#<_probe_z>]]
(msg,Measuring failed)
M2
o<chk> endif
#<off> = [#<_probe_z> - #<_tooloff_sensorz> - #<soz>]
o<tmset> if [#<_tc_toolmeasure> EQ 2]
(print, Set tooltable Z#<off>)
G10 L1 P#<_current_tool> Z#<off>
#<toisset>=2
o<tmset> elseif [#<_tc_toolmeasure> EQ 1]
(print, Set tool offset Z#<off>)
G43.1 Z#<off>
#<toisset>=1
o<tmset> endif
o<tm> endif
o<toen> if [#<_tc_tooloff_en>]
M72
M71
(print, Enable tool offset)
o<tois> if [#<_tc_tooloff_en> EQ 2]
G43
o<tois> elseif [#<_tc_tooloff_en> EQ 1]
G43.1
o<tois> endif
o<toen> endif
o<ar> if [#<_tc_autoreturn>]
(print,AutoReturn)
o<chk> if [#<_z> LT #<wstartz>]
G00 Z#<wstartz>
o<chk> endif
G00 X#<wstartx> Y#<wstarty>
G00 Z#<wstartz>
o<ar> endif
o<sp> if [#<_tc_spindlecheck> AND [#<spindle> EQ 3]]
(print, Turn spindle CW)
M3
o<sp> elseif [#<_tc_spindlecheck> AND [#<spindle> EQ 4]]
(print, Turn spindle CCW)
M4
o<sp> endif
Re: Planet CNC ATC Script
OK managed to get it working. All tool changes working as it should. Thank you for the pointers
Now another issue. Not affecting the actual operation of the tool change but would make it faster. Does planet cnc have a "rollover"?
Meaning, can a rotary axis be set from 0 degrees to 360 degrees and instead of going to 361 degrees it "rolls over" to o again.
So that during a tool change, if tool is unloaded at 350 degrees and next tool is at 10 degrees, the axis just moves 20 degrees to the shortest distance to next tool instead of reversing 340 degrees to get back to.position 10 degree. Hope I'm making sense here.
Can anyone shed some light?
Thank you in advance
Re: Planet CNC ATC Script
Re: Planet CNC ATC Script
this only helps you if you are already at a position lager than 360°
not if you want to go from, say, 350 to 10. In this case you would need to go to 370 and then call the unwind (btw is there a gcode to call unwind)
Re: Planet CNC ATC Script
Unwind is this g-code:
G10 L9 A[#<_machine_a> MOD 360]