{"id":3488,"date":"2026-10-08T12:01:54","date_gmt":"2026-10-08T04:01:54","guid":{"rendered":"http:\/\/www.cyberlearnpro.com\/blog\/?p=3488"},"modified":"2026-10-08T12:01:54","modified_gmt":"2026-10-08T04:01:54","slug":"how-to-program-a-simple-part-on-a-cnc-lathe-4d5f-2b75b4","status":"publish","type":"post","link":"http:\/\/www.cyberlearnpro.com\/blog\/2026\/10\/08\/how-to-program-a-simple-part-on-a-cnc-lathe-4d5f-2b75b4\/","title":{"rendered":"How to program a simple part on a CNC lathe?"},"content":{"rendered":"<p>If you\u2019ve ever stood beside a CNC lathe in a production shop, watching a blank metal bar transform into a precise, ready-to-use part in minutes, it\u2019s easy to feel intimidated by the process. I get it\u2014when I started selling CNC lathes over 12 years ago, I watched operators spend hours troubleshooting G-codes, fumbling with workholding, and stressing over a single misplaced decimal point that could ruin an entire bar of steel. But here\u2019s the truth: programming a simple part on a CNC lathe doesn\u2019t have to be rocket science. As a CNC lathe supplier who\u2019s worked with small job shops, big manufacturers, and hobbyists looking to level up their production, I\u2019ve walked dozens of customers through this exact process, and today I want to break it down step by step\u2014no fancy jargon, no confusing formulas, just the real, practical steps we actually use on the shop floor. <a href=\"https:\/\/www.dike-cnc.com\/cnc-lathes\/\">CNC Lathes<\/a><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.dike-cnc.com\/uploads\/44834\/small\/cnc-vertical-lathe67cd5.jpg\"><\/p>\n<p>First, let\u2019s define what we mean by a \u201csimple part\u201d because that\u2019s a common point of confusion. For this guide, we\u2019re talking about a part that a new CNC operator or someone with basic manual lathe experience can program in under an hour, with no complex contours, multi-axis movement, or specialized tooling. Think of a straight shaft with a few stepped diameters, a threaded end for a bolt or fitting, a couple of simple drilled holes, and maybe a chamfer on the edge. No fancy tapers, no intricate profiles, just basic turning operations that are the bread and butter of most CNC lathe work. I pick this example because it\u2019s the part I use for most of my customer onboarding demos\u2014operators get immediate, tangible results, and it\u2019s a foundation that translates to more complex projects later.<\/p>\n<p>Before you even open your CNC programming software, you need to do two non-negotiable things: gather your material specs and final part drawing. I can\u2019t tell you how many times I\u2019ve seen a customer jump straight to code, only to realize their material is longer than their machine\u2019s maximum cutting length, or their drawing lists a diameter that doesn\u2019t match the tool they have on hand. For our demo part, let\u2019s use a 1018 cold-rolled steel bar (it\u2019s affordable, easy to machine, and the go-to for most general-purpose parts), a 1-inch diameter raw bar, and our final part specs: 4 inches long total, with a 0.875-inch diameter step for 2 inches of its length, a 0.75-inch diameter step for the remaining 2 inches, a 1\/4-inch straight threaded section on the 0.75-inch end, a 0.125-inch chamfer on the tip of the threaded end, and two 5\/32-inch drilled holes, 0.5 inches deep, spaced 180 degrees apart, centered on the 0.875-inch step. Your drawing should include every measurement to the thousandth of an inch\u2014CNC lathes are precise to 0.0001 inches, so rounding off a measurement here will lead to a part that doesn\u2019t fit.<\/p>\n<p>Next, you need to confirm your machine\u2019s setup capabilities. This is where as a CNC lathe supplier, I always emphasize checking before you program, not after. Our demo part fits on any entry-level CNC lathe with a minimum chuck capacity of 3 inches and maximum cutting length of 6 inches\u2014most of the machines we sell for small to medium production have this standard. You\u2019ll need three tools for this job: an outer turning tool (for cutting the stepped diameters), a threading tool (for the threads), and a center drill + a jobber-length drill bit for the holes. If you\u2019re working with a bar, you\u2019ll need a bar feeder or just a collet chuck to hold the stock\u2014collets work great for small, simple parts because they offer consistent runout. A quick tip I learned from a veteran operator in my first year: mark your bar 0.5 inches longer than your final part length. This extra \u201cgrip length\u201d ensures the chuck has something tight to hold, so you don\u2019t get vibration mid-cut that messes up your diameters.<\/p>\n<p>Now, the part everyone gets stuck on: writing the G-code. Let\u2019s keep this simple, no fancy subroutines or custom macros for our demo. Most CNC lathes use Fanuc-style G-code, which is the standard for 90% of machines on the market, so this will work whether you have a Haas, Okuma, or one of the mid-range CNC lathes we supply. First, let\u2019s start with the safety and setup lines\u2014you never skip these, even for simple jobs. The first line of code usually calls in the machine\u2019s home position, turns on the spindle, and sets the cutting units (we use inches here, so G20) and absolute positioning mode, which means every measurement is referenced from the machine\u2019s home point, not the previous cut. It looks like this:<\/p>\n<p>O0001 (SHAFT PART PROGRAM)<br \/>\nG20 G99 G97 G40 G54<br \/>\nT0101 (OUTER TURNING TOOL, OFFSET 1)<br \/>\nS1200 M03<br \/>\nG00 X1.1 Z0.1<\/p>\n<p>Let\u2019s break that down. O0001 is just the program number\u2014name it something you\u2019ll remember, like SHAFT01. G20 sets inches, G99 sets feed rate in inches per revolution (way easier than inches per minute for turning), G97 turns off spindle speed control for constant surface speed (better for simple parts), G40 cancels tool wear compensation temporarily for setup, and G54 is the default work offset. T0101 calls our first turning tool and its assigned offset (this is where the machine knows how far the tool is from the home point). S1200 M03 sets the spindle to spin forward at 1200 RPM\u2014for 1-inch 1018 steel, that\u2019s a safe, starting speed we adjust if needed later. G00 X1.1 Z0.1 moves the tool to a safe position just above the bar, so it doesn\u2019t crash when we start cutting.<\/p>\n<p>Next, we cut the stepped diameters. Our raw bar is 1 inch, so we need to take off 0.125 inches of material on the first step (to get to 0.875 inches) and another 0.125 inches on the second step (to get to 0.75 inches). We do this in two roughing passes to avoid putting too much stress on the tool and the bar\u2014if you take a full 0.25-inch cut in one pass, you risk chipping the tool or bending the thin part. The turning lines look like this:<\/p>\n<p>G01 Z-2.0 F0.01 (CUT TO 0.875-INCH DIAMETER, 2 INCHES LONG)<br \/>\nG00 X0.9 Z0.1 (RETRACT TO START NEXT PASS)<br \/>\nG01 X0.75 Z-2.0 F0.01 (CUT TO 0.75-INCH DIAMETER FOR THE REMAINING 2 INCHES)<br \/>\nG00 X1.5 Z0.1 (RETRACT TO A SAFE POSITION)<\/p>\n<p>Wait, you\u2019ll notice I used G01 here\u2014that\u2019s linear interpolation, which is the code for moving in a straight line, exactly what we need for our straight steps. F0.01 is the feed rate\u20140.01 inches per revolution is standard for finishing cuts on steel, and the 0.9-inch middle X position is just to clear the first step before we cut the second. If you\u2019re running a smaller, softer material like aluminum, you can bump that feed rate up to 0.015 for faster production.<\/p>\n<p>Now the chamfer on the threaded end\u2014this is a small detail that makes the part fit better, and it\u2019s super easy to add. The chamfer is 0.05 inches long at 45 degrees, so we adjust the code to cut that right at the end of the 0.75-inch step before we start threading:<\/p>\n<p>G01 X0.65 Z-3.95 F0.01 (CUT CHAMFER: MOVES FROM 0.75-INCH X TO 0.65-INCH X OVER 0.05 INCHES OF Z)<br \/>\nG00 Z0.1 (RETRACT FROM END OF PART)<\/p>\n<p>Simple enough, right? Now the threading section\u2014this is where I see a lot of new operators get nervous, but it\u2019s predictable if you get the pitch right. We\u2019re using 1\/4-inch-20 threads, which means 20 threads per inch. The G-code for threading uses G32 or G76 (we use G76 for multi-pass threading because it\u2019s more consistent and reduces tool wear). For our 0.75-inch diameter threaded section, we only need 0.5 inches of threads, so the code looks like this:<\/p>\n<p>G76 P010060 Q0.005 R0.001<br \/>\nG76 X0.693 Z-4.4 P0.05 D0.01 F0.05<\/p>\n<p>Let\u2019s translate that: G76 is the canned threading cycle. P010060 means one finishing pass, a 0.001-inch finish allowance, and 60-degree thread angle (standard for UN threads). Q0.005 is the minimum cut depth, R0.001 is the finish pass depth. The next line: X0.693 is the final minor diameter of the thread, Z-4.4 is the end of the thread, P0.05 is the depth per full thread, D0.01 is the first pass depth, and F0.05 is the pitch (20 TPI, so 1\/20 = 0.05). If you get the pitch wrong, the threads will not align, so always double-check that F value\u2014this is the number one mistake I see new programmers make.<\/p>\n<p>Finally, the drilled holes. We marked earlier we need two 5\/32-inch holes, 0.5 inches deep, on the 0.875-inch step, 180 degrees apart. On a CNC lathe, to drill a hole on the circumference, you index the spindle to the correct angle (180 degrees between holes) and then move the drill into place. We add M04 to reverse the spindle for drilling (standard for most drill bits) and use G81, the simple drilling cycle:<\/p>\n<p>G00 X0.875 Z0.1 (MOVE TO POSITION ABOVE THE STEP)<br \/>\nM04 S800 (REVERSE SPINDLE FOR DRILLING AT 800 RPM)<br \/>\nG81 R0.1 Z-0.5 F0.008 (DRILL CYCLE: R IS RETRACT POSITION, Z IS DEPTH, F IS FEED RATE)<br \/>\nG00 X0.875 C180.0 (INDEX SPINDLE 180 DEGREES FOR SECOND HOLE)<br \/>\nG81 R0.1 Z-0.5 F0.008 (DRILL SECOND HOLE)<br \/>\nG80 (CANCEL DRILL CYCLE)<\/p>\n<p>Once the drilling is done, we wrap up the program with lines to retract the tool, turn off the spindle, and send the machine back to home:<\/p>\n<p>M05<br \/>\nG00 X2.0 Z5.0<br \/>\nM30<\/p>\n<p>That\u2019s the full 15-line program for our simple shaft part. I know it looks like a lot when written out, but when you\u2019re actually programming, it takes 10 minutes max, not an hour. But here\u2019s a critical tip from my shop experience: never run a new program on a real bar first. Use your machine\u2019s \u201cdry run\u201d function, which moves the tools without rotating the spindle or cutting material, to check for collisions. I\u2019ve seen too many new operators skip this, run the code, and watch a turning tool slam into the chuck because they messed up an X or Z coordinate. Dry runs take 2 minutes, and they save you from ruining a $50 bar of steel or breaking a $200 tool.<\/p>\n<p>Once the dry run checks out, set your work offset. This is where you tell the machine where the part starts relative to the home position. You use a edge finder or a dial indicator to touch the end of the bar and the outer diameter, then input those values into the G54 offset screen on your control. This step is where 90% of minor part errors come from\u2014if your work offset is off by 0.01 inches, your final diameter will be off by that same amount, so take your time here. A good habit is to touch off the bar twice to confirm the offset values before starting the cut.<\/p>\n<p>After the first part comes off, do a quick inspection with a micrometer, thread gauge, and depth gauge. Check that the diameters are within your drawing\u2019s tolerances, that the threads fit a matching bolt easily (but not loose), that the chamfer is consistent, and that the holes are at the correct depth. For our demo part, if the threads are too tight, you can adjust the G76 minor diameter value by a few thousandths, or if the diameters are off, tweak the turning tool offset. Entry-level CNC lathes we supply have simple offset adjustment screens that let you make these changes without rewriting the entire program.<\/p>\n<p>Now, a lot of first-time programmers ask me: is it better to write code manually, or use CAD\/CAM software? For simple parts like this, manual G-code is totally fine, and it\u2019s a great way to learn how the machine actually moves. For more complex parts with intricate contours, CAD\/CAM software like Mastercam or Fusion 360 will generate code faster with less chance of error. But as a CNC lathe supplier, I always tell new operators to start with manual programming first\u2014you\u2019ll gain a deeper understanding of how each line of code translates to machine movement, which makes troubleshooting way easier when you run into issues.<\/p>\n<p>I\u2019ll be honest: even with all these steps, you might get a bad part on the first try. I made my fair share when I was new\u2014once I wrote a program that cut a step too short, and I ruined three bars of aluminum before I caught the mistake. That\u2019s part of the learning process. The key is to take small cuts, use dry runs, and always inspect the first part before running a full production batch.<\/p>\n<p>If you\u2019re just getting started with CNC lathe programming, the most important thing is to practice. Start with simple parts like this shaft, then move to parts with more steps, more threads, or angled surfaces. There are plenty of free online resources for G-code reference, but nothing beats hands-on time with a real machine. Whether you\u2019re a small job shop looking to add CNC capabilities, a hobbyist who wants to upgrade from manual machining, or a production manager looking to speed up your workflow, the basics of programming a simple CNC lathe part all come down to preparation, attention to small details, and taking your time instead of rushing through the steps.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.dike-cnc.com\/uploads\/44834\/skiving-machining-center-for-gears0d494.jpg\"><\/p>\n<p>If you\u2019re ready to invest in a CNC lathe that\u2019s built for simple, reliable programming and production, we can walk you through every step\u2014from selecting the right machine for your part size to troubleshooting your first program. Don\u2019t let the complexity of CNC machining scare you; with the right tools and guidance, even simple programs can turn into high-quality parts that make your operation more efficient.<\/p>\n<hr \/>\n<p><a href=\"https:\/\/www.dike-cnc.com\/turning-and-milling-machine-tools\/\">Turning and Milling Machine Tools<\/a> References<\/p>\n<ol>\n<li>Brown, J. CNC Programming: A Practical Guide for Operators. Industrial Press, 2021.<\/li>\n<li>Fanuc Corporation. Fanuc Series 0i-TC Operator\u2019s Manual. 2019.<\/li>\n<li>American Society of Mechanical Engineers. B2.1-2020: Specification for Unified Inch Screw Threads. ASME, 2020.<\/li>\n<li>Smid, Peter. CNC Programming Handbook. Industrial Press, 2010.<\/li>\n<\/ol>\n<hr>\n<p><a href=\"https:\/\/www.dike-cnc.com\/\">Wuxi DIKE CNC Technology Co., Ltd.<\/a><br \/>As one of the most professional CNC lathes manufacturers and suppliers in China, we have world-leading production equipment and strong manufacturing capabilities. Please feel free to buy customized CNC lathes at competitive price from our factory. Also, pricelist is available.<br \/>Address: No. 2, Xianshan Road, Qianqiao Street, Huishan District, Wuxi City, Jiangsu Province, China<br \/>E-mail: wxdk@wxdike.com<br \/>WebSite: <a href=\"https:\/\/www.dike-cnc.com\/\">https:\/\/www.dike-cnc.com\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you\u2019ve ever stood beside a CNC lathe in a production shop, watching a blank metal &hellip; <a title=\"How to program a simple part on a CNC lathe?\" class=\"hm-read-more\" href=\"http:\/\/www.cyberlearnpro.com\/blog\/2026\/10\/08\/how-to-program-a-simple-part-on-a-cnc-lathe-4d5f-2b75b4\/\"><span class=\"screen-reader-text\">How to program a simple part on a CNC lathe?<\/span>Read more<\/a><\/p>\n","protected":false},"author":98,"featured_media":3488,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3451],"class_list":["post-3488","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-industry","tag-cnc-lathes-4a25-2bb103"],"_links":{"self":[{"href":"http:\/\/www.cyberlearnpro.com\/blog\/wp-json\/wp\/v2\/posts\/3488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.cyberlearnpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cyberlearnpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cyberlearnpro.com\/blog\/wp-json\/wp\/v2\/users\/98"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cyberlearnpro.com\/blog\/wp-json\/wp\/v2\/comments?post=3488"}],"version-history":[{"count":0,"href":"http:\/\/www.cyberlearnpro.com\/blog\/wp-json\/wp\/v2\/posts\/3488\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.cyberlearnpro.com\/blog\/wp-json\/wp\/v2\/posts\/3488"}],"wp:attachment":[{"href":"http:\/\/www.cyberlearnpro.com\/blog\/wp-json\/wp\/v2\/media?parent=3488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cyberlearnpro.com\/blog\/wp-json\/wp\/v2\/categories?post=3488"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cyberlearnpro.com\/blog\/wp-json\/wp\/v2\/tags?post=3488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}