Resources Numerical accuracy
Calculations
Every calculation under our calculation policies: what it works out, its formula and the precision it runs at. Open one to see its code as it is in the released app.
Calculations
-
Developed length and bend lines
The total flat length of a bent profile and where each bend line lies on the flat.
length = Σ straights + Σ BA; bend line at x + BA ÷ 2; angle° = θ × 180 ÷ π
Sheet metal bends and flat pattern sheetmetal.js64-bit- PartCraft
-
Joining straight segments
Joins two straight segments of the flat outline that continue each other through a point no third segment touches.
collinear when |d₁ × d₂| ≤ 1e-9 × |d₁| × |d₂| and d₁ · d₂ > 0
Sheet metal bends and flat pattern sheet-flat.js64-bit- PartCraft
-
Points along an arc for the extent
Sampled points on an arc or circle of the flat, used to find its box.
point = c + r × (cos a, sin a), a = (a₀ + sweep × k ÷ n) × π ÷ 180
Sheet metal bends and flat pattern sheet-flat.js64-bit- PartCraft
-
Flat of a bent base
The developed rectangle of an open bent profile: flat length by depth, with its bend lines and area.
box = L × D; area = L × D
Sheet metal bends and flat pattern sheet-flat.js64-bit- PartCraft
-
Faces that lie on the plate's plane
Decides which flat faces of the body belong to the plate, by distance from the sketch plane and by direction.
size = max(1, largest distance of a face centroid from the origin); tol = 1e-6 × size; on the plane when |n · (c − o)| ≤ tol and | |n_face · n| − 1 | ≤ 1e-9
Sheet metal bends and flat pattern sheet-flat.js64-bit- PartCraft
-
Unfolding a flange
Turns a flange's leg back into the plate's plane and adds the bend strip between the plate and the leg.
leg: rotate by −θ about the bend axis through C, then move by BA along u; strip: S₀, S₀ + e·run, + u·BA; bend line at S₀ + u × BA ÷ 2
Sheet metal bends and flat pattern sheet-flat.js64-bit- PartCraft
-
Outline edges as lines, arcs and circles
Reads each edge of the fused flat as a 2-D line, arc, circle or sampled curve in the sketch plane.
2-D point = ((p − o) · x, (p − o) · y); arc angles = atan2(Δy, Δx) × 180 ÷ π, brought to [0, 360)
Sheet metal bends and flat pattern sheet-flat.js64-bit- PartCraft
-
Box and area of the flat pattern
The overall size of the flat pattern and its area.
box = min and max over line ends, sampled curve points and 65 points per arc; area = surface area of the fused flat
Sheet metal bends and flat pattern sheet-flat.js64-bit- PartCraft
-
Roots of a function along a span
Finds the parameters where a signed distance along the spline is zero.
sample n steps; bisect each sign change until b − a ≤ 1e-16 × max(1, |a|)
Sketch intersections with splines sketch-intersect.js64-bit- PartCraft
-
Spline against a line or circle
Collects the spline parameters where it crosses a line or a circle, span by span.
24 samples per knot span of F(S(u)); line: F = signed distance; circle: F = |S − c| − r
Sketch intersections with splines sketch-intersect.js64-bit- PartCraft
-
Spline against spline
The parameter pairs at which two splines cross.
Newton: [S₁′(u) −S₂′(v)] · (Δu, Δv) = −(S₁(u) − S₂(v))
Sketch intersections with splines sketch-intersect.js64-bit- PartCraft
-
Polyline within a chord tolerance
Points along a spline such that every chord stays within a tolerance of the curve.
split a piece while the curve at ¼, ½ or ¾ of it is farther than tol from its chord
Sketch splines: length, nearest point, polyline and offset sketch-spline.js64-bit- PartCraft
-
Length of a spline
The arc length of a spline.
L = Σ over 8 pieces per span of Σ wᵢ × h × |C′(uᵢ)| (5-point Gauss–Legendre)
Sketch splines: length, nearest point, polyline and offset sketch-spline.js64-bit- PartCraft
-
Nearest point on a spline
The parameter of the point on a spline nearest a given point.
start at the nearest of 13 samples per span; Newton: u ← u − ((C − p) · C′) ÷ (C′ · C′ + (C − p) · C″)
Sketch splines: length, nearest point, polyline and offset sketch-spline.js64-bit- PartCraft
-
Offset of a spline
A new fit spline that follows a spline at a fixed distance, with the largest gap found.
true offset point = C(u) + d × n(u); err = max over 40 points per span of the distance to the fitted curve; accept when err ≤ tol
Sketch splines: length, nearest point, polyline and offset sketch-spline.js64-bit- PartCraft
-
Points along an arc
An arc as a run of points from its start to its end.
n = max(1, ⌈sweep ÷ 2π × segFull − 1e-9⌉); pointᵢ = c + r × (cos(a₀ + sweep·i ÷ n), sin(…))
Sketch profiles as closed polygons sketch.js64-bit- PartCraft
-
Points around a circle
A circle as a closed polygon with its corners on the circle.
pointᵢ = c + r × (cos(2π·i ÷ n), sin(2π·i ÷ n))
Sketch profiles as closed polygons sketch.js64-bit- PartCraft
-
Closed loops of a sketch
Chains the sketch's curves into closed loops, or reports an open end or a branch.
ends are one node when closer than 10 × tol, tol = 1e-6 × max(1, extent)
Sketch profiles as closed polygons sketch.js64-bit- PartCraft
-
Point inside loops
Tests whether a point lies inside a set of loops by the even-odd rule.
count edges with (a_y > p_y) ≠ (b_y > p_y) and p_x < (b_x − a_x)·(p_y − a_y) ÷ (b_y − a_y) + a_x
Sketch profiles as closed polygons sketch.js64-bit- PartCraft
-
Area of a loop
The signed area of a polygon loop.
area = ½ × Σ (xⱼ·yᵢ − xᵢ·yⱼ)
Sketch profiles as closed polygons sketch.js64-bit- PartCraft
-
Jacobian by central differences
The rate of change of every relation's residual with each variable it depends on.
∂f/∂x ≈ (f(x + h) − f(x − h)) ÷ 2h, h = 1e-6 × max(1, |x|)
Sketch solver solver.js64-bit- PartCraft
-
Cholesky solve
Solves the symmetric system of each Newton step.
A = L·Lᵀ; L·y = b; Lᵀ·z = y
Sketch solver solver.js64-bit- PartCraft
-
Damped Newton iteration
Repeats least-norm steps until every residual is within the tolerance.
dx = Jᵀ · (J·Jᵀ + μ·max(scale, 1e-12)·I)⁻¹ · (−r); x ← x + α·dx, α halved until Σr² falls
Sketch solver solver.js64-bit- PartCraft
-
Solving a sketch
Solves the sketch in place and classifies it as under, fully or over defined.
tol = 1e-9 × max(1, extent)
Sketch solver solver.js64-bit- PartCraft
-
Writing the solution back
Copies the solved variables to the sketch's points, radii and spline end angles.
angle ← atan2(sin a, cos a)
Sketch solver solver.js64-bit- PartCraft
-
Rank, redundancy and determined geometry
Counts the degrees of freedom left, names relations that repeat or conflict, and marks which entities are fully defined.
dof = variables − rank; row redundant when its remainder after projection is under 1e-7; variable determined when Σ q_k² > 1 − 1e-6
Sketch solver solver.js64-bit- PartCraft
-
Residual: an arc's two ends on one radius
The equation that keeps an arc's end point at the same distance from the center as its start point.
f = |e − c| − |s − c|
Sketch solver sketch.js64-bit- PartCraft
-
Residuals: parallel and perpendicular
The equations for two lines being parallel or square to each other.
parallel: (u × v) ÷ (|u|·|v|); perpendicular: (u · v) ÷ (|u|·|v|)
Sketch solver sketch.js64-bit- PartCraft
-
Residuals: tangent
The equations for a line touching a circle or arc, and for two circles or arcs touching.
shared end, line and arc: (u · (p − c)) ÷ (|u|·r); shared end, two arcs: ((p − a) × (p − b)) ÷ (rₐ·r_b); else: ±dist(c, line) − r, or d − (rₐ + r_b), or d − ±(rₐ − r_b)
Sketch solver sketch.js64-bit- PartCraft
-
Residuals: distance dimensions
The equations that hold a distance between two points, the length of a line, or the distance from a point or a line to a line.
f = |b − a| − value; f = sign × signed distance − value
Sketch solver sketch.js64-bit- PartCraft
-
Residual: angle dimension
The equation that holds the angle between two lines at a value in degrees.
f = atan2(u × v, u · v) − sign × value × π ÷ 180, wrapped to (−π, π]
Sketch solver sketch.js64-bit- PartCraft
-
Normal distribution tail
The probability that a standard normal value exceeds z, used for the share of assemblies outside a limit.
P(Z > z) = ½ × erfc(z ÷ √2); erfc(x) ≈ k × exp(−x² − 1.26551223 + k·(1.00002368 + …)), k = 1 ÷ (1 + ½|x|)
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Stack-up analysis
The gap's nominal and mean, its worst-case and statistical limits, each link's share and rank, and the check against the limits.
a = sign × sens; m = nominal + (up + lo) ÷ 2; t = (up − lo) ÷ 2; WC = Σ|a|·t; RSS = √Σ(a·t)²; σ = RSS ÷ 3; ppm = (P_below + P_above) × 10⁶
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Links from picked points
Makes the links of a chain from points picked in order, measured along one direction.
Δs = d · b − d · a; nominal = round(|Δs|, 9 decimals); sign = sign of Δs
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Rounding of measured nominals
Rounds a measured length or direction component before it is stored on a link.
round(v) = Math.round(v × 10⁹) ÷ 10⁹
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Vector stack projected on a direction
Turns a chain whose links run in different directions into a one-direction chain along an output direction, with each link's angular swing as an extra link.
sens = (u · d) × sens; swing: c = nominal × ((axis × u) · d); up, lo = c × angle° × π ÷ 180
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Vector stack analysis
The nominal gap as a vector and its length, and the analysis along each output direction and along the gap itself.
gap = Σ sign × nominal × u; |gap| = √(g_x² + g_y² + g_z²)
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Links from picked points in 3-D
Makes links that run straight from each picked point to the next.
nominal = round(|b − a|, 9 decimals); dir = round((b − a) ÷ |b − a|, 9 decimals)
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Tolerance from a feature control frame
How a geometric tolerance enters a stack: plus and minus half the tolerance zone.
up = tol ÷ 2; lo = −tol ÷ 2
Tolerance stack-ups stackup.js64-bit- PartCraft
-
General tolerance for a nominal size
The deviation a title block's general tolerance gives one nominal size: a class of ISO 2768-1, or a typed ± value.
class f, m, c or v: the table row for the first range with nominal ≤ upper end (0.5 to 4000 mm); typed: parseFloat of the number after ±
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Stack-up as CSV
Writes the links and the results of a stack-up to a CSV file.
every number written as +v.toFixed(4)
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Sizes of a template
One row of parameter values (mm) per size of a standard part family.
value = Number(value.toFixed(4))
Standard part templates stdparts.js64-bit- PartCraft
-
Hexagon across flats
Draws a hexagon from its across-flats size and holds that size with a dimension.
e = s × 2 ÷ √3; first corner at (e ÷ 2, 0)
Standard part templates stdparts.js64-bit- PartCraft
-
Circle of a given diameter
Draws a circle about the origin and holds its diameter with a dimension.
r = d ÷ 2
Standard part templates stdparts.js64-bit- PartCraft
-
Parallel key outline
The round-ended outline of a parallel key from its width and length.
half = (l − b) ÷ 2; center distance = l − b; end radius = b ÷ 2
Standard part templates stdparts.js64-bit- PartCraft
-
Patch through boundary edges
A surface that fills a closed loop of edges, optionally tangent to the faces next to it.
MakeFilling(3, 15, 2, false, 1e-5, 1e-4, 0.01, 0.1, 8, 9)
Surface features built with the kernel surface.js64-bit- PartCraft
-
Loft through wires
A surface or solid through a series of curves in order.
ThruSections(solid, ruled, 1e-6)
Surface features built with the kernel surface.js64-bit- PartCraft
-
Thickening a surface
Turns a surface body into a solid of a given thickness on one side or half on each side.
both sides: offset the sheet by −t ÷ 2, then thicken by t; in: thicken by −t
Surface features built with the kernel surface.js64-bit- PartCraft
-
Offsetting a surface
A new surface at a distance along the normals of an existing one.
MakeOffsetShape.PerformBySimple(sheet, d)
Surface features built with the kernel surface.js64-bit- PartCraft
-
Stitching surfaces
Sews surface bodies together along their edges, into a solid when they close.
edges closer than tol are joined; tol = 0.01 by default
Surface features built with the kernel surface.js64-bit- PartCraft
A calculation is added only after its source was read. Each statement can be checked in the code shown on its policy's page; the app repositories are public. When a release changes a calculation, its page says so until it has been read again.