Resources Numerical accuracy Calculation policy

Machining picks and readouts

Decides which faces and edges a machining operation accepts, matches stored picks to the part, and formats the numbers shown in the Manufacture panel.

How the precision is kept

The checks here are single 64-bit comparisons with fixed tolerances. Toolpaths, cycle time and stock results are computed in the cam modules and only shown here; the stock and toolpath buffers this file builds are 32-bit and only feed the screen.

Calculations under this policy

3 calculations in 1 source file. The code is read from the released app when this page loads. It is the calculation people run, not a copy kept for this page.

ws-manufacture.js PartCraft 0.8.1 64-bit 3 calculations Reviewed

Tests tools/partcraft-test/test-cam-post.mjs

Is a face square to the tool axis

64-bit

Decides whether a picked flat or round face can be machined from the setup's tool axis.

accepted when ||n·axis| − 1| ≤ 10⁻⁹

One dot product of the face's normal (or a cylinder's axis) with the tool axis, compared with 1 at an absolute tolerance of 1e-9; both are expected to be unit vectors. For a pocket the sign of the dot product also decides whether the face looks away from the tool.

  • ws-manufacture.js
  • lines 225 to 233
  • PartCraft 0.8.1
const dot = (a) => a[0] * ax[0] + a[1] * ax[1] + a[2] * ax[2];
if (f.type === 'plane') {
  if (op.type === 'drill') return { why: t('mfg.why.drill_axis') };
  if (Math.abs(Math.abs(dot(f.n)) - 1) > 1e-9) return { why: t('mfg.why.flat_not_square') };
  if ((op.type === 'pocket' || op.type === 'adaptive') && dot(f.n) < 0) return { why: t('mfg.why.looks_away') };
  return { face: hit.face };
}
if (f.type === 'cylinder') {
  if (Math.abs(Math.abs(dot(f.axis.d)) - 1) > 1e-9) return { why: t('mfg.why.round_not_axis') };

Matching a pick to one already stored

64-bit

Decides whether a clicked face is already in the operation's geometry, to add or remove it.

same when names agree and |at − ref| < 10⁻³

The distance between the two reference points is Math.hypot of three differences, compared with an absolute 1e-3 in model units, whatever the part's size.

  • ws-manufacture.js
  • lines 247 to 248
  • PartCraft 0.8.1
const ref = faceRef(rg.faces[p.face]);
const k = o.geo.faces.findIndex((f) => f.name === ref.name && Math.hypot(f.at[0] - ref.at[0], f.at[1] - ref.at[1], f.at[2] - ref.at[2]) < 1e-3);

Numbers shown in the panel

64-bit

Formats stock sizes, feeds, gouge depth and remaining stock for the panel.

text = value rounded to dp decimals (3 by default), trailing zeros dropped

toFixed rounds the text only and the function returns a string; a value that is not finite gives an empty string.

  • ws-manufacture.js
  • line 29
  • PartCraft 0.8.1
const fmt = (v, dp = 3) => (Number.isFinite(v) ? String(+Number(v).toFixed(dp)) : '');

In detail

Method
A flat face is accepted when its normal is along the tool axis, a round face when its axis is; stored picks are matched by name and position.
Number types
64-bit numbers for the checks; Float32Array only for display buffers.
Tolerances
Alignment with the tool axis: ||n·axis| − 1| ≤ 1e-9 on unit vectors. A stored face or edge pick matches when the names agree and the reference points are within 1e-3 mm (absolute). Panel numbers are shown with up to three decimals.

Approach: 64-bit, direct

Every value is a 64-bit number from input to result. Formulas are closed form or a direct solve, and every comparison uses a stated tolerance.

Every policy that takes this approach