RasmahRasmah

Manufacturing

Overview

Rasmah is not only a design tool — it can also make the part. The manufacturing side of Rasmah turns a shape (a BRep, a triangle mesh, or an SDF) into the instructions a machine follows: a CNC mill's tool path, a lathe's turning cycle, a laser's cut, or a 3D printer's G-code.

The pipeline has three stages, each a clean step in the chain design → tool path → controller code:

  1. a tool path — the neutral, machine-independent list of cutter motions;
  2. a post-processor — which renders that list into a specific controller's G-code dialect;
  3. a simulator — which sweeps the tool through stock to verify the result, detect collisions, and measure removed material.

This chapter introduces the two ideas everything else builds on: the cutter-location data model (a tool path and its motions) and the cutter (the geometry of the tool itself).

The tool path: an ordered list of motions

A ToolPath is an ordered sequence of Motions, each carrying the tip position the tool must reach (plus a centre, an axis, and a direction for circular moves). It is the single neutral representation that every strategy produces and every consumer reads:

Rasmah.ToolPathType

A contiguous tool path: a tool, a sequence of motions, and the cutting parameters (cutting feed, plunge feed, spindle speed). Parametric on the concrete cutter type so tp.tool is concretely typed.

source
Rasmah.MotionType
Motion

Abstract supertype of tool-path motions: an ordered step of a ToolPath, each carrying a tool-tip target position (plus centre/axis/direction for arcs and helixes).

source
Rasmah.ArcMoveType

Circular cutting move (G2/G3): from the previous point to target along a circular arc centered at center, rotating about the unit axis axis (ccw=true is counter-clockwise viewed from +axis).

source
Rasmah.HelicalMoveType

Helical cutting move: an ArcMove in the plane orthogonal to axis while the tool simultaneously travels linearly along axis from its previous height to target (thread milling, helical ramping).

source

The four motion kinds map directly onto the G-code the machines understand: a rapid G0 positioning move, a linear G1 cut, a circular G2/G3 arc, and a helical move (an arc combined with axial travel, used for thread milling and helical ramping). Motions are appended with small helpers:

Rasmah.rapid_toFunction
rapid_to(p::AbstractVector) -> RapidMove

Build a rapid positioning move to the target point p.

source
Rasmah.cut_toFunction
cut_to(p::AbstractVector) -> LinearMove

Build a linear cutting move to the target point p.

source
Rasmah.arc_toFunction
arc_to(target, center, axis, ccw::Bool) -> ArcMove

Build a circular cutting move to target along the arc centred at center about the axis axis (ccw=true counter-clockwise viewed from +axis).

source
Rasmah.push_rapid!Function
push_rapid!(tp::ToolPath, p)

Append a rapid positioning move to p onto the tool path tp.

source
Rasmah.push_cut!Function
push_cut!(tp::ToolPath, p)

Append a linear cutting move to p onto the tool path tp.

source
Rasmah.push_arc!Function
push_arc!(tp::ToolPath, target, center, axis, ccw)

Append a circular cutting move (an ArcMove) onto the tool path tp.

source

Once built, a tool path can answer the questions a machinist asks — how long is it, how long will it take, where does it go:

Rasmah.motion_lengthFunction
motion_length(m::Motion, p0) -> Real

Length of the motion m starting from the previous position p0 (arcs use the in-plane angle, helical moves add the axial displacement).

source
Rasmah.toolpath_timeFunction

Estimated cutting time in seconds (cutting + plunging at their feeds, rapids at a fixed rapid_rate).

source
Rasmah.toolpath_pointsFunction
toolpath_points(tp::ToolPath; arc_samples::Int=24) -> Vector{Vector{Float64}}

Expand a ToolPath into a dense sequence of tool-tip positions: rapid moves reset the position without being swept, arcs/helixes are tessellated, and linear moves contribute their endpoints.

Keyword arguments

  • arc_samples: tessellation resolution for arc moves.
source
tool = EndMill(6e-3)
tp = ToolPath(tool; feedrate=0.05, spindle=12000)
push_rapid!(tp, [0.0, 0.0, 5e-3])
push_cut!(tp, [0.0, 0.0, 0.0])
push_cut!(tp, [10e-3, 0.0, 0.0])
push_cut!(tp, [10e-3, 10e-3, 0.0])
num_motions(tp)
4
toolpath_length(tp)
0.025 m

Here the tool plunges 5 mm, then cuts two 10 mm legs, for a total cut of 25 mmtoolpath_length reports it as 0.025 m because all lengths are stored in SI and rendered in the active unit system.

Cutters: the tool's shape

A cutter is described by its cutting geometry only — no material or feed data (those live on the ToolPath). The workhorse is the swept-volume signed field, which says whether a point is inside the tool when its tip is at a given position; that field powers collision checking and stock simulation:

Rasmah.CutterType
Cutter

Abstract supertype of milling-tool cutting geometries (EndMill, BallEndMill, BullNoseMill, Drill). A cutter is described by its cutting geometry only; its swept-volume field is given by tool_sdf.

source
Rasmah.EndMillType

A flat-end mill: a cylinder of cutting diameter diameter, cutting along flute_length.

source
Rasmah.DrillType

A twist drill: a cylinder plus a conical point of included angle tip_angle (e.g. 118°).

source
Rasmah.tool_sdfFunction
tool_sdf(t::Cutter, p::AbstractVector) -> ImplicitGeometry

The swept-volume signed field of cutter t (negative inside) whose tip — the lowest cutting point — sits at p, with the tool axis along +z. Returns an ImplicitGeometry with finite bounds.

source
Rasmah.tool_boundsFunction
tool_bounds(t::Cutter, p::AbstractVector) -> (lo, hi)

The bounding box of the swept-volume field of cutter t at tip position p.

source
tool_diameter(EndMill(6e-3))
0.006
bounds(tool_sdf(BallEndMill(6e-3), [0.0, 0.0, 0.0]))
([-0.003, -0.003, 0.0], [0.003, 0.003, 0.006])

A ball-nose mill of diameter 6 mm at the origin has a swept volume spanning x, y ∈ [-3, 3] mm and z ∈ [0, 3] mm — a cylinder of radius 3 mm capped by a hemisphere of the same radius at the tip.

Next steps

With the tool path and the cutter in hand, the two machining families are the natural follow-ons: Milling for subtractive machining (pocketing, profiling, surfacing, turning), and Additive manufacturing for 3D-printing (slicing, perimeters, infill, and print G-code).