Write gcode for 3d printer

Hi everyone,

I want to learn gcode, because I feel like it may be a good skill to have. I was wondering how I could do that. I have a Creality btw.

I right now want to learn how to push a button for a certain amount of times. This means that it asks for you for some parameters, and if writes the gcode for you. It is best if I can make it so it can press 2-3 buttons at once with only me inputting the parameters. This means that I can just leave it overnight and have it push buttons.

I already know some programming, because I learned java from a class. I may be completely wrong, but I am thinking of just writing a java program that takes in my input through console. Then it will put that into a a txt file. This is a part that I don’t know, but can i turn that txt file into a gcode file? I see that cura turns it into a ufp. (Can’t find anything for this.)

Also I know that this may break my printer if not careful. (How can I try to avoid this?)

Thanks in advance.

It should not break your printer. You could, of course, ask for ridiculous temps on the hotend or bed, but I suspect even that would be prevented, by the firmware, from damaging the printer. So, it might, maybe, be possible to cause the printer to physically damage itself, but the firmware can always be re-flashed, so that shouldn’t be an issue. @Geit should be a good source for what might be possible.

Mind you, Java is more of a scripting language than a full blown programming language. That said, gcode, to me, is also mostly a scripting language, so there’s that.

Your timing is perfect. I just create a gcode terminal that you could use as a starting point for your project since I licensed it as open source.

[video=youtube_share;liL2IoXe4D0]3d Printer Maintenance, Extruder Steps, and PID Calibration - YouTube

Here is a link to the GitHub repository. It is written in Javascript not Java but it should give you some ideas.

ishapiro/3d-printing-tools: Information and tools to enhance your FDM 3d printing experience. (github.com)