Operations Guide
Detailed guide for all CNC operations in GScript.
Overview
GScript provides four core operation types for common CNC machining tasks:
- Face - Surface milling
- Drill - Point drilling
- Pocket - Rectangular pocket clearing
- Contour - Profile cutting
Each operation is optimized for its specific machining task and generates efficient toolpaths automatically.
##Face Operations
Surface milling to create flat reference surfaces or remove material evenly.
When to Use
- Facing stock to create a flat reference surface
- Removing material from large areas
- Achieving specific thickness
- Creating flat bottoms for pockets
Parameters
See the Language Reference - Face Operation for complete syntax.
Example
- op: face
tool: endmill-12mm
depth: 2.0
pass_depth: 0.5
feed: 1200
bounds: rect(0, 0, 100, 80)Tips
- Use larger diameter tools (10-20mm) for efficiency
- Lower stepover (60-75%) for better surface finish
- Multiple shallow passes better than single deep pass
- Consider climb milling for better finish
Drill Operations
Drilling holes at specific locations.
When to Use
- Creating mounting holes
- Pilot holes for tapping
- Clearance holes
- Alignment pins
Parameters
See the Language Reference - Drill Operation for complete syntax.
Example
- op: drill
tool: drill-5mm
depth: 8.0
feed: 300
locations:
- {x:10, y:10, z:0}
- {x:90, y:10, z:0}
- {x:10, y:70, z:0}
- {x:90, y:70, z:0}Tips
- Use peck drilling for deep holes (depth > 3x diameter)
- Lower feed rates for harder materials
- Center drill first for accurate positioning
- Use proper drill speeds (higher RPM = cleaner holes)
Pocket Operations
Clearing rectangular pockets or recesses.
When to Use
- Creating recesses for components
- Clearance pockets
- Weight reduction pockets
- Inset features
Parameters
See the Language Reference - Pocket Operation for complete syntax.
Example
- op: pocket
tool: endmill-6mm
depth: 5.0
pass_depth: 1.5
feed: 800
bounds: rect(20, 20, 60, 40)
strategy: spiralStrategies
- Climb: Best for most materials, better surface finish
- Conventional: Better for soft/sticky materials
- Spiral: Efficient for square pockets
Tips
- Use 50% stepover for roughing, 25% for finishing
- Smaller tools for tighter corners
- Multiple passes at increasing depth
- Consider roughing pass then finishing pass
Contour Operations
Following a path for profile cutting, including smooth curves with arcs and splines.
When to Use
- Cutting part outlines
- Profile milling
- Creating complex shapes with curves
- Rounded corners and fillets
- Edge finishing
Parameters
See the Language Reference - Contour Operation for complete syntax.
Example: Linear Path
- op: contour
tool: endmill-4mm
depth: 10.0
pass_depth: 2.0
feed: 600
closed: true
path:
- {x:0, y:0, z:0}
- {x:100, y:0, z:0}
- {x:100, y:80, z:0}
- {x:0, y:80, z:0}Example: With Rounded Corners (Arcs)
- op: contour
tool: endmill-6mm
depth: 3.0
feed: 800
closed: true
path:
- {x:10, y:0}
- {x:90, y:0}
- arc:{radius:10, end:{x:100, y:10}}
- {x:100, y:70}
- arc:{radius:10, end:{x:90, y:80}}
- {x:10, y:80}
- arc:{radius:10, end:{x:0, y:70}}
- {x:0, y:10}
- arc:{radius:10, end:{x:10, y:0}}Example: Smooth Curves (Splines)
- op: contour
tool: endmill-4mm
depth: 5.0
feed: 600
path:
- {x:0, y:0}
- spline:{points:[{x:25, y:15}, {x:50, y:20}, {x:75, y:15}], tension:0.5}
- {x:100, y:0}Arc Notation
Arcs are defined with:
radius: Arc radius in current unitsend: Arc endpoint coordinates (2D: x,y)clockwise: Optional, direction of arc (default: false/counter-clockwise)
Important: No spaces after colons in coordinates for YAML compatibility.
Spline Notation
Splines create smooth curves through control points:
points: Array of 2D points the curve passes throughtension: Optional, curve tightness (default: 0.5, range: 0.0-1.0)
Tips
- Use smaller tools for tighter radii
- Arcs are automatically linearized based on tolerance
- Lead-in/lead-out for cleaner starts
- Multiple passes for better finish
- Consider tool deflection on deep cuts
- Splines are ideal for organic shapes
Choosing the Right Operation
| Task | Operation | Tool Type |
|---|---|---|
| Flat surface | Face | Large endmill |
| Holes | Drill | Drill bit |
| Rectangular recess | Endmill | |
| Part outline | Contour | Small endmill |
Next Steps
- Language Reference - Complete syntax guide
- Tools Guide - Tool selection
- Examples - Working examples
- CLI Commands - Compiling programs