How to Generate CNC LATHE CODE using solidworks CAM HSMWORKS

Опубликовано: 11 Апрель 2026
на канале: Mechanical Engineering Design
1,016
23

In this video, we walk you through the complete process of designing a revolved part in SolidWorks and generating precise CNC codes using SolidWorks CAM for lathe operations. Whether you're a student, engineer, or machinist, this tutorial is designed to help you understand every step of the process, from creating the part to simulating the machining process and exporting G-code for a CNC lathe machine.

What You’ll Learn in This Video:

1. Designing the Part

We start by designing a revolved part in SolidWorks using the Revolve Boss/Base feature. The part includes key features like straight sections, tapers, fillets, and chamfers. This approach is ideal for cylindrical parts commonly machined on CNC lathes.

Key dimensions of the part: Diameter = 62 mm, Length = 90 mm, and additional features like a radius of 10 mm.



2. Setting Up SolidWorks CAM

Learn how to activate and configure SolidWorks CAM to start generating toolpaths.

We show how to define the machine setup, including selecting a 2-axis lathe, setting spindle speed, coolant, and tools.



3. Stock Material Definition

The video covers how to define the stock material (mild steel in this case) and set the correct dimensions for the stock to match the part's requirements.



4. Coordinate System Setup

Setting the coordinate system is critical for proper machining. We demonstrate how to align the Z-axis with the part's centerline and set the X-axis to represent the diameter.



5. Feature Recognition

Discover how to use Automatic Feature Recognition (AFR) to identify machinable features like faces, tapers, and fillets automatically.

Alternatively, we show how to define features manually for precise control over machining operations.



6. Generating Machining Operations

Rough Turning: Using G71 canned cycle for efficient material removal.

Finishing: Achieving the final dimensions and surface finish with G70 finishing passes.

Parting: Creating the final cut to separate the part from the stock.

Additional parameters like depth of cut (2 mm), stock allowances (U = 0.5 mm, W = 0.2 mm), and feed rates (F = 0.3 mm/rev for roughing and F = 0.15 mm/rev for finishing) are highlighted for optimal machining.



7. Toolpath Simulation

See a detailed simulation of the toolpaths in SolidWorks CAM. This helps visualize the machining process, ensuring no collisions or errors occur before generating the final G-code.

8. Post-Processing the Toolpath

We show how to use a post-processor to export the G-code for your CNC lathe machine. The post-processor ensures compatibility with your machine controller (e.g., FANUC, Siemens).

The final G-code includes all necessary commands, such as G71 for roughing, G70 for finishing, spindle speed (S800), coolant (M08), and safe retracts (G00).


9. Verifying and Editing G-Code

We provide tips on verifying the generated G-code to ensure it meets your machine's requirements. If necessary, we demonstrate how to make manual edits for better safety and performance.

Why This Video Is Important:

SolidWorks CAM is a powerful tool for designing and programming CNC machining operations directly from your CAD models. By mastering this workflow, you can save time, reduce errors, and streamline the manufacturing process. This video is perfect for anyone looking to bridge the gap between design and manufacturing.

Key Topics Covered:

Using Revolve Boss/Base in SolidWorks to design parts.

Setting up SolidWorks CAM for a lathe operation.

Automating toolpath generation with Feature Recognition.

Roughing and finishing using canned cycles like G71 and G70.

Simulating toolpaths to avoid errors.

Exporting and editing G-code for CNC machines.


Tools and Software Used:

SolidWorks 2023

SolidWorks CAM

CNC Lathe with 2-axis control


The part showcased in this video is a practical example of a revolved cylindrical workpiece. This design is commonly found in engineering applications like shafts, bushings, and machine components. By following the steps in this video, you’ll gain a better understanding of how to transition from 3D design to CNC machining seamlessly.

0:00 – Introduction
0:19 – Designing the part in SolidWorks
3:05 – Turning on Solidcam Addin
3:38 - Setting up SolidWorks CAM by creating new Job
4:15 – Feature Recognition and Toolpath Generation
4:50 - Turning profile selection
4:57 – Tool Library. Selecting Turning tool
6:09 - Setting Turning parameters
7:01 - Stock Simulation
7:40 – Post-Processing and G-Code Generation
9:00 – Verifying G-Code

We hope you enjoy the video and learn something new about CNC programming and SolidWorks CAM. Don’t forget to like, comment, and subscribe for more tutorials on CAD, CAM, and CNC machining!

#SolidWorksCAM #CNCProgramming #GCode #SolidWorksTutorial #CNCLathe #Machining #CAMSoftware #CNCTraining