[MUSIC] Hey, friends in the past. I showed you how you can manipulate G code to make really cool time lapses and even make your 3d printer. Sing and dance. [music] well today! I’m back with another handy. G-code hack today. We’re gonna take this ordinary 3d printer and make it fully automated. Stick around and I’ll show you how cool g-code. It’s the mysterious language of 3d printers. The code that the slicer on your computer creates that tells your printer exactly how to behave in order to print a perfect model. Well, it can be pretty intimidating for people like myself who aren’t programmers by any means learning. Just a little bit of G code is definitely an awesome skill that can help you unlock a lot of power from your 3d printer without the need for expensive upgrades or anything Crazy. 3d printing is awesome because you can just give a printer that G code and leave it to do. It’s work and print a fantastic model, but what if you wanted to print a whole bunch of something like more than you could fit on one print bed? Well, then you have to come back to your print. When it’s finished, remove the print and start the next print, and if you need to do that over and over and over again, well, it might be in your best interest to automate that in today’s video. I’m going to show you how I did just a little bit of G code manipulation and a bit of a clever way in order to make this any cubic. I three mega fully-automated that is removing a print after it’s finished and starting the next one over and over and over again. I think it’s a fun little trick. It can definitely be handy for some of you. And if anything, it might give you some cool ideas for how you might modify. G code to make your 3d printer. Do crazy things. Here’s the model. We’re gonna be working with. It’s my version of Professor Sugihara’s ambiguous cylinder illusion. I think it’s the perfect test model for this experiment because it’s nice and small and is very simple and the idea here is actually very simple as well. Once the print is finished. We’re just gonna have the print head move behind the model and then come forward and knock it off of the print bed. Easy enough, right, Well, not entirely that easy. For example here. Well, that would have caused a problem, So my first quick fix is gonna be to tape this piece of paper to the front of the build plate so that the model doesn’t get in the way and hopefully it’ll fall straight into this open drawer in front of the printer. So here’s a temp number 2 and it went pretty well. Also, the hot end of the print ended up melting my model after the fact, so I’m gonna have to do a few more changes, but let’s go ahead and jump into my slicer, so I can show you exactly how I’m doing this. I’m doing this in simplified 3d but you should be able to do this just as well using cura or another free slicer. Let’s go ahead and take a look at these process settings overall. I’m not doing too much. These are just my standard print settings for this ambiguous cylinder, so we’ve got a point. One six millimeter layer height. We do want to have a brim, which is basically a skirt with no offset from the model that way when the print gets ejected. It takes the brim with it. The real magic is going to happen with our scripts, so at the start of the print, it’s very simple. We just have a g28 command which homes, the printer that’s pretty standard and I would usually have a wipe command here to kind of start purging filament, but for this technique, we’re not gonna have that, and that’s why I have the brim for the model that’s going to act as our purge, But for actually ejecting the part. We’re gonna edit our ending script here you can see what? I’ve typed up so each line is a separate command starting with this g1 which is a move command. So this first line is saying move to the coordinates. X 105 millimetres y1 95 millimeters and Z 50 millimeters. The F stands for the speed in millimeters per minute After that. I added some M 300 commands, which is just a beep. I’m gonna have a few beep noises just to let me know when the print is finished and then we’re gonna have a few more movement commands here. If we look at this line. All the coordinates are the same, except for the Z, which I’ve set to 1 which means the print head will lower down to one millimeter above the print bed. The next line moves Y to 1 which makes the printbed move backwards. Then I added a few quick back and forth movements between Y 30 and y1 with a feed rate of 8,000 which will basically just move it really quickly and try to shake the print off to make sure it’s not in the way after that, we’ve got these standard commands, which normally turned the fan off as well as the extruder in the bed. But I added this semicolon in front of them, which basically disables those commands. But I do want to keep them. In the end script, and you’ll see why in a bit anyways, That’s gonna be our basic end script, and now if we go ahead and prepare the print, we can see that the print itself looks fine. And in simplify 3d we can also visualize the travel moves, which is gonna be really helpful. Here you can see that actual motion of the printhead, moving to the back of the plate and then up to the front. That’s what’s gonna kick our print off of the bed. Everything looks good, so let’s go ahead and export that to our SD card. I’ll name it MB one, and then we’ll exit that preview. Now I’m gonna move this print a little bit further back, leaving it centered in the x-axis, but just moving it back in the Y A bit and I’ll leave everything else the same and we’ll export that as an v2 then. I’ll do that one more time, moving it a little bit further back, but making sure there’s still a room behind it for the printhead to lower down behind the model and I’ll name that AM b3 so now we have three separate pieces of G code for these three prints that are doing the same thing, but just with the cylinder in a different location and the next thing. I’ll do is open each of those D codes in my text editor. Since I’m on a Mac, I’m using TextEdit on Windows. You can use notepad or anything similar and just make sure you’re not using rich text. You want to use plain text to make sure that it still behaves as a g-code file when you save it? So in this text document, we have all the g-code. This includes every single movement command for the printer and will also open up and be – and AM b3 then I’m gonna go ahead and copy one of these, or you could just start a new document but basically. I want a new g-code file. That’s going to be the combination of all of these. So I’ll name that MB Otto and we’ll open that as well great. So with this new G code. I’m just gonna delete it for now, and then I’ll go to am b1 I’m gonna copy everything and paste it. Then I’ll copy everything from our second file and paste that at the end and then copy everything from the third file and paste that on the end of that one as well. So now we have all three. G codes pasted into this one G code file. So now this file will already run all three of those prints back-to-back. But if we want to do more than those three, we can select everything in this file. Copy it and paste it as many times as we want to make several copies of this print. Once we have as many copies in this file as we want to print. I’ll go down to the very bottom, find that last end script, and I’ll delete those semicolons in front of those final commands so that it does turn off the fan, Extruder bed and Stepper Motors. Once all of these prints have been run through, and I’ll also just stick a few more of those beeps at the end so that it gives me some kind of alert when it’s done printing. All of these, you could actually manually type in any G code directly into this text file, So even if your slicer doesn’t have an option to add an ending G code script. You could just add it in, right. Here, yourself, great now. I’ll just save this once again. Make sure you’re saving it as plain text, and that’ll do it for our new updated g-code file, and you’ll see that the size of the file goes up dramatically because we have a lot of prints in this one G code. All right, it’s on our SD card, ready to go, but let’s go ahead and first drag this G code file in to simplify 3d and that’ll let us preview the print just to make sure that nothing crazy is happening, so here’s our preview and you can see. It shows all three of those locations and it’s each one of the model’s printing back-to-back and we only see three because the rest of the models are printing in the exact same location as those first three, but it looks like everything’s working the way it should, so let’s go ahead and inject our SD card. Stick it in our printer and see what happens. All right, we’re off. The printer is now reading our G code, and if we did everything right, it should start by simply printing the first model, just like any other prints once that first model is finished. We have our moment of truth here. We go, it’s reading that. G code moving to the back, lowering down and then moving the bed backwards to knock off the print and our little shake command, which didn’t do much, but it didn’t hurt either, so that’s the completion of our first print, but it’s gonna continue reading that G code, which leads straight into the next model. So once again, it’s running that starting home command, and then it’s gonna go ahead and start printing our second cylinder. You’ll notice it takes a while before filament starts extruding again, and that’s why we have that brim because we want to make sure that the filament is flowing once it starts printing the actual model a few moments later while it’s printing fine, except there was this blob of plastic that got dropped onto the print, and that’s no good. That’s gonna ruin this model, so lets. Go ahead and stop this print. Yeah, see that blob, that’s. No good one option might be to simply add a retraction to the end script. But I just happened to have this wire brush which I snapped and saved for a moment, just like this. I’m gonna go ahead and use a binder clip to stick this wire brush on the corner of my build plate here, and I’m gonna see if I can code the printer to use that brush as a little nozzle cleaner so to do that. I need to figure out the exact location relative to the printer and from the printer interface, I will manually move the printhead and just keep track of how far I’m moving it, so I’m moving 10 millimeters at a time here. I went up 20 millimeters in the Z direction, and then it looks like if I go over 210 mm, I end up right above the brush. Then I have about thirty millimeters to move forward and backward in the Y direction to wipe the nozzle. Maybe I can move down a little bit at the same time. Yeah, I think that could work, so let’s go back into our slicer and add that movement into our G code once again. I’ll go into the script section, but I’m going to add this command to the starting script because we want it to wipe right before it starts printing the model. So after homing, I’m gonna type in a g1 command again, and I’m gonna have it move to X 210 which brings it all the way to the right side we’re gonna have. Y go to 5 and Z go up to 20 so it ends up just above that wire brush. After that semicolon. You can write whatever you want. It’s kind of just a way to keep track of what your Chi code is doing once. It’s over the wire brush. I’m gonna add another g1 command and we’ll have the X remain the same, but we’re gonna move the Y to 25 and we’ll have the Z move down one millimeter to 19 so it’s kind of moving backwards and slightly down to start brushing the nozzle. Then I’ll set the Y back to 5 and the Z down one more millimeter to 18 to have it continue brushing, and then we’ll do one more brush for good measure after the nozzle is done brushing. I want to move the printhead out of the way, so I’ll do another g1 command and I’ll have it move to the left to 200 and we can have the Y move to five and we’ll just keep the Z at 17 millimeters. All right, that looks good for the start of the print, and I am gonna go back and add a few more outlines to the brim. Just to make sure it does a better job of purging the nozzle at the beginning of the print and let’s preview this now and see what it looks like once again. I’ll turn on those travel movements and we can see it moving over to that brush and doing that little back-and-forth wipe and then moving over and down, although that’s not moving over very far, so let’s go back and we’re gonna go to the start script and make it move to X 150 instead, and there we go now you can see after wiping the nozzle, it moves over a bit further before starting the print so that it won’t hit that brush, all right, so we’ve made our changes and from here, we’re gonna do the exact same thing. I’m gonna save out three different versions, one two and three, just so that it doesn’t print in the exact same spot every time that’s gonna help us with bed adhesion, but otherwise it’s exactly the same. I’ll paste all three of those into one file, and I’m gonna make four more copies of that so that we have 15 prints total in this one g-code file. All right, lets. Save it and try it out. I’m gonna swap out my filament. I was using a really cheap PLA, which was stringier than it should have been. So we’re gonna use some filament. Um, extra fill instead for this one plus. I really like this light blue color all right off. It goes moving to the brush looking. Good, all right there we go a nice little brush command and then just like we programmed. It moves over and starts our print. Once again, the film, it doesn’t start coming right away, but we have five skirts now, so it’s more than enough time for the filament to start flowing more smoothly And let me just clean up this one string, but from here on out. I’m just gonna leave the printer and let it do it’s thing, so here’s print number one finishing off. Let’s see what it does, all right it. Ejecta the print just fine, and then after a few moments, it’ll move over and start the second print. This time with our new wipe command. Does its quick brush and starts print number two slightly farther back awesome, so it is still a bit stringy. It’s not the most clean environment, but cylinder number two does seem to be printing out quite nicely so here it is finishing up and let’s see if it keeps going once again. Runs that wipe, and then it’s gonna go back and start our third cylinder. It caught a straggler there once again, not super 100% clean, but again that’s kind of the purpose of the brim here as you can see. It kind of caught that string of filament and it’s just gonna kind of smush it down and out of the way before it starts printing the actual model, great on to print number four and beyond its working. I can’t believe it’s actually working from here on out. I left it printing overnight and sure enough one print after the next 15 Silvers in a row, It just printed them and pop them off the plate. Surprisingly, despite the nozzle leaking a bit between prints, every single cylinder came out, absolutely fantastic. There is some stringing but that has nothing to do with our actual modifications. That’s just my general print settings. I probably should have had the nozzle temperature a bit lower and maybe a bit more retraction as well. But nevertheless, we got our cylinders. I was able to clean up those strings a bit and I was left with 15 Absolutely fantastic prints. All right, friends. We did it with just a little bit of g-code hackery. We were able to take this normal printer and make it spit out one print after another to get these 15 beautiful cylinders, and you know what that 15 could have been 30 could have been 90 It could have been a thousand if we had an. SD card. That’s big enough now. This worked, especially well for this model because it has very little surface area on the build plate, so it was very easy for the printhead to just knock it off. If I was doing a different model, I might have to take a different approach. Maybe having some code in there that waits for the build surface to cool down before knocking a print off so that it’s not sticking as well or I might attach a little scraper to the front of the printer to pop off very shallow parts like a lot of poly panels, for example, anyways. I hope you guys found that as cool as I did. I just think it’s really fun that you can type in a few extra pieces of code and make your printer do all kinds of stuff. I’m interested in hearing if you guys have any ideas of what else I can make a 3d printer do with cheat code and maybe a few specialty 3d printed parts, But anyways, that’s it for today’s video, So I’ll see you in the next one until then. I’m Devin. This is make anything, And, of course, stay inspired. I had to do something [Music] you?