[00:00.000 --> 00:00.560] Pass that around. [00:02.380 --> 00:03.120] How's everybody doing? [00:03.260 --> 00:03.660] I'm Todd. [00:04.120 --> 00:08.040] Welcome to G-Code, how we program CNC mills and 3D printers. [00:08.180 --> 00:14.820] If you guys were in here a little bit earlier, someone gave a very eloquent speech about why all this is bad, so I'm kind of here to teach you how to use it. [00:15.240 --> 00:19.100] What's getting passed around the room right now is something I 3D printed last week. [00:19.220 --> 00:22.020] It's a new shower head I made for my apartment. [00:22.200 --> 00:25.480] It's a little bit of a Tyrannosaurus Rex head, so pass that around, that'll be cool. [00:26.500 --> 00:27.920] Intro, I'm Todd, I said that already. [00:27.920 --> 00:28.900] I'm a mechanical engineer. [00:29.440 --> 00:32.940] Oddly, I'm at a hacker conference talking to hackers about how to code. [00:33.100 --> 00:34.300] That'll probably never happen again. [00:35.080 --> 00:38.940] I like to build stuff, I like machining, and I like computers a lot. [00:39.520 --> 00:41.380] It's my website if anybody really cares. [00:42.080 --> 00:44.620] There's some videos and there's a bunch of... [00:44.620 --> 00:48.740] everything has slide numbers, so if you have questions, just shoot me a slide number, I can back up to stuff. [00:48.860 --> 00:49.200] That's easy. [00:49.880 --> 00:53.620] Okay, a couple definitions for everybody's sake who's not familiar with this. [00:53.760 --> 00:58.000] First of all, G-Code is a numerical programming language for industrial equipment. [00:58.540 --> 01:00.240] That'll make more sense in a little bit. [01:00.680 --> 01:06.460] CNC is a three-letter acronym for computer numerically controlled equipment. [01:07.260 --> 01:08.480] Generally, it's industrial equipment. [01:08.980 --> 01:12.720] CAM and CAD are two types of software packages that we use to interact with those. [01:13.160 --> 01:25.100] And then toolpath, G-Code, and M-Code are things that are kind of specific to how we use, as people who use CNC equipment, how we use the equipment, how we get code onto it, and how it's represented and actioned upon by the machine. [01:25.640 --> 01:26.940] So what G-Code does... [01:26.940 --> 01:32.040] I actually like this slide, because it diverges a little bit from the argument that was made by somebody else earlier. [01:32.660 --> 01:39.680] G-Code communicates how a machine or some sort of computer-controlled equipment acts in geometric space, right? [01:39.920 --> 01:43.800] We're taking basically computer code, and we're bringing it out of the computer into the real world. [01:44.060 --> 01:49.420] And with the real world comes a lot of constraints around geometric space, coordinate systems, things like that. [01:49.420 --> 01:54.800] And the G-Code provides commands to the machines that use that to make something. [01:55.160 --> 02:00.700] Usually they're in the form of like a go-to location or a do an action, turn a motor on, turn a motor off. [02:01.160 --> 02:03.520] What G-Code is and kind of isn't... [02:03.520 --> 02:08.480] The earlier presenter made a comment about G-Code is not Turing complete. [02:08.700 --> 02:09.820] Well, okay, great. [02:10.040 --> 02:11.420] It's from the 1950s. [02:11.960 --> 02:12.580] It's old. [02:13.620 --> 02:16.580] Realistically though, G-Code isn't really a language. [02:16.900 --> 02:24.560] It doesn't have a lot of the features we typically define as part of having a language or a programming language of some form like C. [02:24.700 --> 02:26.120] You can't do variables. [02:26.640 --> 02:28.280] You can't really do variables. [02:28.280 --> 02:30.480] You can't do logical constraints. [02:30.660 --> 02:32.860] You can't do logical statements. [02:33.000 --> 02:35.580] And you can't really write functions on its own. [02:35.780 --> 02:39.800] It's also not really implemented very standard, even though it's actually an international standard. [02:40.260 --> 02:40.880] It's a lot more... [02:40.880 --> 02:42.800] A better term to use for it is more of an API. [02:42.800 --> 02:45.880] It's also very, very explicit, usually. [02:46.640 --> 02:47.200] So... [02:48.020 --> 02:54.380] Here's a very, very early CNC machine, or milling machine, computer-controlled milling machine. [02:54.480 --> 02:56.260] This is 1955-ish. [02:56.420 --> 02:59.340] It's tape-powered, and you can see the guy standing there. [02:59.400 --> 03:00.100] You can see the machine. [03:00.100 --> 03:01.280] You can see the computer cabinet. [03:01.500 --> 03:03.680] This is obviously pre-microprocessor. [03:03.900 --> 03:07.660] This was running on registers and relays, basically. [03:08.200 --> 03:11.680] Everything was encoded on the punch tape, and the punch tape would run. [03:12.220 --> 03:15.020] And then there was a button that said rewind the loop, and it would run it again. [03:15.200 --> 03:16.280] And you press that, and it ran. [03:17.420 --> 03:18.220] So, history. [03:19.300 --> 03:19.700] Before... [03:19.700 --> 03:25.180] Before there was computer numerical control of industrial equipment, things were generally made by hand. [03:25.300 --> 03:26.220] They were made by artisans. [03:26.380 --> 03:36.640] A lot of the use of CNC control is to make things that used to take artisan-type work a lot more commoditized, as well as to make it faster, more accurate. [03:36.640 --> 03:38.880] And you can actually make things that you otherwise can't. [03:39.260 --> 03:44.960] If you're trying to individually run, say, a three-axis milling machine, you have two hands. [03:45.120 --> 03:47.680] You can only turn those, you know, two handles at once. [03:47.780 --> 03:50.820] You can only move a piece of equipment in two directions at once. [03:50.900 --> 03:52.680] And even doing that's very, very difficult. [03:52.840 --> 03:56.880] With a CNC machine, you can move as many motors as your controller supports. [03:57.040 --> 04:00.100] There's machines nowadays that would have nine axes. [04:00.280 --> 04:02.140] And you think about, we have an X, Y, Z world. [04:02.260 --> 04:03.200] We have a three-dimensional world. [04:03.340 --> 04:08.960] What they mean by nine axes is, well, it means the machine can move in nine different directions at once. [04:09.040 --> 04:11.920] That allows you to do a lot more complex things than you otherwise might. [04:12.520 --> 04:20.740] So, early, early development work was really funded by NIST, and it was funded by the DOD, which mirrors a lot of, I think, computer development. [04:20.740 --> 04:25.100] The real first kind of exposure to this was 1955. [04:26.260 --> 04:32.620] A vendor displayed one of these tools at a trade show, which in the machine tool industry is a big deal. [04:32.860 --> 04:35.480] To give you an idea, my dad was born in 1955. [04:35.500 --> 04:37.480] So, this is really, really old. [04:41.320 --> 04:43.060] I thought that would get a rise. [04:44.720 --> 04:49.440] So, 1959, there had been a number of different vendors that had done this different ways. [04:49.440 --> 04:58.180] They'd kind of gotten to the point where there were multiple different standards kind of developing as how we're going to encode information and transmit information to these machines. [04:59.480 --> 05:01.700] Somebody first said, well, we should probably standardize this. [05:01.800 --> 05:11.520] And actually, the G-code standard came out of the sewing machine, the automated sewing machine industry, not the metal manufacturing industry like you would probably expect for something like this. [05:12.280 --> 05:16.220] The next big milestone is just to kind of point out is it's cost, right? [05:16.220 --> 05:21.900] A lot of these things, whether they're in computing, traditional computing, or whether they're in industrial equipment, is cost-driven. [05:22.080 --> 05:31.660] In 1987, a company called Haas, who are now the biggest, I think they're still the biggest machine tool vendor in the world, brought a CNC mill out that was under $50,000. [05:32.080 --> 05:42.960] It sounds ridiculously expensive for, you know, computing power in 1987, but this is a very large machine that can cut, you know, titanium, aluminum, stainless steel into really, really intricate and complex shapes. [05:42.960 --> 05:48.580] Today, the machine I use, that I have access to, that's purchased for, I think, $7,000 or $8,000. [05:48.920 --> 05:52.700] And it's the same size, has the same features as that mill that was built in 1987. [05:53.960 --> 05:56.920] So, interesting to note, though, some shops still run on tape. [05:57.220 --> 05:58.080] Tape still works. [05:58.200 --> 06:00.520] They're not going to change unless there's an absolute reason for them to. [06:01.560 --> 06:06.280] So, to give you an idea, this is ferrite, yeah, somebody got it, ferrite core memory. [06:06.600 --> 06:09.940] This is, I think, 1978 is the age of this machine. [06:09.940 --> 06:24.240] The biggest problem they had when they were bringing CNC machines and basically computers out of, you know, a typical computing environment onto a shop or manufacturing floor was, well, if you welded too near, your ferrite core memory would go blank. [06:25.000 --> 06:28.300] That's probably not a problem they had, you know, in the IBM mainframes. [06:28.440 --> 06:29.540] I don't think they did, at least. [06:30.620 --> 06:31.620] Here's another picture, right? [06:31.740 --> 06:32.580] Same type of age. [06:32.740 --> 06:35.440] You can see, again, enormous control cabinet, as you would expect. [06:35.980 --> 06:44.720] You know, the size and power of these has pretty much kept pace with modern computer developments, to some extent, except, you know, it tends to trail a little behind. [06:45.080 --> 06:53.780] With industrial computing, you're looking for reliability, hardenability, and, you know, you don't want to have it break, you don't want to have it shut down. [06:53.960 --> 06:55.320] So, they'll wait a couple years. [06:55.320 --> 06:59.860] They're not so concerned about maximum throughput on the processors, so they delay things, okay? [06:59.860 --> 07:02.060] This is where we're at in the modern day. [07:02.540 --> 07:07.980] That's a machine from a company they had built for them out in, I think, Washington, called Janicki. [07:08.920 --> 07:14.080] It's now 100 feet long, 20 feet wide, and, like, 8 feet high. [07:14.300 --> 07:17.720] So, to compare it, right, this is where we were in, like, 1960. [07:17.920 --> 07:21.020] Now it looks like that, and that's, like, their whole staff standing in there. [07:21.200 --> 07:26.140] They have a video somewhere of this running that's just kind of one of the coolest things I've ever seen. [07:26.140 --> 07:27.120] So, all right. [07:27.600 --> 07:30.240] A little more about the language, so that's what we're here to talk about. [07:30.660 --> 07:33.060] G-code is based on a very standardized format. [07:33.240 --> 07:37.220] You typically have a line of code that will have a G-code or an M-code. [07:37.380 --> 07:40.740] G-codes are geometric movements of the tool. [07:40.940 --> 07:49.920] So, like a G-0-0, if I said G-0-0 and then gave the machine a set of coordinates, that's going to rapidly move from where it is to another point. [07:50.160 --> 07:53.860] G-0-1 is another interpolation command. [07:53.860 --> 07:59.400] It will linearly, meaning, obviously, in a straight line, move from where the machine is to where you tell it to go. [07:59.740 --> 08:02.080] So, we now have straight movements. [08:02.420 --> 08:05.480] The world is basically made up of straight lines and curves to some extent. [08:05.600 --> 08:12.980] So, we also have G-0-2 and G-0-3, which allow us to move from where we are to where we want to go in a circular fashion. [08:13.420 --> 08:15.480] And we can define a radius for that curvature. [08:15.480 --> 08:27.400] Basically, what we are doing is taking the basic commands that are required to break a physical object down into shapes, into lines that we can follow to cut them out with a metal milling machine. [08:28.300 --> 08:28.720] M-codes. [08:28.820 --> 08:35.920] M-codes are kind of... if G-codes are a lot like analog, and forgive my metaphors, M-codes are a lot like digital. [08:35.920 --> 08:42.820] You are going to see M-codes like M-0-3 and M-0-4, which will turn on or turn off the spindle. [08:42.960 --> 08:44.460] I am going to back up a little bit from that. [08:44.580 --> 08:44.960] There we go. [08:45.640 --> 08:48.060] You can also do things like change the cutting tool. [08:48.160 --> 08:52.440] Obviously, if we are trying to drill two different size holes, we need two different size cutting tools. [08:52.620 --> 08:58.440] And there is a command built in that allows the software to know when it has reached that point, and it performs a set of actions from there. [08:59.380 --> 09:01.780] So, this is what it looks like in practice. [09:02.680 --> 09:05.880] What you are seeing there is going to be a G-0-2 command. [09:06.120 --> 09:06.720] It moves in a circle. [09:06.960 --> 09:08.980] We saw the cutting bit then moves down. [09:09.560 --> 09:12.860] That is a G-0-1, and it cuts back through the metal. [09:13.620 --> 09:20.540] We talk about code a lot, and I write JavaScript every day, but this is code that ends up cutting out tool steel. [09:20.880 --> 09:22.560] That, I think, is pretty neat. [09:22.840 --> 09:26.160] And you are going to see, it is just the same movements over and over and over again. [09:26.160 --> 09:27.920] Obviously, this is incredibly simple. [09:28.540 --> 09:30.420] What it is doing here is just cutting a circle. [09:30.600 --> 09:31.280] G-0-2. [09:31.480 --> 09:39.640] You are going to see that everything that the machine does is made up of just thousands and thousands and thousands of lines of the same geometric movements. [09:40.340 --> 09:40.440] Okay? [09:41.000 --> 09:42.220] So, it is pretty neat, right? [09:43.080 --> 09:46.800] So, again, here is how it works in terms of a specific line of code. [09:46.940 --> 09:49.540] Every line of code is going to nominally look like this. [09:49.620 --> 09:50.740] It has a line number. [09:51.200 --> 09:51.640] Duh. [09:52.560 --> 09:57.380] These do help with practical troubleshooting because it is effectively close to real time. [09:57.660 --> 10:00.520] You can sit at a controller and watch the code execute. [10:00.740 --> 10:07.920] You can watch the lines of code go by as the machine is moving, as the machine is following the path that you have pre-programmed into it. [10:08.260 --> 10:15.840] That line number allows me to say, okay, at line 6438, it did something odd that I want to go back and fix later. [10:15.940 --> 10:17.020] I can go ahead and adjust that. [10:17.360 --> 10:17.400] Okay? [10:17.400 --> 10:25.500] They don't, for some odd reason, the way it's implemented in standard, they don't have to be every integer. [10:25.680 --> 10:32.440] They have to be integers and they have to be sequential, but you could number in units of 10, in units of 5, in units of 2, it doesn't matter. [10:32.440 --> 10:36.020] That line number is then going to be followed by a G code. [10:36.240 --> 10:40.640] G code is going to be a G or M followed by a 2 or 3 digit number. [10:40.900 --> 10:43.120] That's what we're doing, in effect. [10:43.320 --> 10:45.820] That's move this way, turn this on, turn this off. [10:46.140 --> 10:54.160] That's then followed by between, well, 0 and I can imagine a situation where you use 8 different controlled letters. [10:54.160 --> 10:57.620] Controlled letters are things like X or Y or Z. [10:57.920 --> 11:00.740] They define coordinates that the machine is going to move to. [11:00.900 --> 11:06.860] So if I say G00, X15, Y10, what does that say? [11:06.980 --> 11:10.900] Well, this whole line of code says, this is the 10th line or line 10 of the program. [11:11.120 --> 11:12.560] It's going to move quickly. [11:13.360 --> 11:15.200] G00 means rapid. [11:15.320 --> 11:17.640] It means I don't expect for the tool to be cutting there. [11:17.640 --> 11:26.200] That's just a piece of information I can give to the machine to let it make some decisions on how it implements this action so that it can do so faster. [11:26.760 --> 11:26.820] Alright? [11:28.040 --> 11:36.740] X15, Y10, that says move 15 distance units in the X direction while at the same time moving 10 distance units in the Y direction. [11:37.000 --> 11:39.500] That F that follows it is then a feed rate. [11:39.660 --> 11:44.040] It says move at 100 distance units per time unit. [11:44.040 --> 11:45.180] And you can pick, right? [11:45.360 --> 11:50.180] Because 99% of the world nowadays uses metric, but some people still use inches. [11:50.640 --> 11:54.420] You can pick feed rates and you can pick locations in inches and in millimeters. [11:54.500 --> 11:55.800] And you just call that out to the machine. [11:55.960 --> 11:57.380] It toggles the state on the machine. [11:57.440 --> 12:05.520] It's able to implement that because the reality is when it implements these different commands, it's taking that code, which again is more like an API. [12:05.960 --> 12:10.920] It's bringing that code in the controller and it's processing it down to a physical action on the tool. [12:10.920 --> 12:16.180] That physical action on the tool is going to exist in like stepper counts or servo motion. [12:16.400 --> 12:21.540] It's counting out how far it's going to move to achieve the distance that you asked it to. [12:21.620 --> 12:24.940] And those numbers are going to be very different and those numbers are going to be machine specific. [12:25.480 --> 12:30.880] But one thing to kind of talk about is the G00 versus G01 versus G03. [12:31.020 --> 12:35.160] And again, those are rapid, linear, and circular interpolation. [12:35.160 --> 12:38.180] They're really the three or four primary commands. [12:38.500 --> 12:47.860] And if you gave all three of them the same coordinates, so start from A, move to B, this is what you would probably get in terms of distances. [12:47.860 --> 12:54.840] If we use that X10, Y15 movement from the previous page, the G00 might move in what's called a dogleg. [12:54.940 --> 12:58.200] It's going to move as quickly as possible to get to the location it's going. [12:58.200 --> 13:03.880] And it may be a situation where it moves along a certain angle faster than it could move in a straight line. [13:04.480 --> 13:12.120] G01 is strict about moving in that straight line because we expect to be cutting, and we want to go ahead and trace that path that we've called out. [13:12.860 --> 13:19.420] G03 is still going to get us the same start and end coordinates, but as we can see, right, it's a circular movement from A to B. [13:20.640 --> 13:26.620] Okay, so when we have hundreds and thousands of lines of this, it starts to actually look like a thing. [13:26.620 --> 13:28.380] So this is just a mill. [13:28.640 --> 13:30.900] It's cutting out a part for an injection mold. [13:30.980 --> 13:34.140] And you can see, right, some of these start to immediately look familiar. [13:34.140 --> 13:35.400] We see it moving in curves. [13:35.460 --> 13:36.820] We see it moving in straight lines. [13:37.080 --> 13:38.420] And it just does this, right? [13:38.460 --> 13:39.540] It goes and goes and goes. [13:39.720 --> 13:41.900] This is a very precise, very accurate machine. [13:41.900 --> 13:44.560] It's probably working in the ten thousandths of an inch. [13:46.140 --> 13:48.840] As you step down, right, it's moving in the X and the Y. [13:49.460 --> 13:52.660] Then it's going to go ahead and step down and make another layer in the Z. [13:52.740 --> 13:54.160] We make multiple layers in the Z. [13:54.160 --> 14:03.860] And I, as the operator, as the person doing the programming, I'm able to select how it does this, what type of cutting tool I'm using, the RPM of the machine, the speed rate of the machine. [14:04.060 --> 14:07.180] It's a little difficult to see, but you can also see it's spraying coolant. [14:07.740 --> 14:11.240] Obviously, this is going to be a fairly energy-intensive process. [14:11.240 --> 14:14.480] It's, I think, a ten-horsepower spindle to cut this metal out. [14:14.980 --> 14:19.800] And if we speed it up, we end up with a roughed-out shape that looks like that. [14:19.920 --> 14:25.500] It's part of an injection mold for just like a, you know, $40 off-the-shelf Toys R Us drone. [14:26.120 --> 14:34.540] Once it's done, right, and again, every single line of this code is just G01, G03, G01, that type of work over and over and over again. [14:35.020 --> 14:37.680] We can eventually get it fully roughed out. [14:37.900 --> 14:39.260] Let's see if it gets to this point here. [14:39.880 --> 14:48.280] Switch tools, and now we come back and we do more steps, more lines of code of a different tool to generate different geometry. [14:48.660 --> 14:50.200] They used a roughing routine there. [14:50.280 --> 14:52.460] It's called a roughing routine to remove the majority of the material. [14:52.580 --> 14:56.600] They took that big solid block of aluminum and turned it into what you see here. [14:56.880 --> 15:09.140] And now it's going to come in and it's going to start profiling this in smaller and smaller steps to go ahead and eventually, we're going to speed this up a little bit, start smoothing out those shoulders, right? [15:09.200 --> 15:17.420] We can see it's taken those big step-overs, those big step-downs from the roughing stage, and it's making a nice smooth part out of everything. [15:18.340 --> 15:23.180] Eventually, at the very end, we get a fully finished part that looks like this. [15:23.280 --> 15:30.960] If we do it right, you can even sometimes avoid having to go in and polish this, as you might in, you know, a typical injection mold to make sure that your parts release. [15:30.960 --> 15:34.220] So, that's the surface finish, that's what it looks like when we're done. [15:34.420 --> 15:39.920] You can kind of imagine how many lines of code every single time it changes direction, that's another line of code. [15:40.080 --> 15:42.940] So, it's a little different in terms of how coding languages work. [15:43.420 --> 15:44.860] All right, there's our finished part. [15:46.300 --> 15:47.720] So, how do we use this? [15:47.900 --> 15:51.100] And this is another critique G-code got earlier that I thought was kind of a good one. [15:51.880 --> 15:58.820] The G-code and machining really weren't built by computer science people for computer science people. [15:58.820 --> 16:06.020] They were built by kind of computer science, engineer-y type people back in the 50s for machinists. [16:07.220 --> 16:11.540] The machinists, well, they don't really work so well in writing lines of code. [16:11.640 --> 16:13.320] That tends to not be their specialty. [16:13.580 --> 16:14.680] They're very visual people. [16:14.780 --> 16:15.880] They're hands-on type of people. [16:15.960 --> 16:18.920] They're more the technician side than the, you know, engineer side. [16:18.920 --> 16:24.620] So, the standardized workflow that people use nowadays is what's called CAD-CAM-CNC. [16:25.020 --> 16:30.880] The CAD step is where we go into a computer and we generate, we create the 3D solid geometry that we're going to make. [16:30.980 --> 16:34.900] And this can be made either through a 3D printer or through, again, a 3D mill. [16:35.200 --> 16:37.340] And you guys keep seeing me talk about CNC mills. [16:37.380 --> 16:38.960] I'm going to get the 3D printers, I promise. [16:39.380 --> 16:41.640] We then go into a piece of software called CAM. [16:41.640 --> 16:42.560] I said CAM earlier. [16:42.740 --> 16:45.120] It's computer-aided manufacturing. [16:45.300 --> 16:46.440] People call it machining. [16:46.620 --> 16:47.920] The terms are used interchangeably. [16:48.020 --> 16:48.620] It doesn't matter. [16:49.120 --> 16:53.880] Inside of the CAM software, we're going to define all of the individual operations that have to go on. [16:54.100 --> 16:55.180] All of those steps. [16:55.300 --> 16:56.300] And we're not going to do it individually. [16:56.440 --> 16:57.160] We're not going to do it manually. [16:57.380 --> 17:01.820] We do it in a visual environment that looks like this. [17:02.180 --> 17:05.720] That allows us to select the geometry that we're trying to cut out. [17:06.120 --> 17:08.160] Select the type of machine that we're using. [17:08.160 --> 17:15.080] And then select the size of bit and, you know, some basic parameters of how we want to do this action. [17:15.300 --> 17:18.560] And it generates those things in yellow and blue called tool paths. [17:18.880 --> 17:23.600] Tool paths are a really great visual representation of what my cutting bit is going to do. [17:23.760 --> 17:28.260] And they're the end result of, you know, those tool paths are then created into G-code. [17:28.380 --> 17:30.260] They're turned into G-code at the end. [17:30.420 --> 17:30.860] Okay? [17:31.180 --> 17:34.600] Once we have the G-code complete, we take it to the CNC machine. [17:34.600 --> 17:40.940] And the CNC machine is going, the CNC controller specifically, is going to take that G-code. [17:41.080 --> 17:46.700] It's going to interpret it down into, again, movements of the tool and actually create the part for us. [17:46.900 --> 17:56.320] So the CNC, the CAM programs allow us to kind of have a graphical interface so that I don't have to sit there and write all of those individual lines of code by hand. [17:56.320 --> 18:02.780] I would comfortably say that almost no one hand writes G-code. [18:02.940 --> 18:10.540] It's not efficient to sit there and write all of those different lines of code to create all of those different steps, all of those different movements. [18:10.660 --> 18:14.060] You're almost bound to make a mistake because we're not working in variables here. [18:14.200 --> 18:18.020] We're working in specific actual numbers, right? [18:18.020 --> 18:19.080] So this is what it looks like. [18:19.520 --> 18:20.460] These are the tool paths. [18:20.700 --> 18:22.640] Again, it's code in visual form. [18:22.740 --> 18:23.880] It's code for machinists. [18:24.220 --> 18:31.100] Because before we had these tools, before we had the CAM tools, before we had CNC, they would actually, you know, manually cut these out. [18:31.240 --> 18:32.380] They'd write down what they're going to do. [18:32.480 --> 18:37.100] They'd have a print, a printed out piece of paper that had all the dimensions of their part in it. [18:37.200 --> 18:40.940] And they're going to go ahead and follow that along step by step by step. [18:40.940 --> 18:50.160] The advantage of the CNC machine is, one, it can be more powerful because you've taken the operator and you've moved them away from the tool and they can sit in a chair and watch it on a computer. [18:50.340 --> 18:56.220] That means we can put 40 or 50 horsepower into the machine where previously we might have put two or three. [18:56.620 --> 18:58.280] It also means that they're more precise. [18:58.540 --> 19:01.820] You know, computers generally don't make mistakes. [19:02.000 --> 19:10.480] I mean, they make mistakes, but they're less likely to make a mistake than the human error component at the coding side or the human error component of running these things by hand. [19:10.480 --> 19:19.500] They also allow us to make more complex parts that, again, that injection mold you saw, that's not realistically something you're going to be able to machine by hand. [19:19.500 --> 19:20.820] It's very, very complicated. [19:21.060 --> 19:27.320] You're going to rough it out by hand and then you're going to come in and probably manually finish up a grinder until you get close to the right shape. [19:27.480 --> 19:30.440] With the CNC machine, it doesn't care the geometry we give it. [19:30.540 --> 19:40.020] It will break it down into numbers, into locations, and it can then implement that into something that, you know, is not something I could machine by hand or anybody could machine by hand. [19:43.040 --> 19:47.260] So, once we have it done in the CAM program, there is one more step. [19:47.520 --> 19:52.820] I mentioned that, you know, generally it's sort of a standardized way of coding. [19:53.020 --> 19:57.460] We go through, at the end of the CAM step, before we get to the CNC, what's called a post processor. [19:57.820 --> 20:04.320] And the post processor is this unique invention because, despite the language being standardized, nobody implements it the same way. [20:04.320 --> 20:10.320] So, you know, different tools want... different CNC tools want different things to be done in different orders. [20:10.840 --> 20:13.260] They want instructions to be given in very specific ways. [20:13.680 --> 20:31.980] So, we basically take the... if G-code is English, and I apologize for using this metaphor, the post processors tweak our kind of basic dictionary English into, you know, New Yorker or Southern or California or Valley Girl, Australian, British, whatever the equivalent is for that machine. [20:32.100 --> 20:35.420] Those, you know, and it's basically a translation file for the specific machine. [20:35.500 --> 20:46.320] It's going to do things like, if you see down here, on a circular command, the G02 and G03, you can call out the radius of your circle in two different ways. [20:46.400 --> 20:47.640] You can call it using an R. [20:48.080 --> 20:50.860] R allows us to call it a specific radius, right? [20:50.940 --> 20:51.520] Simple radius. [20:51.520 --> 20:54.300] You can also call out a center location. [20:54.300 --> 20:59.520] That's basically forming an arc that moves about an arbitrary center that you define. [20:59.860 --> 21:01.760] Some machines prefer one method over the other. [21:01.860 --> 21:03.020] Some machines allow both. [21:03.160 --> 21:08.660] And there's certain advantages to using different ones that are going to be specific to your machine and your code and your use. [21:08.880 --> 21:09.320] Okay? [21:09.620 --> 21:11.500] So, here's what it actually ends up looking like. [21:11.500 --> 21:22.300] And this is a hundred and, well, this is like 30 lines of code out of a 6800 line long program that machines something about an inch and a half in diameter. [21:22.440 --> 21:24.600] So, this is simple by the standards of G code. [21:25.080 --> 21:30.960] The first part, everything up through, I'd say, about N55 is really a preamble. [21:31.080 --> 21:32.440] It's saying, turn the machine on. [21:32.660 --> 21:35.680] What coordinate system, what axis system am I working in? [21:35.800 --> 21:37.200] What unit system, you know? [21:37.280 --> 21:38.680] Am I working in inches or millimeters? [21:38.680 --> 21:42.500] Then we get into, you know, like, line N75. [21:43.020 --> 21:48.660] Okay, that moves the tool down 3.8 thousandths of an inch. [21:50.200 --> 22:00.200] Line 80 then moves it 18 thousandths of an inch in the X, 0.4 inches in the Y, and down 7 thousandths of an inch. [22:00.340 --> 22:07.640] You can see why we don't want to write these things by hand, because from N80 down through N170 is the same basic concept, right? [22:07.640 --> 22:14.740] We see G1, G2, G1, G3, over and over and over again with just different numbers in there. [22:14.860 --> 22:20.440] And because we can't store variables, because we have to feed it numbers, writing this by hand is troublesome. [22:22.440 --> 22:29.020] So, the other way to do this, everything that we talked about with CNC machining is what we call subtractive manufacturing. [22:29.280 --> 22:31.000] You can also use this for additive manufacturing. [22:31.000 --> 22:33.500] You can, for example, 3D print a house. [22:33.700 --> 22:35.540] This is a concrete 3D printer. [22:36.400 --> 22:40.260] What you can see here starts to immediately look familiar as we learn about G code, right? [22:40.460 --> 22:41.780] That's a G01 command. [22:41.900 --> 22:42.840] That's moving in a straight line. [22:42.940 --> 22:44.040] That's moving in a straight line. [22:44.240 --> 22:47.140] It's just straight line after straight line after straight line. [22:47.620 --> 22:50.620] And it keeps going until you've actually built something up. [22:50.940 --> 22:54.160] If you guys are still passing the shower head around, right? [22:54.220 --> 22:54.980] That's the same idea. [22:55.140 --> 22:57.300] This is another little 3D printed set of parts. [22:57.300 --> 22:58.940] I use these for when I teach classes. [23:00.100 --> 23:01.700] These are printed as a teaching aid, right? [23:01.860 --> 23:02.720] They're just the same thing. [23:02.860 --> 23:06.060] If you take them apart and break them down, they're just layer by layer. [23:06.840 --> 23:14.740] The machine went ahead and traced that path, and traced that path, and traced that path, and stepped up in space each time. [23:15.040 --> 23:16.760] So, same idea, right? [23:17.000 --> 23:20.740] You don't have to make really boring basic shapes either. [23:21.220 --> 23:24.240] You can get a robot arm, which robot arms run on G code too. [23:24.240 --> 23:29.560] And you can print or just have it move in 3D space. [23:29.860 --> 23:33.000] So, we can see it's kind of printing a freehand arc right here. [23:33.540 --> 23:39.820] And what you see when you put it side by side with the CAM software is, all it's doing is tracing and replicating that path. [23:39.920 --> 23:45.000] It's really an API to communicate between the CAM software that you guys see on the right. [23:45.120 --> 23:46.280] I've got to do left and right here. [23:46.280 --> 23:50.300] And what you see the machine actually executing now on the top. [23:50.580 --> 23:52.040] So, that's the advantage of the CAM software. [23:52.200 --> 23:59.120] It's a very, very visual way of coding for something that ends up being real and physically manipulable in kind of the visual phenomena. [23:59.580 --> 24:03.340] And so, this is a really cool low-cost metal 3D printing. [24:03.680 --> 24:05.380] It's basically a welder. [24:05.640 --> 24:09.940] And it just goes ahead and prints metal in the path that we tell it to print. [24:10.500 --> 24:10.980] All right. [24:11.180 --> 24:11.320] Okay. [24:11.920 --> 24:15.720] So, CNC cutting versus 3D printing. [24:15.940 --> 24:17.280] Again, they both use G-code. [24:17.740 --> 24:29.160] And the reason when 3D printers started to come about that they used G-code as kind of the default method of interpreting is, one, it's well-founded, and two, it works. [24:29.820 --> 24:32.600] It works really well for what it's trying to do. [24:32.700 --> 24:34.200] It's not necessarily elegant. [24:35.140 --> 24:38.960] There's a lot of features it's missing, but it works for what they're trying to do. [24:38.960 --> 24:42.680] Which is geometrically move a, in this case, a print head about. [24:43.100 --> 24:55.600] It's also very much standardized in industrial equipment, which means that when they brought 3D printers into kind of the first set of users of 3D printers, which were really big industry again, they know how to code in these environments. [24:55.720 --> 24:57.040] They know what the code looks like. [24:57.320 --> 25:04.140] And the only difference between what we call a CNC, or like a machine tool, and a 3D printer is whether they remove or add material. [25:04.340 --> 25:06.800] MakerBots, for example, run on G-code. [25:06.800 --> 25:11.880] If you were to open up a MakerBot file, it's not going to look like it, but they run on G-code. [25:12.420 --> 25:12.500] Okay? [25:13.760 --> 25:18.560] So, the eventual goal, in my mind, would be we get to a point where we're doing something like this. [25:18.640 --> 25:20.660] This is made by a company called Moriseki. [25:20.800 --> 25:26.160] It's a combined 3D printer and 3D CNC mill. [25:26.160 --> 25:27.640] So, it goes ahead. [25:27.780 --> 25:31.100] It says, well, this is the rough shape that I want to create. [25:31.320 --> 25:36.520] Rather than having to go and cast this out and make a mold and do all that work, you can go ahead and just 3D print it. [25:36.540 --> 25:38.640] I think it's 3D printing in titanium right here. [25:39.260 --> 25:41.100] It's 3D printing a part for a jet engine. [25:41.260 --> 25:42.820] So, you print the flange. [25:42.940 --> 25:44.680] You print a basic shape. [25:44.680 --> 25:50.220] Then, you can swap out the print head, and it'll go over. [25:50.320 --> 25:51.940] And this is just an M06 command. [25:52.080 --> 25:53.900] This is one of the standard G-code commands. [25:54.100 --> 26:05.060] Picks up a cutting head, and if it switches back to video here, we can then cut out that kind of rough or net 3D printed shape to get exactly the shape, exactly the surface finish we want. [26:05.100 --> 26:12.100] We use these technologies as kind of cohabitive technologies to get the best results of each one. [26:12.100 --> 26:13.600] You can smooth things out. [26:13.860 --> 26:22.180] And then, once you're done smoothing things out, you can go ahead and switch back to the 3D print head after you drill these holes. [26:22.240 --> 26:32.860] Because these holes, if we made that bigger diameter, that bigger hole wider, if we had it kind of move outwards like a cone shape, you can't get to where those holes are cut. [26:33.060 --> 26:35.520] So, I 3D print a rough shape. [26:35.620 --> 26:37.020] I modify it with the cutting head. [26:37.140 --> 26:43.340] Then, I 3D print more, and I 3D print this bevel or cone shape that prevents me from accessing those holes directly. [26:43.580 --> 26:47.300] And I just keep switching off back and forth until I get a complete shape. [26:47.400 --> 26:48.340] This is going to take forever. [26:48.760 --> 26:49.520] I think this is... [26:49.520 --> 26:55.380] When they released, it's like an $850,000 piece of equipment that I will never ever get to touch in my life. [26:56.300 --> 26:58.020] But, the ability is there, right? [26:58.020 --> 27:03.320] We now have the ability to both add material and remove material at will to create a fully custom shape. [27:03.440 --> 27:08.780] Because we take the advantages of each side, and we match them together, and we just use G-code on both sides. [27:10.000 --> 27:10.260] Okay. [27:11.100 --> 27:11.540] MakerBots. [27:11.620 --> 27:14.260] Because I'm guessing a few people in here have MakerBots. [27:14.340 --> 27:17.220] First thing to know about MakerBots, they do use G-code. [27:17.440 --> 27:21.220] What they do, though, is they have a very weak processor on the board. [27:21.220 --> 27:28.020] They've decided not to dedicate processor resources to actually interpreting G-code, even though the processor is capable of doing that. [27:28.380 --> 27:33.060] Instead, what they do is they compile that code down to almost a serial bit stream. [27:33.300 --> 27:41.720] That serial bit stream is easier to interpret, it's faster for it to interpret, and so it's able to print faster and keep up at the processor side, despite the fact that all the commands are the same. [27:42.160 --> 27:54.320] MakerBot has also implemented some specific things, and they publish these, how they implement G-code and how they implement all the G and M codes to make it work with something that's kind of not the original intent of G-code. [27:54.560 --> 27:56.940] For example, they have an extruder rather than a cutting head. [27:57.080 --> 28:04.700] That M03 and M04 that turn on our CNC mill cutting head are useless to the MakerBot. [28:04.800 --> 28:11.220] So they implement M101 and M102 and M103, which turn on and turn off their extruder head. [28:11.220 --> 28:19.660] Anything that's above 100 are pretty much, they're typically used as vendor or machine-specific implementations of the G-code. [28:20.200 --> 28:25.920] There's also one on here, and I forget the exact number, but there's a MakerBot-specific M-code. [28:26.140 --> 28:32.460] It's like, I want to say M316 or something like that, that will play a song. [28:33.000 --> 28:38.120] Which, you know, I don't think the Moriseki machine is going to have the ability to play a song. [28:38.120 --> 28:39.600] It's kind of a different use. [28:40.880 --> 28:45.380] If you actually were to export it before it does that compile step, it looks very similar. [28:45.540 --> 28:46.360] I use a piece of software. [28:46.420 --> 28:47.620] I don't use the MakerBot software. [28:47.740 --> 28:58.940] I use a thing called Slicer that is CAM software to, rather than computing machining code to remove material subtractive manufacturing, it computes a shape via additive manufacturing. [28:59.120 --> 29:01.520] It slices it into individual layers that it then prints. [29:01.620 --> 29:08.680] The really nice thing about Slicer and about the G-code that it's generated from MakerBots is it's incredibly verbose with commenting. [29:08.900 --> 29:14.620] So if you wanted to learn about this, go make one of their files and you can just read through and it tells you exactly what it's doing. [29:14.780 --> 29:19.200] So it says, you know, this G-code is generated using this version of this software. [29:19.780 --> 29:22.000] That's actually somewhat rare in CAM software. [29:22.440 --> 29:26.560] It says, you know, effectively Skynforge 50, it's kind of like a compiler. [29:26.560 --> 29:31.400] That's what the compiler was, when it was done, what it was done for. [29:31.540 --> 29:32.580] Those type of little details. [29:32.700 --> 29:37.940] It inserts all that into the code, which I really like because most of the commercial-grade packages don't do that. [29:38.880 --> 29:39.000] All right. [29:39.260 --> 29:53.380] So the end result of all this, and I just like this video, and it really tells the story of kind of what this stuff can do is, well, if we start with about 120 kilogram block of aluminum, what can we do with it in G-code? [29:53.520 --> 29:56.320] Well, this is a six-axis CNC mill, right? [29:56.660 --> 30:01.120] It's able to move the table that has our part mounted on it back and forth in two directions. [30:01.360 --> 30:02.260] It's able to rotate it. [30:02.400 --> 30:08.440] And then the head of the machine, you see with the cutter up here, is able to move up and down, left to right. [30:08.900 --> 30:09.860] That's four and five. [30:10.040 --> 30:12.660] And it's also able to rotate in a sixth direction. [30:12.680 --> 30:14.380] That means we can move it in six different directions. [30:14.700 --> 30:22.860] And by doing that and by using this code to our advantage, we can develop very precise, very intricate shapes. [30:23.580 --> 30:27.880] If we flip it over, remount it, we're able to actually machine on all the different sides. [30:28.000 --> 30:30.660] What they're machining here is basically a motocross helmet. [30:30.740 --> 30:32.500] This is a demo video for one of the tool makers. [30:33.380 --> 30:35.740] You can see, right, we're using a very heavy tool here. [30:35.860 --> 30:37.140] It's generating a lot of material. [30:37.280 --> 30:38.600] It's removing a lot of material very quickly. [30:38.820 --> 30:53.640] And then we switch over and use a very thin, very long bit so that you can reach into intricate areas and you can move different parts and move the cutting head and move the part itself in different directions to get the orientation you want. [30:54.180 --> 30:56.560] You can see it's machining inside of the part now. [30:57.140 --> 31:00.260] And what you're seeing there in that little inset is that's the code. [31:00.420 --> 31:02.700] Those are the tool paths that the machine's actually going to follow. [31:03.140 --> 31:09.620] So I know it's a little difficult to see when we project this up, but they're actually able to take it to the level of detail where they can engrave. [31:10.140 --> 31:14.200] They can move in different directions at different speeds to change the surface finish. [31:14.420 --> 31:26.900] So you end up with a surface that has no visible, no perceptible difference in depth, but it has a different surface finish and that different surface finish gives it a different look and you can actually basically print text on top of it, right? [31:26.940 --> 31:30.700] You see these big exaggerated movements to give it the orientation that it needs. [31:30.860 --> 31:32.640] And then you just see little tiny movements. [31:32.640 --> 31:42.520] Every single one of these to take this from a big block of aluminum down to, I think it was like a 13 kilogram helmet, so we're losing like 90% of the material, is an individual line of G-code. [31:44.500 --> 31:45.300] So, questions. [31:46.180 --> 31:47.920] That's a little faster than I thought it would go. [31:48.780 --> 31:50.240] Yeah, you can do this with G-code too. [31:52.640 --> 31:53.360] I don't see. [31:53.400 --> 31:54.260] It's really hard to see. [31:55.020 --> 31:55.420] Question. [31:55.720 --> 32:04.180] So, given that everyone's using the CAD-CAD software, what is the benefit of knowing and understanding the G-code? [32:04.420 --> 32:06.440] Do people go in and tweak it manually? [32:06.440 --> 32:06.800] Yes. [32:07.940 --> 32:09.120] The benefit is a couple of things. [32:09.240 --> 32:14.040] One, my mindset is I like to know what something's doing. [32:14.340 --> 32:17.820] That's why most of my stuff at home doesn't work because I've taken it apart. [32:18.880 --> 32:23.180] If I know the code, I can understand what it's trying to do. [32:23.320 --> 32:27.860] I can better understand the options inside of those programs to make it do what I want. [32:27.860 --> 32:33.800] Additionally, when you actually run the machine, you're able to... [32:33.800 --> 32:34.720] I'm going to keep playing this. [32:35.600 --> 32:40.920] You're able to watch on the CNC controller screen what different commands are going by. [32:41.020 --> 32:46.340] And if you can identify where there's an issue or a glitch, you're able to go back and fix that. [32:46.340 --> 32:55.140] One of the common things that can happen is when people start to learn about this, they're always asked to write a program to drill two holes in a piece of material. [32:55.380 --> 33:01.040] And if we mime that out, it's go to the location of the first hole, drill the first hole, and then what? [33:02.820 --> 33:03.540] Go up. [33:03.940 --> 33:05.880] A lot of people forget the go up part. [33:06.500 --> 33:15.120] And if you are still down in your hole in a big piece of titanium, and you try and tell it to go to another location, the machine's going to go there, but it's going to leave the cutting bit where it was. [33:15.860 --> 33:24.880] So that's why you want to know what it's doing so you can understand what it's doing, but you want to try and avoid writing it by hand so that you remember to come out of the hole, because the software doesn't forget to do that. [33:25.760 --> 33:26.120] Question? [33:27.020 --> 33:30.060] Has there never been an attempt to do a higher level language? [33:30.060 --> 33:31.740] Or is there just too much inertia? [33:33.160 --> 33:34.420] There's a lot of inertia. [33:34.560 --> 33:38.740] When I said there are companies that still run tape machines, I'm not joking. [33:39.320 --> 33:44.140] Back when I was in college, I actually worked at a place that still ran mechanical machines. [33:44.160 --> 33:52.800] They'd follow a path that wasn't computerized, it was cut into a steel cam, like a camshaft, and the machine followed that path. [33:53.060 --> 33:58.020] Really, the perception is there's no need to change something if it doesn't work. [33:58.120 --> 33:59.460] And it does work very well. [33:59.460 --> 34:11.560] There, however, has been an attempt to not necessarily do a higher level language, because at some point you have to describe the features and the parts that you're trying to cut in some sort of geometric space. [34:11.780 --> 34:22.360] There has been an attempt, though, to do a higher level language that does, has more features, that allows you to put into place more complex geometry than just straight lines and curves. [34:22.360 --> 34:30.680] Because if you want to, you know, generate a compound curve, the perfect example would be like the shape of a wing, the cross-sectional shape of like an airplane wing, right? [34:30.860 --> 34:32.280] It gets thicker and then it gets thinner. [34:32.420 --> 34:34.020] That's not a continuous curve. [34:34.540 --> 34:38.480] So that's very difficult to implement in G-code, because it's not a continuous curve. [34:38.480 --> 34:42.440] It means you can't do it with straight lines, and you can't do it perfectly with curves. [34:42.580 --> 34:48.720] So you select the best of both worlds, and you break it down into thousands and thousands of little individual curves. [34:49.700 --> 35:01.680] StepNC is another NIST project that exists for the purpose of trying to kind of get higher level mathematics into the code, because the processing power has come up to the point where they can do that now. [35:03.200 --> 35:04.240] Question in the back. [35:04.240 --> 35:16.800] Question in the back. [35:24.560 --> 35:26.740] That's very true. [35:28.000 --> 35:32.400] There are also cutting tool vendors that sell floppies. [35:33.200 --> 35:34.480] specifically for this purpose. [35:34.760 --> 35:46.320] And you'll see them, you know, they offer drill bits, what's called end mills, which are basically metal cutting tools, and then they'll offer floppy disks, because they've stockpiled them to keep some of those machines running. [35:46.780 --> 35:51.960] So for that machine, where it did both, where it was 3D printing and the CNC and CNC. [35:52.300 --> 35:52.620] Uh-huh. [35:52.680 --> 35:53.680] How is it printing? [35:53.940 --> 35:54.880] Was it like a... [35:54.880 --> 35:56.720] It's what's called laser sintering. [35:57.000 --> 35:57.420] So... [35:58.060 --> 36:10.360] Yeah, in that machine, because they can't have a powdered bed, is the way you'd typically print in metal, is you have a laser or a heat source shined at, or pointed at, a bed of powder, and it prints a layer. [36:10.560 --> 36:13.940] Then it lowers that down, sweeps new powder on top, and prints a layer. [36:14.420 --> 36:17.260] It's a little bit wasteful, but it's the way it's been done traditionally. [36:17.440 --> 36:24.360] What that machine kind of does is, it actually injects the powder alongside it, so it's spraying. [36:24.640 --> 36:32.580] Spraying the powder into place, crystallizing it, and then it vacuums it back out, so that you don't clog up the worst of the machine, because you can't have a ton of extra powder sitting in there. [36:33.860 --> 36:34.240] Yeah? [36:34.840 --> 36:36.540] What about things like accelerations? [36:36.540 --> 36:45.200] So some of the GCO have feed rate, and you know, at what point in your process do you have to understand something like how fast the material can tolerate? [36:45.480 --> 36:50.540] Well, there's a couple different points on that. [36:51.640 --> 37:03.660] If you're talking about the material, what the material can tolerate in terms of feed rate, before those nice, clean surface finishes turn like cherry red and start to glow from heat, that's machinist's experience. [37:03.940 --> 37:18.180] You can adjust it on the machine, but typically that's something you're going to pre-program and say, well, I have this cutting bit from this vendor, and I know my tool, and I know this material, and I combine all of that knowledge into one cohesive number that says go this fast. [37:18.340 --> 37:22.660] From the acceleration component, most of the acceleration is actually handled by the machine. [37:23.220 --> 37:35.100] If you try and give it a feed rate, so basically a velocity, if we talk about the three, you know, position, velocity, acceleration, if you give it a velocity that's too high, the post-processor should catch that, and it will reject it. [37:35.260 --> 37:44.580] I've had things where if you ask, you know, a post-processor to do something that that machine's not capable of, it'll throw a flag, it'll throw an error and say, you just asked it to do something that it can't do, stupid. [37:46.020 --> 37:51.440] From the acceleration side, though, they've moved that pretty much downstream, because every tool moves differently. [37:51.660 --> 37:54.580] Some of them move the cutting head, some of them move the cutting bed. [37:55.120 --> 38:05.340] The machines handle the velocity and acceleration on their own to keep effectively a vector speed that matches the speed you gave it while hitting the points as accurately as possible. [38:05.400 --> 38:08.060] They'll handle acceleration on their own from the feed rate you give it. [38:09.480 --> 38:09.920] Yeah? [38:10.020 --> 38:12.300] Are there commands for homing or coloration? [38:12.460 --> 38:12.700] Yeah. [38:12.840 --> 38:13.800] When you set the machine up? [38:14.780 --> 38:18.060] And typically, if you... and we'll go back a slide here. [38:19.120 --> 38:20.280] I really like that video. [38:20.600 --> 38:21.660] That guy looks like he's having fun. [38:21.760 --> 38:22.480] I need one of those. [38:22.700 --> 38:25.780] So if you watch at the very beginning here, it's not cutting anything. [38:25.900 --> 38:27.440] What it's doing is a probing routine. [38:28.560 --> 38:39.520] Back before probing routines existed, and wow, that sounds horrible, you would manually locate, say, a corner or a measurement point on the machine. [38:39.860 --> 38:43.960] And you say... and give that machine and say, this is the starting point. [38:44.040 --> 38:46.560] This is your zero, your origin of your coordinate system. [38:46.700 --> 38:49.980] And all of your coordinate system in the G code is built to work from there. [38:50.160 --> 38:52.520] And you can give it specific commands to take care of that. [38:53.260 --> 38:57.280] Nowadays, most of the machines have the ability to insert an electronic probe. [38:57.280 --> 39:01.160] They know the general box in which your part is. [39:01.540 --> 39:07.940] And then they'll go and find the scope, and the size, and the shape, and the orientation of your material within that box. [39:07.940 --> 39:09.640] So they know exactly where to start from. [39:09.740 --> 39:10.780] And that removes the source of error. [39:10.820 --> 39:22.900] Because if I'm making, say, a hundred thousand of these, and there's a couple thousandths of inch of wobble in how I mount that part, I'm going to end up with a hundred thousand different parts, right? [39:23.040 --> 39:24.200] At some level, they're different. [39:24.280 --> 39:29.420] And whether that's tolerable or not to me as the machinist, to me as a manufacturer, is why I might go use something like that. [39:29.920 --> 39:29.940] Okay. [39:31.360 --> 39:31.860] Question? [39:32.220 --> 39:38.900] What prevents against bugs in the generation translation between 3D automatically moving the head into a wall and destroying it? [39:39.020 --> 39:47.360] What's like the certification process that you go to run an $80,000 machine or $200,000 machine so you can destroy the head of the G code? [39:48.200 --> 39:49.320] There's a couple ways. [39:49.940 --> 39:52.460] There's secondary products that do check for that. [39:52.900 --> 40:05.100] A lot of the CAM programs nowadays have routines built in where I can say I can define the scope and the space of my machine and where there's cutting bits and where there's supporting material and where there's, you know, electronics. [40:05.620 --> 40:07.820] And it will make sure it avoids those areas. [40:08.660 --> 40:18.500] As you run through, you can watch for collisions and the software will detect when the non-cutting parts of the machine collided with something and they'll detect flag and throw an error. [40:18.800 --> 40:20.440] There's also the ability to... [40:20.440 --> 40:22.940] the way it was done before was you would simulate this. [40:23.060 --> 40:31.640] You sit there and you can run it line by line and you can watch the machine move and you can watch that all your features create correctly, watch that it does this machine. [40:31.740 --> 40:33.420] It basically simulates this as kind of a... [40:33.420 --> 40:37.020] almost like an animated movie on your computer to watch that. [40:37.120 --> 40:39.520] And you'll see people in production environments say... [40:39.520 --> 40:55.260] They'll sit down and watch every single line of code execute because if I'm one engineer and they pay me to sit there and edit G-code, and I'm making a hundred or two hundred or a million of these parts, if I can spend a day trimming four or five seconds off the machining time, [40:55.500 --> 41:05.040] by yes, making sure it doesn't collide, but also make sure that it doesn't come that extra inch above the surface, that's going to save my company money in the end. [41:05.140 --> 41:07.200] So a lot of it's still done pretty manually actually. [41:07.660 --> 41:12.040] In the last three to four years, you've started to see that change, but a lot of it's done manually still. [41:13.260 --> 41:14.020] In the back? [41:23.750 --> 41:24.730] They look ahead. [41:26.650 --> 41:27.670] It's called look ahead. [41:27.930 --> 41:34.590] So while it's executing one line of code, it's going to that physical location that you've called out. [41:34.990 --> 41:45.330] It's also looking at the next between three, five, and ten lines of code to say what am I... to the question about acceleration, what do my acceleration profiles need to be? [41:45.330 --> 41:49.550] So that I keep this constant velocity and I end up at this same point. [41:49.990 --> 41:58.250] And that's really one of the big advantages of this is that, you know, if I'm a machinist, I can, again, I can move really one direction precisely at one time. [41:58.590 --> 42:03.730] If I try and like machine a circle by turning the X and the Y handles, I've met people that can do that. [42:03.850 --> 42:04.930] They're really good at their jobs. [42:04.990 --> 42:05.750] I can't do that. [42:05.890 --> 42:06.690] Because you have to move them. [42:06.790 --> 42:07.690] It's like an Etch-a-Sketch. [42:08.990 --> 42:11.010] Logic built into the machine. [42:11.430 --> 42:13.750] Logic built into the machine. [42:16.710 --> 42:19.770] Well, there's actually two different ways to run G-code. [42:19.950 --> 42:21.190] And you can call out either one. [42:21.810 --> 42:25.630] Traditionally, nowadays, you run in what's called increment mode, where it's absolute. [42:26.830 --> 42:32.410] The other way is you can run, you know, I'm sorry, increment mode that is delta from location to location. [42:32.670 --> 42:33.490] A to B to C to D. [42:33.930 --> 42:35.490] You can also run in absolute mode. [42:35.810 --> 42:39.710] However, the way the machines work nowadays, they're not just blindly moving. [42:39.850 --> 42:40.930] It's actually a closed loop. [42:41.030 --> 42:41.810] It's not open loop movement. [42:41.930 --> 42:42.830] It's closed loop movement. [42:42.830 --> 42:44.510] So they see where they're getting to. [42:44.670 --> 42:46.030] And they'll start to learn. [42:46.030 --> 42:50.530] They have values inside the controllers that allow them to correct for wear over time. [42:50.590 --> 42:57.250] Because, you know, if I run this table back and forth 50,000, 60,000 times, it's going to start to wear. [42:57.370 --> 42:58.390] Things are going to start to change. [42:58.490 --> 42:59.410] It's a mechanical system. [42:59.550 --> 43:01.450] You know, transistors don't tend to wear out. [43:02.030 --> 43:03.830] Mechanical devices do a lot more. [43:04.190 --> 43:05.490] And it will compensate. [43:05.670 --> 43:08.510] And actually, routines built in to say, well, I'm missing by this much. [43:08.650 --> 43:10.130] And it'll put in those variables. [43:10.250 --> 43:12.570] It'll use those variables to add up and keep that correction in place. [43:12.570 --> 43:16.370] So, within G code, there's no move for sensor feedback. [43:16.650 --> 43:17.430] I can't... [43:21.700 --> 43:22.540] You can. [43:23.080 --> 43:25.560] And the G code will wait until it gets to 40. [43:25.560 --> 43:25.940] Yes. [43:26.360 --> 43:35.220] So, typically, the way that would work is it'll wait until a line of code has completed executing before it begins the next line of code. [43:35.400 --> 43:39.740] So, if I said change temperature mid print, it'll get to that line. [43:39.920 --> 43:40.980] Everything will stop. [43:42.380 --> 43:46.220] It'll toggle the set value, you know, the latched value for that. [43:46.220 --> 43:48.280] Inside of the memory of the CNC controller. [43:48.480 --> 43:50.920] And then it'll wait until that's accomplished. [43:51.080 --> 43:53.120] Once it's accomplished, then it'll continue. [43:53.340 --> 43:54.160] That's the default state. [43:54.240 --> 43:56.220] So, I could also implement something like... [44:01.240 --> 44:02.560] So, like a homing routine. [44:02.720 --> 44:02.800] Yeah. [44:03.020 --> 44:07.400] So, typically, the way that would work is you'd say move in a certain direction at a certain speed. [44:08.300 --> 44:22.340] And then the machine's smart enough to know, not in the G code, but in the machine controller, when I trigger this limit switch, like on your MakerBot, if you home your MakerBot, that homing routine is just a single line of G code. [44:22.600 --> 44:24.620] And that's why I tend to use the API metaphor. [44:24.920 --> 44:29.120] You call a homing routine and the homing routine is not stored in G code. [44:29.400 --> 44:31.480] It's stored inside of the CNC controller. [44:31.660 --> 44:38.340] And, you know, every CNC controller is going to have that a little differently if the homing position is, say, up here versus down here, right? [44:38.420 --> 44:39.780] They're going to execute it in different ways. [44:39.780 --> 44:44.280] But you're going to call the same, the same M code in that case. [44:45.220 --> 44:46.200] Get on questions. [44:46.380 --> 44:46.720] One more. [44:46.740 --> 44:47.820] One more right there. [44:48.380 --> 44:48.700] Behind you. [44:51.900 --> 44:52.380] Yeah. [44:56.460 --> 45:01.940] I think the idea with MakerBot is to try and get people away from knowing how G code works. [45:02.240 --> 45:05.000] If you use the MakerBot software, you never see G code. [45:05.640 --> 45:06.800] But, I don't know. [45:06.800 --> 45:09.460] So, in that I'll be designing more of an object. [45:09.960 --> 45:10.200] Yes. [45:10.340 --> 45:10.920] And it'll print. [45:11.380 --> 45:18.060] And it's much easier to do that for 3D printing because, you know, if I pick my 3D printing parts up here again, right? [45:18.300 --> 45:20.400] These are printed with one filament size. [45:20.800 --> 45:22.860] That's effectively our tool bit size, right? [45:23.060 --> 45:27.020] If I want to 3D print or not 3D print an area, it just prints and prints and prints. [45:28.520 --> 45:30.360] You can have two or three print heads. [45:30.500 --> 45:31.580] You can do multiple colors nowadays. [45:31.620 --> 45:39.980] But, generally, that's different from machine tools in that, in a machine tool, if I want to drill a quarter inch drill bit or a quarter inch hole, I have to have a quarter inch bit. [45:40.100 --> 45:42.500] If I want to drill an eighth inch hole, I have to have an eighth inch bit. [45:43.040 --> 45:52.680] And then, controlling the way it implements different features is a lot more options and a lot more complexity in doing the machining side of it than there is in doing the 3D printing, just in terms of how the G code works. [45:52.680 --> 46:11.440] If you were to open up a, you know, machining file for something like this versus a 3D printing file for something like this, there's going to be a lot more in the machining file that is set up and configuration and information to the machine on what it's doing and how it's doing it, [46:11.600 --> 46:12.500] not just movements. [46:12.700 --> 46:19.160] The 3D printing world is very, very just movement driven and it just feeds plastic or PLA at a constant rate. [46:19.500 --> 46:20.280] You have a question? [46:20.540 --> 46:22.000] How is backlash again? [46:24.620 --> 46:26.620] So it's not handled in the G code. [46:26.980 --> 46:28.740] G code is very, very explicit. [46:28.980 --> 46:30.360] Again, it's do this. [46:30.600 --> 46:31.720] I don't care how you do it. [46:31.780 --> 46:32.960] I don't want to see that you did it. [46:33.060 --> 46:35.660] I trust you as the computer that's running the machine to do it. [46:36.200 --> 46:41.100] The machines themselves will compensate, good machines will compensate for backlash. [46:41.240 --> 46:45.940] Backlash is if I change direction, you know, any mechanical system has a little bit a slop in it. [46:46.060 --> 46:52.300] So if you change the direction that you're feeding in, well, it has to pick up that slop before it physically starts moving in the other direction. [46:52.940 --> 46:53.340] Okay. [46:53.660 --> 46:55.200] Is that it for questions? [46:56.280 --> 46:56.680] Cool. [46:57.040 --> 46:57.240] All right. [46:57.660 --> 46:58.180] Thank you guys.