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
-
Sheet points on the 2.5 mm grid
Moves a picked point on a sheet to the nearest point of the 2.5 mm grid.
x = round(x ÷ 2.5) × 2.5
Schematic wires, pins and connections addons/electrical/main.jsExact- CadCraft
-
A wire point landing on a pin or wire
Moves a picked wire point onto a pin, a wire end or a wire when it is within 2 units of one.
candidate when d² ≤ 2²; a wire's middle is ranked with d² + 0.25
Schematic wires, pins and connections addons/electrical/main.js64-bit- CadCraft
-
A wire cut under a new symbol
Cuts a wire between two pins of a symbol placed on it.
pin on the wire when d² < 1e-4 and 1e-6 < u < 1 − 1e-6
Schematic wires, pins and connections addons/electrical/main.js64-bit- CadCraft
-
PV one-line layout
Positions the symbols and wires of a solar one-line diagram from the column and row of each node.
x = x₀ + col × pitch x; y = y₀ − row × pitch y; wire bend at (sx + ex) ÷ 2
Schematic wires, pins and connections addons/electrical/lib/pvoneline.js64-bit- CadCraft
-
Transform of a schematic symbol
The matrix that takes a symbol's pin offsets to the drawing.
a = cos r × sx; b = sin r × sx; c = −sin r × sy; d = cos r × sy; e = x − (a bₓ + c b_y); f = y − (b bₓ + d b_y)
Wire harness and control cabinet layout addons/harness/lib/schem.js64-bit- CadCraft
-
Squared distance from a point to a wire segment
How far a wire end or pin is from a wire segment.
u = clamp((p − a)·(b − a) ÷ |b − a|², 0, 1); d² = |p − (a + u (b − a))|²
Wire harness and control cabinet layout addons/harness/lib/schem.js64-bit- CadCraft
-
Which wires and pins are connected
Joins wire ends to other ends, to pins and to wires they touch, to find the nets.
connected when distance² ≤ tol², tol = 0.05
Wire harness and control cabinet layout addons/harness/lib/schem.js64-bit- CadCraft
-
A point in a rail's frame
The distance along a rail and off its axis of a drawing point, in millimeters.
s = (Δx cos r + Δy sin r) ÷ k; off = (−Δx sin r + Δy cos r) ÷ k
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
A rail position back in the drawing
The drawing point at a distance along a rail.
x = x₀ + (s cos r − off sin r) × k; y = y₀ + (s sin r + off cos r) × k
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
Modules on a rail
Which modules sit on a rail, and the stretch of rail each covers.
s₀ = s − w ÷ 2; s₁ = s + w ÷ 2
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
Modules past the end or overlapping
Flags a module that hangs past the rail or overlaps the next one.
past when s₀ < −0.01 or s₁ > len + 0.01; overlap when next s₀ < s₁ − 0.01
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
Free length on a rail
The rail length not taken by modules.
free = max(0, len − Σ module widths)
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
Where a new module sits
The center of a new module on a rail: inside the rail, and flush to a neighbor when close.
c = clamp(s, w ÷ 2, len − w ÷ 2); c = neighbor edge ± w ÷ 2 when within 3 mm
Wire harness and control cabinet layout addons/harness/lib/cabinet.js64-bit- CadCraft
-
Drawing units per millimeter
The factor between the drawing and millimeters.
k = (1 ÷ per) × (1 ÷ 25.4 for inch rules)
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
A harness moved, turned or scaled
Applies a move, rotation or scale to a harness: its nodes and its scale.
k′ = k × √(m₀² + m₁²); node′ = M · node
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Module positions in millimeters
Each placed module's position for routing wires to it.
x mm = x ÷ k; y mm = y ÷ k
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Total length of a harness
The summed length of a harness's segments for the bill of materials.
mm = Σ segment length
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Wire count and bundle diameter per segment
The number of wires in each harness segment and the diameter of their bundle, kept on the harness.
od = round(bundleDiameter × 10) ÷ 10
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Rail length and angle from two points
The length in millimeters and the angle of a rail drawn between two points.
len = √(Δx² + Δy²) ÷ k; rot = atan2(Δy, Δx)
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Modules placed in a row
Places every remaining module along a rail, one after the other.
center = s + w ÷ 2; s ← s + w; stop when s + w > len + 1e-9
Wire harness and control cabinet layout addons/harness/main.js64-bit- CadCraft
-
Segment length and bundle labels
The length written beside each harness segment, and its wire count and diameter.
mm = typed length, or √(Δx² + Δy²) ÷ k; label = round(mm)
Wire harness and control cabinet layout addons/harness/lib/draw.js64-bit- CadCraft
-
Length of a position
The length of a pipe, truss or floor line along its points.
L = Σ √(Δx² + Δy²)
Stage lighting plot: positions, fixtures and loads addons/lighting/lib/model.js64-bit- CadCraft
-
Where a point is on a position
The distance along a position to the point nearest a fixture, and the fixture's distance from the line.
u = clamp((p − a)·(b − a) ÷ |b − a|², 0, 1); s = length before + u × |b − a|; off = |p − q|
Stage lighting plot: positions, fixtures and loads addons/lighting/lib/model.js64-bit- CadCraft
-
Position a fixture belongs to
The nearest named position within reach of a point.
nearest with off ≤ tol
Stage lighting plot: positions, fixtures and loads addons/lighting/lib/model.js64-bit- CadCraft
-
Fixture data checked
Checks a fixture's stored data: scale, wattage, DMX footprint and aim angle.
aim = ((aim mod 360) + 360) mod 360
Stage lighting plot: positions, fixtures and loads addons/lighting/lib/model.js64-bit- CadCraft
-
Wattage of a fixture
The watts of a fixture: its own value, or its type's typical value.
Stage lighting plot: positions, fixtures and loads addons/lighting/lib/model.js64-bit- CadCraft
-
Point at a distance along a position
The drawing point a given distance along a position's line.
u = clamp((s − run) ÷ l, 0, 1); p = a + (b − a) × u
Stage lighting plot: positions, fixtures and loads addons/lighting/main.js64-bit- CadCraft
-
Fixtures spread along a position
Places n fixtures evenly along a position.
sᵢ = L × (i + 0.5) ÷ n
Stage lighting plot: positions, fixtures and loads addons/lighting/main.js64-bit- CadCraft
-
A position moved, turned or scaled
Applies a move, rotation or scale to a position's points and its scale.
k′ = k × √(m₀² + m₁²); p′ = M · p
Stage lighting plot: positions, fixtures and loads addons/lighting/main.js64-bit- CadCraft
-
Fixture symbol turned to its aim
Rotates a fixture's symbol by its aim angle.
x′ = x cos a − y sin a; y′ = x sin a + y cos a
Stage lighting plot: positions, fixtures and loads addons/lighting/lib/draw.js64-bit- CadCraft
-
Position length in millimeters
The length of a position for the schedule and the capacity warning.
mm = length in drawing units ÷ k
Stage lighting plot: positions, fixtures and loads addons/lighting/lib/draw.js64-bit- CadCraft
-
Legend totals
The total number of fixtures and total watts at the foot of the legend.
total = Σ count; total watts = Σ watts
Stage lighting plot: positions, fixtures and loads addons/lighting/lib/draw.js64-bit- CadCraft
-
A drawing object as a nest loop
Turns a circle or closed polyline into a loop of points with bulges.
circle = (cx + r, cy) and (cx − r, cy), each with bulge 1
Nesting add-on: outlines in, placed copies out addons/nesting/lib/parts.js64-bit- CadCraft
-
Outline as chords for containment
Points along an outline, with each arc as 8 chords, used to test which outline contains which.
θ = 4 atan(b); r = c ÷ (2 sin(θ ÷ 2)); center = chord middle + normal × r cos(θ ÷ 2)
Nesting add-on: outlines in, placed copies out addons/nesting/lib/parts.js64-bit- CadCraft
-
Parts and their holes
Groups outlines into parts with holes and moves each part to its own corner.
parent = smallest larger outline containing the first point; shifted point = p − (x₀, y₀)
Nesting add-on: outlines in, placed copies out addons/nesting/lib/parts.js64-bit- CadCraft
-
A part's object placed on the sheet
Moves and turns one object of a part to where the engine placed it.
q = at + (x, y) + R(rot) · (p − origin)
Nesting add-on: outlines in, placed copies out addons/nesting/lib/parts.js64-bit- CadCraft
-
Sheet rectangles and labels
A rectangle for each sheet, side by side, and the part names over the copies.
xₖ₊₁ = xₖ + w + gap, gap = max(20, 0.1 × h) by default; label at the mean of the outline's points
Nesting add-on: outlines in, placed copies out addons/nesting/lib/parts.js64-bit- CadCraft
-
Size units per drawing unit
How many inches or millimeters one drawing unit is, from the drawing's unit setting.
factor = (meters per drawing unit) ÷ 0.0254 or ÷ 0.001
P&ID line geometry and connections addons/pid/lib/core.js64-bit- CadCraft
-
Length of a line
The length of a P&ID line along its corner points.
length = Σ √(Δxᵢ² + Δyᵢ²)
P&ID line geometry and connections addons/pid/lib/core.js64-bit- CadCraft
-
Nearest point on a line
The point of a line closest to a given point, its distance, and how far along the line it lies.
u = clamp((p − a)·(b − a) ÷ |b − a|², 0, 1); point = a + u (b − a)
P&ID line geometry and connections addons/pid/lib/core.js64-bit- CadCraft
-
Label position on the longest segment
The middle and direction of a line's longest segment, where its line number is written.
mid = (a + b) ÷ 2; angle = atan2(Δy, Δx)
P&ID line geometry and connections addons/pid/lib/core.js64-bit- CadCraft
-
Numbers in CSV exports
How a number cell is written when a P&ID list is exported as CSV.
P&ID line geometry and connections addons/pid/lib/core.js64-bit- CadCraft
-
Cleaning a line's points
Checks a line's data and removes repeated corner points before it is stored.
P&ID line geometry and connections addons/pid/lib/lines.js64-bit- CadCraft
-
Line ends and their directions
The two end points of a line and the direction in which the line leaves each.
a = atan2(end − neighbor)
P&ID line geometry and connections addons/pid/lib/lines.js64-bit- CadCraft
-
Move, rotate, scale or mirror a line
The line's points, symbol size and text height after a transform.
x′ = m₀x + m₂y + m₄; y′ = m₁x + m₃y + m₅; s = √|m₀m₃ − m₁m₂|
P&ID line geometry and connections addons/pid/lib/lines.js64-bit- CadCraft
-
Symbol connection points in the drawing
Turns a point of a symbol's own frame into drawing coordinates using the symbol's position, rotation and scale.
x′ = x₀ + (x·sx)·cos θ − (y·sy)·sin θ; y′ = y₀ + (x·sx)·sin θ + (y·sy)·cos θ
P&ID line geometry and connections addons/pid/lib/model.js64-bit- CadCraft
-
Connection tolerance
How close a line end must be to a connection point, a line end or a line for the two to count as joined.
tol = 0.04 × max(size a, size b, 1e-6); joined when √(Δx² + Δy²) ≤ tol
P&ID line geometry and connections addons/pid/lib/model.js64-bit- CadCraft
-
Candidate search grid
Limits which symbol connections and lines are tested against each line end.
cell = max(tol of the largest size, 1e-9); index = floor(v ÷ cell)
P&ID line geometry and connections addons/pid/lib/model.js64-bit- CadCraft
-
Line end on the body of another line
Decides whether a line end lands on another line between its ends, which makes it a branch.
u = clamp((p − a)·(b − a) ÷ |b − a|², 0, 1); hit when |p − (a + u (b − a))| ≤ tol
P&ID line geometry and connections addons/pid/lib/model.js64-bit- CadCraft
-
Connection points of a symbol
Where lines attach to a placed symbol, in the symbol's own frame.
x = x_unit × l; y = y_unit × l
P&ID line geometry and connections addons/pid/lib/symbols.js64-bit- CadCraft
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.