Writing gcode for 3D Printers

32 views
Skip to first unread message

StevenQ-NE-UK

unread,
Feb 6, 2016, 7:08:36 AM2/6/16
to North East Makers
Greetings Makers,

I have been working on a piece of custom gcode to help with the whole bed level process.  Why, because I find that manually moving the x and y axis affects the calibration process.

This short program places the nozzle near the 4 corners and the centre of the print bed.  At each point it waits for the user to press the select button on the printer before it moves to the next location.  If your printer does not have end stops or an lcd screen / select button then I wouldn't recommend using this exact code at it uses "Home All" and "Wait" commands.

G28   ; Home all
G1 Z10   ; Move Z to 10mm
G1 X10 Y10 F9000 ; Move X to 10mm, Y to 10mm at 900mm/min
G1 Z0   ; Move Z to 0mm
M0   ; Wait for button press
G1 Z10   ; Move Z to 10mm
G1 X190 F9000  ; Move X to 190mm, Y to 10mm at 900mm/min
G1 Z0   ; Move Z to 0mm
M0   ; Wait for button press
G1 Z10   ; Move Z to 10mm
G1 Y190 F9000  ; Move X to 190mm, Y to 190mm at 900mm/min
G1 Z0   ; Move Z to 0mm
M0   ; Wait for button press
G1 Z10   ; Move Z to 10mm
G1 X10 F9000  ; Move X to 10mm, Y to 190mm at 900mm/min
G1 Z0   ; Move Z to 0mm
M0   ; Wait for button press
G1 Z10   ; Move Z to 10mm
G1 X100 Y100 F9000 ; Move X to 100mm, Y to 100mm at 900mm/min
G1 Z0   ; Move Z to 0mm
M0   ; Wait for button press
G1 Z10   ; Move z to 10mm
G28   ; Home all


If you do use this code, or code like it please be aware that there must be an empty line after the last command.  If this line is missed then the last command will not run.
I guess the "Home All" lines can be removed and the "Wait" lines can have S10 added to make the code wait for 10 seconds at each point and not rely on the select button being pressed.

I'll be working on a Nozzle Clean and Bed Glue Application code next.  I'll install them on the ebay printer at the Space in a subfolder on the SD card so it will make maintenance easier.

Eventually, I'd like to also add these to Marlin so they become part of the printers menu, but I have no idea how to do that.

Hope this helps if anyone else is trying to write gcode.

thanks

Steve

David Pye

unread,
Feb 7, 2016, 4:41:35 PM2/7/16
to north-ea...@googlegroups.com
Hi Steve,

I'm not sure why you'd want to stick it into the firmware itself - you can easily add a button to pronterface to trigger custom gcode.

What are you referring to as 'the printers menu'?

Cheers

David

--
You received this message because you are subscribed to the Google Groups "North East Makers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to north-east-mak...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

StevenQ-NE-UK

unread,
Feb 7, 2016, 4:47:07 PM2/7/16
to North East Makers
Hi David,

All my printers have lcd displays and I run them all from sd cards. I want to add a menu item that triggers this gcode from the printers lcd menu

Thanks

Steve

David Pye

unread,
Feb 7, 2016, 4:50:28 PM2/7/16
to north-ea...@googlegroups.com
Ah, gotcha.  I've never done that as I've tended to use Octoprint and Raspberry pi's to make them network-able.  (a package Greg Fenton was also using a while back).

It even had the option of doing timelapse videos of prints using the pi-cam, taking a picture on Z axis change.

Let me have a look at Marlin and get back to you - it's probably not too awful.... (!)

David


Steve

Dan Nixon

unread,
Feb 7, 2016, 4:52:38 PM2/7/16
to North East Makers
Could you not just keep a file on the SD card and run it like you would run a print?

For anyone who has their sanity remaining the Marlin firmware is an utter abomination of code that makes maintaining it almost impossible.
I wouldn't wish that upon anyone.

Dan

StevenQ-NE-UK

unread,
Feb 7, 2016, 5:00:25 PM2/7/16
to North East Makers
Hi Dan,

My initial plan is to store these maintenance programs on the sd cards in a sub folder. I just wondered if it was possible to actually add this to marlin itself

thanks

Steve

Dan Nixon

unread,
Feb 7, 2016, 5:10:11 PM2/7/16
to North East Makers
It would certainly be possible, but I make no promises that it will be easy.

Dan
Reply all
Reply to author
Forward
0 new messages