RasmahRasmah

Milling, turning, and cutting

Overview

Subtractive manufacturing removes material until only the part remains. This chapter covers the subtractive strategies in Rasmah: milling a planar pocket or a free-form surface, turning on a lathe, and cutting with a wire or a beam. Every strategy produces the same ToolPath you met in Manufacturing, so the post-processing and simulation stages are shared.

2.5D milling: pockets, profiles, faces, holes

A 2.5D part is one whose surface is a set of flat floors at different depths — a pocket, a step, a hole. The tool moves in x and y, and plunges to a depth. The input is a region: a list of loops (first outer, the rest holes) at a given height, as produced by slice_contours/region_at.

Rasmah.pocket_zigzagFunction

Clear a planar region by zig-zag raster, stepping down by stepdown to depth. region is a list of loops (first outer, rest holes) at z = 0; the floor is z = -depth. A finishing pass around the outer contour is appended when finish=true (tool center offset inward by the tool radius).

source
Rasmah.pocket_offsetFunction

Clear a planar region by contour-parallel offset rings, stepping down by stepdown to depth.

source
Rasmah.adaptive_clearingFunction

Adaptive (offset-spiral) clearing: cut the region by spiralling inward with a constant stepover, stepping down by stepdown to depth.

source
Rasmah.rest_machiningFunction

Rest machining: run tool_big's pocket on the stock, recover the material it left behind (corners/fillets), and clear the residual region with tool_small. Returns the small-tool clearing ToolPath.

source
Rasmah.profile_millingFunction

Side-mill a closed planar contour (a single loop at z = 0) down to depth, stepping by stepdown. The tool center rides on the contour; pass offset=radius (the default) so the tool periphery cuts the wall. Returns a ToolPath.

source
Rasmah.facingFunction

Face a region (list of loops at z = 0) to depth with a zig-zag pass at the given stepover. stock_only=true fills the region's bounding box instead of the region itself (a conventional facing pass over the raw stock).

source
Rasmah.drillFunction

Drill a set of holes holes (each a 3-vector, at z = 0) to depth. When peck > 0, the plunge is broken into peck-deep advances with full retracts between them. Returns a ToolPath.

source
region = [[[0.0, 0.0, 0.0], [20e-3, 0.0, 0.0], [20e-3, 20e-3, 0.0], [0.0, 20e-3, 0.0]]]
tp = pocket_zigzag(region, EndMill(2e-3); depth=1e-3, stepover=1e-3)
num_motions(tp)
89
round(ustrip(toolpath_length(tp)); digits=4)
0.928

Clearing a 20 mm square pocket 1 mm deep with a 2 mm tool at a 1 mm stepover takes 89 motions totalling about 0.93 m of travel.

3-axis surfacing

When the surface is curved, a flat-end tool cannot follow it; a ball-nose tool rides the surface directly. Two finishing strategies cover the common cases:

Rasmah.parallel_finishFunction

Parallel (raster) finishing: zig-zag scan lines across the XY extent of the surface, with the ball-nose tip at surface_height - radius so the cutter flank contacts the surface. angle rotates the raster.

source
Rasmah.waterline_finishFunction

Waterline (constant-Z) finishing: slice the surface at successive Z levels and profile each contour with a ball-nose tool (center offset by the radius).

source

4- and 5-axis

Rotating the workpiece (or the head) lets a tool reach faces a 3-axis machine cannot. These build on the same tool path model with extra orientation:

Rasmah.indexed_3plus2Function

Indexed 3+2: plan a 3-axis pocket for each of a set of part orientations (rotation matrices about the part origin), returning one toolpath per index.

source
Rasmah.swarf_millingFunction

Swarf milling along a ruled surface given by two guide curves top and bottom (same number of points). The tool side (a flat-end mill, axis tilted) rides the ruling between the curves, with the tool axis parallel to the ruling. Returns a ToolPath whose axis is carried in the motion metadata.

source
Rasmah.five_axis_finishFunction

Continuous 5-axis finishing: raster over the surface with a ball-nose tool oriented by lead/tilt angles (gouge/clearance control), returning the tool path and the per-cutting-move tool-axis directions.

source
Rasmah.tool_orientationFunction

Tool-axis orientation for continuous 5-axis finishing: start with the tool axis aligned to the surface normal normal, then tilt it by lead (in the feed direction, about cross(normal, feed_dir)) and by tilt (across the feed, about feed_dir). Returns a unit vector pointing from the tool tip toward the shank. With lead = tilt = 0 the axis is the surface normal.

source

Turning

On a lathe the workpiece spins and a single tool follows a [radius, z] profile. Turning follows the same idea — a profile in, a tool path out:

Rasmah.turning_roughingFunction

Roughing: remove the stock between the cylinder and the profile by horizontal strip passes at stepdown radius increments, then a finishing pass along the profile (plus finish_allowance).

source
Rasmah.turning_threadFunction

Cut a single-point thread of pitch over length, starting at axial z, by successive helical passes to depth.

source

Wire EDM and beam cutting

For sheet material or very hard parts, a wire or a beam cuts a contour:

Rasmah.wire_edmFunction

Cut a closed planar contour with a wire, at the given thickness (blank height). The wire follows the contour at successive depths is unnecessary for wire (a single pass); taper tilts the wire by the given angle per side, so the top and bottom contours differ by 2·thickness·tan(taper). Returns the top and bottom ToolPaths (XY plane).

source
Rasmah.laser_profileFunction

Cut a closed (or open) planar contour with a beam of width kerf. The beam center rides the contour inset by kerf/2 so the cut edge lands on the contour. Adds a pierce point and lead-in when pierce=true.

source
Rasmah.nest_rectanglesFunction

Pack rectangular parts onto a sheet using a bottom-left shelf packing: sort by height descending, place each part at the lowest y it fits at its current x, advancing x across the sheet width and wrapping to a new shelf. Returns the list of placed rectangles (x, y, w, h) and the sheet height used.

source

Next steps

The subtractive side ends with the tool path. The additive side — Additive manufacturing — reuses the same pipeline for 3D printing, and the post-processing and stock simulation live with them. To see how the whole pipeline ends in controller code, continue there.