How to Generate Pocket Toolpaths in FreeCAD
Generating G-code toolpaths for pocket milling in FreeCAD involves preparing a 3D model, setting up a machining Job within the CAM (formerly Path) Workbench, applying a Pocket Shape operation, and running a post-processor. This step-by-step guide covers how to select your geometry, configure cutting depths and stepovers, simulate the toolpath to prevent collisions, and export ready-to-run G-code for your CNC controller.
1. Open the CAM Workbench and Create a Job
- Open your 3D model in FreeCAD (ensure your part contains a closed pocket feature).
- Switch to the CAM Workbench (labeled as Path in FreeCAD versions prior to v0.21) using the workbench drop-down menu.
- Click the Create Job button in the toolbar.
- In the Job dialog:
- Geometry Tab: Ensure your part is selected as the base object.
- Output Tab: Choose the appropriate Post
Processor matching your CNC machine's controller (e.g.,
grbl,linuxcnc,marlin). - Setup Sheet / Stock Tab: Define the raw material dimensions, adjusting the stock bounding box and setting your Work Coordinate System (WCS) origin (X, Y, Z zero).
- Tools Tab: Add an appropriate end mill from your tool library and assign it to the job.
- Click OK to create the Job.
2. Create the Pocket Operation
- Expand the Job in the tree view to view its sub-elements.
- In the 3D view, select the bottom face (or the inner bottom edges) of the pocket you wish to clear.
- Click the Pocket Shape operation button in the CAM toolbar.
3. Configure Operation Properties
In the Pocket configuration task panel, set your machining parameters across the tabs:
- Base Geometry: Verify that your selected pocket face appears in the list.
- Depths:
- Start Depth: The top surface where cutting begins (usually stock top or zero).
- Final Depth: The target depth of the pocket floor.
- Step Down: The maximum axial depth of cut per pass. FreeCAD will calculate the required number of Z-passes automatically.
- Heights: Set safe clearance heights for non-cutting
rapid moves.
- Clearance Height: Height for long-distance rapid travel.
- Safe Height: Height at which the tool switches from rapid travel to the plunge feed rate.
- Operation:
- Pattern: Choose your clearing strategy (e.g.,
OffsetorZigZag). - Cut Mode: Select
ClimborConventionalmilling. - Step Over: Set the horizontal engagement percentage (typically 40%–60% of the tool diameter).
- Keep Tool Down: Enable this to reduce unnecessary retracts between cut passes.
- Use Outline: Enable if you want the tool to trace the perimeter to leave a clean edge.
- Pattern: Choose your clearing strategy (e.g.,
Click Apply to calculate the toolpath, review the visible green travel lines, and click OK to close the dialog.
4. Simulate the Toolpath
- Highlight your Job in the tree view.
- Click the CAM Simulator button in the toolbar.
- Use the playback controls to watch the material removal process.
- Check for gouges, rapid plunge movements directly into solid stock, or incorrect depth levels.
- Click OK to exit simulation mode. If issues arise, double-click the Pocket operation in the tree view to adjust settings.
5. Export the G-Code
- Select the Job object in the tree hierarchy.
- Click the Post-Process button on the toolbar (or select CAM > Post-Process).
- Choose a destination folder and filename, typically using
.gcodeor.ncas the extension. - Click Save. FreeCAD will process the toolpath through your selected post-processor, outputting clean, machine-ready G-code.