Algorithm Search⌘K

Problemcore

NC verification

Also called machining simulation, NC simulation.

Simulate a toolpath by subtracting the tool's swept volume from the stock, to show the final part and find gouges, collisions and missed material.

NC verification checks a toolpath before it runs on a machine. It simulates the cut: starting from the stock, it removes the volume that the tool sweeps on each move, and then compares the result with the designed part. The comparison finds gouges, where the tool removed material of the part, excess, where material that should go is still there, and collisions, where the holder, the shank or a rapid move hits material. The simulated workpiece is also shown to the user. The task is stated here as a problem. The models that make it fast are on their own pages: the z-map stores one height per grid point, and the dexel representation stores intervals along rays. Exact simulation with solid Boolean operations on a boundary representation is possible but slow, so most systems use such sampled models. This is verification of a machining program in mechanical manufacturing, not the verification of a circuit design.

In plain words

A program for a milling machine is a long list of tool moves, made by a CAM system. Before running it on a costly block of metal, you want to see what it will cut.

The simulation starts with the block. For each move, it removes everything the tool passes through. At the end it holds the shape the machine would make, and you can look at it.

Then it compares that shape with the design. Places where the shape is below the design are gouges. Places above it are material left behind. A move where the holder or a fast move runs into material is a crash.

Most simulators do not keep the exact shape. They sample it on a grid of points or rays, which is fast and simple but only as precise as the grid.

Definition

Input.

  • The stock W0W_0, a solid, usually a box.
  • The tool: the cutting part TT, and the non-cutting parts HH (shank, holder), placed by a CL point (c,a)(c, a) as T(c,a)T(c, a) and H(c,a)H(c, a).
  • The toolpath: CL points (c0,a0),…,(cm,am)(c_0, a_0), \dots, (c_m, a_m), and for each move kk its kind (cutting or rapid). Let SkS_k be the swept volume of TT over move kk, and SkHS^H_k that of HH.
  • The design part P⊆W0P \subseteq W_0 and a tolerance ε≥0\varepsilon \ge 0.

Output.

  1. The workpiece after each move, Wk=Wk−1−∗SkW_k = W_{k-1} -^* S_k, where −∗-^* is the regularized difference. The final part is WmW_m.
  2. Gouges: the points of PP removed, P−∗WmP -^* W_m, reported where their depth below the design surface exceeds ε\varepsilon, with the move that made each one.
  3. Excess: the material left, Wm−∗PW_m -^* P, reported where it is thicker than ε\varepsilon.
  4. Collisions: the moves kk where int⁡SkH∩int⁡Wk−1≠∅\operatorname{int} S^H_k \cap \operatorname{int} W_{k-1} \ne \emptyset, and the rapid moves where int⁡Sk∩int⁡Wk−1≠∅\operatorname{int} S_k \cap \operatorname{int} W_{k-1} \ne \emptyset.

Item 4 depends on the order of the moves, since it uses Wk−1W_{k-1}. Items 1 to 3 at the end depend only on the set of moves, since Wm=W0−∗⋃kSkW_m = W_0 -^* \bigcup_k S_k.

Sampled versions. A sampled model replaces the solids by their traces on a set of sample lines. On a vertical line ℓ\ell, Wk∩ℓW_k \cap \ell is a finite union of intervals. The z-map keeps only the top of the material on each vertical line, which is exact when the tool always comes from above (three axes, no undercut). The dexel model keeps all the intervals. The output is then exact on the sample lines, and says nothing between them.

Variants

  • Exact solid simulation. Represent WkW_k as a boundary representation and subtract each SkS_k with a solid Boolean operation. It needs the swept volume as a solid, and the model grows with each move. It is used for short programs or for a final check.
  • Height grids. The z-map (Anderson 1978) for three-axis paths. Each move updates the grid points under its footprint.
  • Ray intervals. The dexel representation, in screen space for display (Van Hook 1986) or in object space, and three orthogonal dexel grids for parts with steep walls.
  • Vectors normal to the surface. Jerard et al. (1989) put short vectors on the design surface along its normals, and each move cuts the vectors it meets. The remaining length of a vector is the local excess, and a vector cut below the surface marks a gouge.
  • Voxels and octrees. A spatial occupancy enumeration or an octree of the stock, with each move removing the cells inside its swept volume.
  • Five axes. The tool axis changes during a move, so the swept volume is no longer a translation sweep, and the dexel and voxel models are used.

Examples

One move on a z-map. Take the stock as heights 44 over a grid of spacing 11, the design part z≤0z \le 0, and one move of a ball end mill with a shank, radius r=2r = 2, ball center from (1,1,3)(1, 1, 3) to (5,1,1)(5, 1, 1). On the line y=1y = 1, the lowest point of the swept tool above each grid point xx is computed on the z-map page:

xx 0 1 2 3 4 5 6 7 8
height after the move 1.268 0.764 0.264 -0.236 -0.736 -1 -0.732 1 4
result excess excess excess gouge gouge gouge gouge excess excess

The exact values are 3−33 - \sqrt 3, 3−53 - \sqrt 5, 2.5−52.5 - \sqrt 5, 2−52 - \sqrt 5, 1.5−51.5 - \sqrt 5, −1-1, 1−31 - \sqrt 3 and 11. The move goes down to z=1z = 1 for the ball center, and the bottom of the ball reaches z=−1z = -1, below the design. With ε=0.25\varepsilon = 0.25 the report is a gouge at x=4,5,6x = 4, 5, 6 of depth up to 11, and x=3x = 3 is within the tolerance. Between grid points the model knows nothing: the gouge also exists at x=3.5x = 3.5, but a grid of spacing 22 would only see it at x=4x = 4 and x=6x = 6.

A collision. On the same block, a rapid move of the same tool with ball center from (0,4,3)(0, 4, 3) to (8,4,3)(8, 4, 3) runs 3>r3 > r away from the first cut, where the stock top is still at 44. The ball bottom is at 11, so the move crosses material, and the simulation reports a crash at the first grid point under it.

Known algorithms

  • Z-map model. One height per grid point. A move of a ball end mill updates each grid point under it in O(1)O(1) time by a closed form. Exact on the grid, for three axes.
  • Dexel representation. Interval lists on rays, with Boolean operations by a merge in time linear in the number of intervals. Handles undercuts and many tools.
  • Exact Boolean operations. Solid Boolean operations on B-reps or CSG trees, with the swept volume of each move as an operand.
  • Normal vectors. The method of Jerard et al. (1989), which measures the error directly along the design normals.
  • Gouge detection. Checks the CL data against the part without simulating the stock. It finds gouges but not excess material.

What is proved: the sampled models give the exact trace of WmW_m on their sample lines, up to the rounding of the square roots in the tool formulas. What is measured: the error between the samples and the running time, which depend on the grid spacing, the part and the path. Drysdale et al. (1989) analyse how the cost and the accuracy of point-sample simulation depend on the spacing.

Bounds

  • Grid models. With NN sample lines, mm moves and NkN_k lines under the footprint of move kk, a z-map simulation takes O(N+∑kNk)O(N + \sum_k N_k) time and O(N)O(N) space. A dexel simulation multiplies each update by the number of intervals on the line.
  • Exact models. The B-rep of WkW_k gains faces with each move that cuts, so its size can grow with kk, and each Boolean operation costs more than the one before.
  • Sampling error. On a grid of spacing hh, a gouge narrower than hh in both directions can fall between the samples. So a sampled check cannot prove that a path is free of gouges. A finer grid, or a direct gouge detection on the surface, is needed for that.
  • No hardness. Every version is a polynomial simulation. The cost question is how many samples or faces it needs.

Reductions

  • To swept volumes and Boolean operations. Wm=W0−∗⋃kSkW_m = W_0 -^* \bigcup_k S_k, so exact verification is the computation of swept volumes followed by regularized set operations.
  • To one dimension. On a sampled model the problem splits into independent problems on the lines: subtract one interval per move and line, and compare the result with the interval of PP on the line.

Applications

  • Checking CAM programs for dies, molds and aerospace parts before the first cut.
  • Showing the machined part to the programmer, with the errors in color.
  • Estimating the removed volume per move, which gives the cutting load and lets a CAM system change the feed rate.
  • Checking the output of the post-processor, by simulating the machine code instead of the CL data.

References

  1. Robert O. Anderson, Detecting and eliminating collisions in NC machining, Computer-Aided Design 10(4), 1978, 231 to 237, the stock and the tool as heights over a grid, and the collision test on it
  2. Tim Van Hook, Real-time shaded NC milling display, Computer Graphics 20(4) (SIGGRAPH 86), 1986, 15 to 20, the subtraction of the tool in image space on depth intervals per pixel
  3. Robert B. Jerard, Robert L. Drysdale, Kenneth Hauck, Barry Schaudt and John Magewick, Methods for detecting errors in numerically controlled machining of sculptured surfaces, IEEE Computer Graphics and Applications 9(1), 1989, 26 to 39, simulation on vectors along the surface normals and on height grids, and the gouges and excess material each one finds
  4. Robert L. Drysdale, Robert B. Jerard, Barry Schaudt and Ken Hauck, Discrete simulation of NC machining, Algorithmica 4(1), 1989, 33 to 60, the cost and the accuracy of point-sample simulation as a function of the grid spacing
  5. Byoung K. Choi and Robert B. Jerard, Sculptured Surface Machining, Theory and Applications, Kluwer, 1998, the part on controlling accuracy and quality, on the z-map model and NC verification

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a known algorithm
  • a contract.yaml