Welcome! Log In Create A New Profile

Advanced

Start G-Code Script for toolchange

Posted by IG88 
Start G-Code Script for toolchange
January 14, 2020 03:56PM
Hi all,

I've designed a toolchange system that will allow the X/Y carriage of my CoreXY printer to grab seperately parked tools. Similar to the E3D toolchange system, but much less professional (I just use permanent magnets) I plan to have 3 seperate tools E0,E1,E2.

I want to prevent the printer from trying to grab a new tool when there is already a tool on the carriage. To prevent this I'm trying to write a Start G-code sequence to detect if a tool is on the carriage, and park it where it belongs so the carriage is ready to grab a tool when beginning the print job.

To do this I'm planning on using one of the max endstop switches on each tool (I never used max endstops anyways so they are spare inputs for me). So E0 gets Xmax, E1 gets Ymax, E2 gets Zmax. So if E0 is attached to the carriage, Xmax is triggered.

After homing, the start G-Code will check if a tool is attached to the carriage. If Xmax is triggered, it will start a series of moves to park E0 in it's designated parking rack. Same goes for Ymax and Zmax.

I thought of making three IF_ statements using the status of the max endstops like this:

G28 ; Home extruder

if (Xmax == Triggered){
G1 Y20 X50 F1000 ;get in front of E0 park rack
G1 Y5 F1000 ;move toward E0 park rack
G1 X60 F1000 ;slide E0 on to its rack
G1 Y20 F1000 ;disengage from E0 park rack
}

if (Ymax == Triggered){
G1 Y20 X150 F1000 ;get in front of E1 park rack
G1 Y5 F1000 ;move toward E1 park rack
G1 X160 F1000 ;slide E1 on to its rack
G1 Y20 F1000 ;disengage from E1 park rack
}

if (Zmax == Triggered){
G1 Y20 X250 F1000 ;get in front of E2 park rack
G1 Y5 F1000 ;move toward E2 park rack
G1 X260 F1000 ;slide E2 on to its rack
G1 Y20 F1000 ;disengage from E2 park rack
}

I realise my attempt right now is extremely crude, I'm not very familliar with g-code yet. But could someone let me know if something like this is even possible at all? And if so, what the actual variable name is in the G-code for the max endstops?

I'm using Repetier Host and Marlin on a RUMBA board.

Thank you very much! smiling smiley
Re: Start G-Code Script for toolchange
January 15, 2020 11:21AM
Conditions in GCode files are supported the most recent version of RepRapFirmware, but not in any other 3D printer firmware that I know of. It's more usual to use conditions and loops in macro files than in GCode files generated by the slicer. For example, commands to unload a tool if one is loaded at power up would typically be done in the homing script, or in the start.g macro which RRF runs before starting any print job.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Sorry, only registered users may post in this forum.

Click here to login