scanruler-mcp

v0.6.4
scanruler-mcp Checked 17 hours ago Published 21 days ago

Drive ScanRuler, the 3D-scan measuring tool, from an AI agent: a local MCP server that reaches the ScanRuler tab open in your browser.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

scanruler_status ScanRuler connection status

Whether a ScanRuler page is connected to this agent, which version and plugins it has, whether its tab is hidden (page.hidden), and — when none is — how the user connects one. session, with a page, says what it holds: the scan, the project’s name, whether it has changes not saved (unsaved), and its work counted — elements, features, notes … — so a session someone else left is seen before it is replaced (scan_open with saveTo keeps it). page.since: when the page loaded. page.stale, when there: the page could not load a part of the app (an answer said stale_page) — it is older than…

scanruler_open Open ScanRuler

Open ScanRuler in the user’s default browser, paired with this server, and wait for the page to connect — for when scanruler_status says none is. The first time, ScanRuler warns the user that what you read goes to you and your model, and connects only once they accept; then the browser asks whether the site may reach apps on this computer, and they must allow it. Returns the status, with opened: whether the browser was asked to open it. If connected is still false, tell the user what howToConnect says.

scanruler_wait Wait for ScanRuler

Wait until a ScanRuler page is connected (for: "page", the default), or until it is also done with what it is busy with and every change still running has finished (for: "idle" — then finished lists the changes done or failed since the last such answer, a failed one with its error, and state says idle or running; running, with busy — what the page is at, in its words: a model's build names the step in play and how long it has run — and running, the change still running, with runningS), or until a job is done (for: "job" with job — a call started with wait: false, one answered queued, o…

ParameterTypeDescription
forstringpage (the default), idle, or job.
jobstringThe job to wait for, with for: "job" — as a call with wait: false, a queued answer or scanruler_status gave it.
timeoutSecondsnumberHow long to wait at most, seconds — 120 by default, and never past 45.

scanruler_write Write a text file beside the scan

Write a text file — a report, notes, a table of readings — next to the scan, as UTF-8: .md, .txt, .csv, .json only, and only inside the folder this server last opened a scan or a project from (scan_open, project_load) or saved one into (saveTo), or a folder under it. A relative path is taken in that folder; an absolute one must lie in one of those folders, and a path may not climb out with "..". Hidden folders and files, and files agents and tools take instructions or settings from (CLAUDE.md, AGENTS.md, package.json and the like), are refused: pick another name. A file already there is re…

ParameterTypeDescription
path *stringThe file: a name in the scan’s folder ("report.md"), a path under it ("report/sigma.md"), or an absolute path in it — .md, .txt, .csv, .json.
text *stringWhat the file holds, as text.

scanruler_files List the files beside the scan

The files in the folder this server last opened a scan or a project from, or saved one into — kept when the server restarts — or in a folder under it (path): each file's name, size in bytes and kind (mesh, project, step, picture, drawing, text or other), newest first, and the folders in it. Where scanruler_write's reports and the files saved beside the scan are; up to 300 entries. Refused while no scan or project has been opened from a folder.

ParameterTypeDescription
pathstringA folder under the scan’s folder, relative to it or absolute; or one of the folders scanruler_status lists. Leave out for the scan’s folder.

scanruler_read Read a text file beside the scan

A text file read part by part: .md, .txt, .csv, .json, .jsonl, in the folder this server last opened a scan or a project from, or saved one into, in a folder under it, or in one of the folders scanruler_status lists — or an answer too long to carry (truncated: true, file), wherever it was written. A relative path is taken in the first of those folders, and a path may not climb out with "..". Returns { text, offset, nextOffset, size }, in bytes of the file: nextOffset, when there, is where to read on from; without it the text reaches the file's end. An answer holds at most 40 k characters. Re…

ParameterTypeDescription
path *stringThe file: a name in the scan’s folder, a path under it ("scanruler-work/report.json"), or an absolute path.
limitintegerThe most bytes to read, a whole character at least; as many as an answer holds by default, and never more.
offsetintegerWhere to start, in bytes: the last answer’s nextOffset. The file’s start by default.

scanruler_batch Run several ScanRuler tools

Run several of the ScanRuler tools in one call, in order, each with its own arguments — a run of scan_nearest, element_fit or section_get calls, say. Returns results, one per call in order: { tool, ok, result } or { tool, ok: false, error: { code, message } }. The first refused stops the rest (stopped says which index, failed: { index, tool, error } which call) unless stopOnError is false. notes, when a call answered with the notes left for you, is the last call’s, repeated at the top. When the refused call is a change, then with rollback (the default) every change the batch made before it…

ParameterTypeDescription
buildstringeach (the default): a change rebuilds the part before it answers. end: the changes build once, at the last call.
callsarrayThe calls, in order — or give file instead.
filestringA JSON file of the calls, read here in place of calls: [{ tool, arguments }], or [{ name, input }] by the command's own name (scan.open), or either under "calls" or "steps". For a long run a script wr…
rollbackbooleanWhen the batch stops at a refused change, undo what it changed before it (the default) — or leave those changes standing (false). A refused read undoes nothing either way.
stopOnErrorbooleanStop at the first refused call (the default), or run every call and report each.
timingsbooleanEach call’s ms, the batch’s total_ms, and the steps a change’s build played with their ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

align_auto Auto-align the part

Read a coordinate system off the scan and apply it, as Auto-align then Confirm alignment do: the directions most faces are square to and the axis round walls run along, the part standing on its base, its long side along X. level: settled (the default) lays all the faces on the axes at once, by area; largest squares the largest flat face exactly and settles the rest about its normal. Returns what the pose was read from, the transform, how many elements moved, and square — how square it came out: largest (the largest flat face’s axis, area, tiltDeg) and per axis the faces square to it with t…

ParameterTypeDescription
detailstringbrief (the default): the transform and how many elements moved. full: every element where it now is.
levelstringsettled (the default): all faces at once, by area. largest: the largest flat face exactly, the rest settled about its normal.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

align_clear Reset the alignment

Put the part back in the coordinates the scanner delivered it in, with everything measured on it. Returns how many elements moved with it. One undo step.

ParameterTypeDescription
detailstringbrief (the default): the transform and how many elements moved. full: every element where it now is.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

align_datum Align the part to datums

A 3-2-1 alignment, as the panel’s alignment box sets it up: primary levels the part — a plane (or 3 points, or plane { origin, normal }: a level’s plane from scan.heightmap { levels: true }) whose outward normal becomes primaryAxis (default z-); secondary turns it — a line or axis (or 2 points) laid along secondaryAxis (default x+), or a plane; origin is the zero point — a point, sphere or circle (or 1 point). Elements by id or name, or points in mm used as given, not snapped. Trap: a plane as secondary puts its outward NORMAL on secondaryAxis, not its face along it. Each datum zeroe…

ParameterTypeDescription
detailstringbrief (the default): the transform and how many elements moved. full: every element where it now is.
keepFreebooleanFirst alignment: leave the coordinates nothing sets where they are instead of centring.
originThe zero point: an element, or a point on the scan.
primaryLevelling: an element, 3 points on the scan, or a plane { origin, normal }.
primaryAxisstringThe axis the primary’s outward normal becomes; default z-.
secondaryRotation: an element, or 2 points on the scan.
secondaryAxisstringThe axis the secondary runs along (a plane: its normal); default x+.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

align_symmetry Align the part on its symmetry plane

Settle the part’s pose on its mirror plane and apply it, as Use symmetry then Confirm alignment do: the pose is Auto-align’s, the mirror plane a measured symmetry plane or one searched for on the scan; the axis nearest its normal is turned onto it and the zero point put on it. Refuses when the scan has no symmetry plane. Returns the note on what it settled on, the transform and how many elements moved. One undo step.

ParameterTypeDescription
detailstringbrief (the default): the transform and how many elements moved. full: every element where it now is.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

deviation_align Best-fit the scan onto the reference

Rigid best fit (no scale) of the scan onto the reference part, then the deviation map under it. mode auto (the default) finds the pose on its own; points starts from three or more pairs of corresponding points (scan and reference, mm) then refines; local refines the fit in hand on a marked surface only (vertices), within searchDistance mm. Returns the alignment (RMS, points matched, transform) and the map’s statistics. One undo step.

ParameterTypeDescription
modestringauto (the default), points or local.
pairsarraypoints: the corresponding pairs.
searchDistancenumberlocal: how far a point may lie from the reference to count, mm.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
verticesarraylocal: the surface to refine on, scan vertex numbers.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

deviation_export Export the deviation as data

The deviation map as a file of readings, for working on it elsewhere: side "scan" (the default) a reading per scan vertex with its signed distance from the reference (or the element measured against), side "reference" a reading per sample on the reference; format ply (the default, binary), npy (N × 4 float32 x, y, z, d) or csv. Returns the file with readings, measured, withinTolerance, withinTolerancePct, tolerance and searchDistance. Trap: the distance is NaN where there is no reading, and a reading past the search distance is kept as it is — |d| ≤ searchDistance says it counts. Changes…

ParameterTypeDescription
formatstringply (the default), npy or csv.
pathstringWhere to write the file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a file of th…
sidestringThe readings: per scan vertex (the default), or per sample on the reference.

deviation_hotspots Where the deviation lies over tolerance

The deviation map read as patches: the vertices past the tolerance gathered into connected regions, the largest and farthest first — where the part is off, how large each place is and by how much. Needs a map (deviation.align or deviation.set_target). Returns each patch’s centroid, box, area, count, mean, extreme, depth, volume, kind ("feature": material missing or misplaced, to model or name; "texture": roughness), side, the extreme’s point and vertex, a few vertices, and onReference; features, found, over and unmeasured; on: "reference" reads the map on the reference, adding noScan. Tr…

ParameterTypeDescription
grainnumbermm two vertices over tolerance may lie apart and be one patch; three point spacings by default.
onstringThe map read: on the scan (the default) or on the reference.
patchesintegerHow many patches to name; 8 by default, 50 at most.
tolerancenumber± mm; the map’s tolerance by default.

deviation_measure Measure the deviation map

Measure the deviation map again under the alignment in hand — after a change of facing limit or search distance, say. deviation.align measures it already. Returns the map’s statistics (min, max, mean, RMS, sigma, share within the tolerance, points matched). One undo step.

ParameterTypeDescription
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

deviation_open_reference Open the reference part

Open the nominal part the scan is compared with — STEP from CAD, or STL, PLY, OBJ or 3MF — in place of the one there is; any alignment and map against the old one go, the elements measured on the scan stay. Returns the deviation state. Not undoable: a new reference starts a new history. The file is read from `path` on this computer and streamed to the page.

ParameterTypeDescription
path *stringThe file to read, on this computer: an absolute path, or a relative one. A relative path is taken from the folder of the scan or project last opened or saved (scanruler_status: server.relativeTo) —…
namestringThe file's name with its extension — "bracket.step". Defaults to the file's own name.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
unitsstringThe file’s units: mm (the default), cm, m or in. Everything is measured in mm once read.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

deviation_set_target Measure against an element

Map how far the scan strays from one of its own fitted elements — a plane, cylinder, cone, sphere or torus — instead of from a reference part; null goes back to the reference. side is the material side, read off the scan when the element is chosen (outward: the element’s outer side; inward: a bore or shell) — give it to override. facingDeg limits which surface counts to what faces the element within that many degrees, null for any. Needs the viewport. Returns the map’s statistics. One undo step.

ParameterTypeDescription
element *The element, or null.
facingDegThe facing limit, degrees, or null for any.
sidestringThe material side; read off the scan by default.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

deviation_settings Set how the deviation is read

The deviation map’s reading: range (colour scale, ± mm), maxDistance (search distance, mm), bands, tolerance (± mm the statistics count within), facingDeg (a change measures the map again), colormap (the person’s own choice, kept outside the undo — read settings.colormap for the ramp before judging a picture), on (which surface a map against the reference is painted on; read both sides) and show (the map switch; false leaves the surface bare, the map still measured). Returns the deviation state. Trap: the map paints in the Deviation workspace only — workspace.set deviation brings it…

ParameterTypeDescription
bandsStepped colours, or null for smooth.
colormapstringjet (blue inside, green on the surface, red outside) or a perceptual ramp.
facingDegFacing limit, degrees, or null.
maxDistancenumberSearch distance, mm.
onstringThe surface the map is painted on; scan by default.
rangenumberColour scale, ± mm.
showbooleanThe map painted (true) or the surface left bare (false).
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
tolerancenumberTolerance, ± mm.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

deviation_volume Volume error

The scan and the reference part compared as solids, on a grid of small cells: each cell inside one and not the other is an error, touching cells a region. Read it before the surface patches — it tells how much material is wrong and where, which the nearest-point map cannot: excess is material the reference has and the part has not, missing the other way round, unsure where the scan does not say (never an error). Needs deviation.align. Returns totals (mm³ and % of the reference) and the regions largest first, each with kind, volume, maxDepth, thickness, shape (layer or lump), centroid, deepe…

ParameterTypeDescription
cellnumberThe cell, mm; by default half the tolerance or a 250th of the reference’s longest side, the larger.
kindsarrayOnly regions of these kinds named; all by default. The totals are of all.
regionsintegerHow many regions to name; 8 by default, 50 at most.
tolerancenumber± mm; the map’s tolerance by default.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…
withinobjectOnly this box is looked at, in the reference’s frame.

dimension_add Add a dimension

Measure between elements, or a size or tolerance of one, as the panel’s dimension box does. refs are the elements by id or name, in slot order (a section counts as the plane it was cut on). Without type, the type follows the elements as clicking them does — two planes their distance, a plane and an axis theirs, and so on; with type, one of dist-point-point, dist-point-axis, dist-point-plane, dist-axis-axis, dist-axis-plane, dist-plane-plane, angle-axis-axis, angle-axis-plane, angle-plane-plane, size-diameter, form-flatness, form-cylindricity, form-circularity, form-sphericity, orient-paral…

ParameterTypeDescription
refs *arrayThe elements, in slot order.
anchorstringTwo spheres: centre to centre (the default), the gap between them, or the span across them.
basicnumberAn angularity’s basic angle, degrees.
limitWhat the value is checked against, for a pass or fail verdict.
namestringA name; otherwise numbered — "Distance 2".
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
typestringThe dimension type — see the description.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

dimension_remove Delete a dimension

Delete a dimension or tolerance. One undo step.

ParameterTypeDescription
dimension *The dimension.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

dimension_set_basic Set an angularity’s basic angle

The basic angle an angularity tolerance is read against, in degrees, or null to take it off. One undo step.

ParameterTypeDescription
basic *The basic angle.
dimension *The angularity.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

dimension_set_limit Set a dimension’s limit

Hold a dimension to a limit — a ceiling, or a nominal ± band — or take it off with null. Returns the dimension with its verdict. One undo step.

ParameterTypeDescription
dimension *The dimension.
limit *The limit, or null for none.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

element_construct Construct an element

Construct an element from others and typed-in numbers, as the panel’s creation methods do — point: point-coords, point-centroid, point-midpoint, point-line-plane, point-center (of a sphere, circle or torus), point-three-planes, point-line-line (params gap: the most two measured lines may pass apart and be taken to cross, 0.1 mm by default; skew past it is refused), point-project (a point onto a plane); line: line-two-points, line-axis (of a cylinder, cone, torus or circle), line-plane-plane, line-plane-point (square to a plane through a point), line-project (a line or axis onto a plane), l…

ParameterTypeDescription
kind *stringWhat to construct.
method *stringThe creation method — see the description.
assumednumberThe designed diameter, mm: drawn and exported at it, reported as measured.
namestringA name; else numbered by kind — "Sphere 2".
orientobjectAlign the direction to a plane, as designed; the measured fit is kept beside it.
paramsThe method’s typed-in numbers, mm.
refsarrayThe method’s source elements, slot by slot.
seedplane-symmetry: the plane the search starts from.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
verticesarraypoint-centroid, plane-symmetry: only these scan vertices.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

element_fit Fit an element

Fit an element on the scan where the panel would take a click: a plane, sphere, cylinder, cone or torus grows its surface from the place (or places) in at and is best-fitted to it; a point is the place itself; a circle goes through three or more places, or round an open rim (rim, numbered by scan.qa). A place is { vertex } or { point: [x, y, z] } (mm, current frame; the nearest vertex is taken). Trap: a seed near an edge can land on the wrong surface — say what is sought with side, radius, axis or within, and surfaces that do not match are passed over; that guide stays with the element, whic…

ParameterTypeDescription
kind *stringWhat to fit.
assumednumberThe designed diameter, mm: drawn and exported at it, reported as measured.
atWhere on the scan.
axisarrayCylinder, cone: the axis direction, roughly (within 20°).
extendobjectMm a cylinder or plane is drawn and exported past the measured surface.
knownDiameternumberSphere: a known diameter held, mm (a gauge ball); the centre alone is fitted.
markbooleanLeave the grown region marked for element.fit_marked.
namestringA name; else numbered by kind — "Sphere 2".
orientobjectAlign the direction to a plane, as designed; the measured fit is kept beside it.
radiusobjectSphere, cylinder, cone: the radius range sought.
rimintegerCircle: an open rim of the scan by its scan.qa number, in place of at.
sidestringSphere, cylinder, cone: inside (concave, a bore) or outside (convex, a shaft).
sigmaintegerOutlier cut-off, sigma: 3 (the default), 2, 1, or 0 for all points.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…
withinobjectThe surface stays inside this box.

element_fit_marked Fit an element to a marked surface

Fit a plane, sphere, cylinder, cone or torus to exactly the scan vertices given, with no search for the surface — vertices, or marked: true for the points the last element.fit { mark: true }, scan.segment { mark } or scan.query { mark: true } left marked, or box (with normal: only those facing a way) for every vertex inside it. The element keeps the marking as its recipe. Returns the element, and with box how many points it took. One undo step.

ParameterTypeDescription
kind *stringWhat to fit.
assumednumberThe designed diameter, mm: drawn and exported at it, reported as measured.
boxobjectThe scan inside a box, in place of vertices.
extendobjectMm a cylinder or plane is drawn and exported past the measured surface.
knownDiameternumberSphere: a known diameter held, mm (a gauge ball); the centre alone is fitted.
markedbooleanThe points left marked, in place of vertices.
namestringA name; else numbered by kind — "Sphere 2".
normalobjectWith box: only the vertices facing this way.
orientobjectAlign the direction to a plane, as designed; the measured fit is kept beside it.
sigmaintegerOutlier cut-off, sigma: 3 (the default), 2, 1, or 0 for all points.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
verticesarrayThe scan vertices of the surface.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

element_remove Delete an element

Delete an element — and with it every construction built on it and every dimension on any of them. Returns what went. One undo step.

ParameterTypeDescription
element *The element.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

element_rename Rename an element

Give an element another name; dimensions and constructions on it keep pointing at it. One undo step.

ParameterTypeDescription
element *The element.
name *stringIts new name.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

element_set_visible Show or hide elements

Show or hide one element, or all of them with all: true. A hidden element still measures; only its drawing and surface tint go. One undo step.

ParameterTypeDescription
visible *booleanShown (true) or hidden (false).
allbooleanEvery element.
elementThe element.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

export_cloud Export the scan as a point cloud

Every scan vertex with its normal, in the pose it is shown in, as a binary PLY (the default) or an XYZ text file. Needs the viewport. Returns the file’s bytes and the name the panel would save it under. The file is written to `path`; the result says where and how large it is, not its bytes.

ParameterTypeDescription
formatstringply or xyz.
pathstringWhere to write the file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a file of th…

export_csv Export the 2D measurements as CSV

The 2D Measure elements and dimensions as CSV, for a spreadsheet. Returns the file’s bytes and the name the panel would save it under. The file is written to `path`; the result says where and how large it is, not its bytes.

ParameterTypeDescription
pathstringWhere to write the file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a file of th…

export_dxf Export the 2D sheet as DXF

The 2D sheet as DXF for CAD — millimetres, y up, the origin on the sheet’s alignment, the edges thinned to a sketch’s worth. Needs the browser. Returns the file’s bytes and the name the panel would save it under. The file is written to `path`; the result says where and how large it is, not its bytes.

ParameterTypeDescription
pathstringWhere to write the file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a file of th…

export_step Export the elements as STEP

The measured elements as analytic STEP geometry for CAD — as drawn, extensions and assumed diameters included — and, in a group per section, what was measured on the sections. style: solids (the default: solids and faces) or surfaces (construction surfaces), remembered as the panel’s choice. Returns the file’s bytes and the name the panel would save it under. The file is written to `path`; the result says where and how large it is, not its bytes.

ParameterTypeDescription
pathstringWhere to write the file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a file of th…
stylestringsolids or surfaces.

export_stl Export the scan as a mesh

The scan as a binary STL — or, format 3mf, a 3MF in millimetres with the scan’s own colours — in the pose it is shown in, a datum alignment and a best fit onto the reference included. Needs the viewport. Returns the file’s bytes and the name the panel would save it under. The file is written to `path`; the result says where and how large it is, not its bytes.

ParameterTypeDescription
formatstringstl (the default) or 3mf.
pathstringWhere to write the file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a file of th…

export_svg Export the 2D sheet as SVG

The 2D sheet at true scale as SVG — the shown edges and the visible elements, aligned and turned as shown — for a vector editor, a laser or a 1:1 print. Needs the browser. Returns the file’s bytes and the name the panel would save it under. The file is written to `path`; the result says where and how large it is, not its bytes.

ParameterTypeDescription
pathstringWhere to write the file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a file of th…

flat_calibrate Calibrate the image

Set the image’s scale against a known length, as the Calibrate tool does: distance takes two places a known distance apart, diameter three or more on a circle of known diameter; mm is that length. Every measurement follows the new scale, and the edges are found again (their chain numbers change). Returns the calibration. One undo step.

ParameterTypeDescription
mm *numberThe true length, mm.
mode *stringdistance (two places) or diameter (three or more on a circle).
points *arrayThe places, in the sheet’s units as they are now.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

flat_detect_edges Detect the image’s edges

Find the edges in the image again at a sensitivity from 0 (only the strongest) to 1 (every faint one) — what the edge methods of flat.fit and the snapping of every place follow. The chains are numbered afresh. Needs the browser. Returns how many edge chains were found.

ParameterTypeDescription
sensitivitynumber0 to 1.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

flat_dimension_add Add a 2D dimension

Measure between two 2D elements: flat-dist-point-point (point, point), flat-dist-point-line (point, line), flat-dist-line-line (line, line), flat-angle-line-line (line, line). Points, circles and arcs count as their point (centre), lines as lines. Without type, the first that takes the two elements in the order given. Returns the dimensions on the sheet. One undo step.

ParameterTypeDescription
refs *arrayThe two elements.
namestringA name for it.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
typestringThe dimension type.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

flat_edges List the detected edges

The edge chains detected on the sheet, by number — what flat.fit takes as chains. Each with its length, whether it closes, its point count and box, in the sheet’s units; the longest first, or with near the nearest first (each with its nearest point and distance; within reach only, when given). box keeps the chains that enter it, minLength the long ones. tolerance adds each chain’s polyline thinned to that (5000 points at most over all). limit chains at most, 50 by default. Trap: the numbers change when the edges are found again. Changes nothing.

ParameterTypeDescription
boxobjectOnly chains with a point in this box.
limitintegerChains at most — 50 by default.
minLengthnumberOnly chains at least this long.
neararrayNearest this place first.
reachnumberWith near: only chains this close.
tolerancenumberAdd each chain’s polyline, thinned to this.

flat_edit Change a 2D element, dimension, note or count

Change one thing on the 2D sheet, by id or name: an element, a dimension or a count takes a new name; a note new text or a new place (at, its lower-left corner); any of them visible: false to leave it out of the stage, the picture and the exports. Returns the 2D state. One undo step.

ParameterTypeDescription
atarrayA note’s new lower-left corner.
countA count (tally).
dimensionA 2D dimension.
elementA 2D element.
namestringThe new name.
noteintegerA note, by its id.
textstringA note’s new text.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
visiblebooleanShown, or left out.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

flat_fit Fit a 2D element

Make a 2D element on the sheet as its tool does — kind point, line, circle, arc or spline, by a method of that kind: point: flat-point-pick (pick), flat-point-midpoint (construct), flat-point-intersect (construct), flat-point-center (construct); line: flat-line-pick (pick), flat-line-seed (seed), flat-line-edge (edge); circle: flat-circle-pick (pick), flat-circle-seed (seed), flat-circle-edge (edge), flat-circle-centers (construct); arc: flat-arc-pick (pick), flat-arc-edge (edge); spline: flat-spline-pick (pick). A pick method takes points, the places clicked (snapped to the nearest edge wit…

ParameterTypeDescription
kind *stringWhat to make.
boxobjectEdge points inside this box, sheet units (edge or seed methods).
chainsarrayEdge chains by number, taken whole (edge or seed methods).
methodstringThe method — see the description; the kind’s first pick method by default.
namestringA name for it.
pointsarrayThe places, in the sheet’s units.
reachnumberHow far a place reaches for an edge, sheet units; ten image pixels by default.
refsarrayconstruct: the source elements.
snapbooleanPicks snap to the nearest edge within reach; true by default.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

flat_note_add Write a note on the sheet

Write a text note on the 2D sheet, as the Text tool does — one line, a line break written as " / "; at is its lower-left corner, sheet units. It is drawn on the stage and in flat.render, written into the SVG and DXF exports and listed in the report. Returns the note with its id. One undo step.

ParameterTypeDescription
at *arrayIts lower-left corner.
text *stringWhat it says.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

flat_objects Find the parts on the image

The separate parts on the flatbed image, parted from the background by a grey level (Otsu’s unless threshold is given) and numbered in reading order — what flat.profile takes by number. Returns each with area, holes, box, centroid, equivalentDiameter, feret (largest and smallest caliper widths with their directions), axisAngle, chains (the edge chains along its outline) and, with outline, its polygon. Trap: minArea drops smaller ones, 1 mm² by default. Changes nothing.

ParameterTypeDescription
darkbooleanThe parts are darker than the background.
limitintegerParts at most — 100 by default.
minAreanumberThe smallest part, in the sheet’s units squared.
outlinenumberAdd each outline, thinned to this, in the sheet’s units.
thresholdintegerGrey level, 0 to 255.

flat_open_image Open a flatbed image

Open a flatbed scan of a part — PNG or JPEG, at the highest optical resolution — on the 2D sheet, in place of the image there was. The scale it declares about itself is taken until it is calibrated. Needs the browser. Returns the 2D state. Not undoable: a new image starts a new history. The file is read from `path` on this computer and streamed to the page.

ParameterTypeDescription
path *stringThe file to read, on this computer: an absolute path, or a relative one. A relative path is taken from the folder of the scan or project last opened or saved (scanruler_status: server.relativeTo) —…
namestringThe file's name with its extension — "part.png". Defaults to the file's own name.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

flat_profile Profile an outline and count its peaks

An outline read against a centre (radial, the default: a part seen from above) or along an axis (axial: a part lying on its side, each side apart), and its peaks counted — the teeth of a knurl or a gear. The outline is an object of the last flat.objects by number, or edge chains by number; about is the element it is read about, else the outline’s own centre or long axis. Returns per side the count, pitch, envelope (max, min, mean peak, mean valley; radial also as diameters) and every peak’s position; points adds the sampled profile. Trap: a peak must stand prominence above the higher val…

ParameterTypeDescription
aboutA circle, arc or point (radial), or a line (axial).
axisstringWithout about: radial about the outline’s centre (the default), or axial along its long axis.
chainsarrayEdge chains by number, as one outline.
markbooleanPut a count on every peak.
objectintegerAn object of the last flat.objects, by number.
pointsbooleanAdd the sampled profile.
prominencenumberHow far a peak must stand out, sheet units.
samplesintegerBins round the turn or along the axis; from the point count by default.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

flat_remove Remove from the 2D sheet

Remove elements, dimensions, notes and counts from the 2D sheet, each by id or name (a note by id) — all of them or none. An element built on a removed one stays and says it has lost its source, a dimension on one turns invalid; the answer names them. Returns what is left. One undo step.

ParameterTypeDescription
countsarrayCounts, by id or name.
dimensionsarrayDimensions, by id or name.
elementsarray
notesarrayNotes, by id.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

flat_render Picture the sheet

A picture of the 2D sheet as a PNG, as the sheet lies in its own units — +X right, +Y up, whatever the alignment or turns — with a grid and its values along the top and left edges. map says where it lies: picture pixel (column c, row r from the top) is the sheet place [left + c·unitsPerPx, top − r·unitsPerPx]. frame zooms in on a box. show puts layers in or out: image, edges (the detected chains), chains (their numbers), elements (with counts and the alignment), dimensions, notes, labels, grid. 800 px on the long side by default, up to 2048. Needs the browser. The picture comes back as…

ParameterTypeDescription
frameWhat to picture, in the sheet’s units — the whole sheet by default.
heightintegerPixels down, 64 to 2048.
inlinebooleanfalse, with path: the picture is written to the file and not shown — the answer says where. A picture costs far more context than its text; save the ones you only deliver.
pathstringAlso write the picture to a file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a p…
showobjectLayers in (true) or out (false).
widthintegerPixels across, 64 to 2048.

flat_report Get the 2D report

The 2D Measure report as its Copy button gives it: the image or section, the scale it rests on, the alignment, every element, dimension, count and note.

flat_set_alignment Align the sheet

Put the part’s zero point at origin and its X axis through xAxis, as the Align tool’s two clicks do: the report, the panel and the exports then read in that frame. Places given to the commands stay the sheet’s own. clear: true takes the alignment off. Returns the 2D state. One undo step.

ParameterTypeDescription
clearbooleanTake the alignment off instead.
originarrayThe zero point, in the sheet’s units.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…
xAxisarrayA place on the +X axis.

guide_read Read a guide

How to do a task with ScanRuler: the workflow, the judgement and the traps the tools’ own descriptions do not carry, written for this build — read the guide for your task, whole, before its first step, and a section again when you need it. The guides: measure — measuring a 3D scan: fitting elements, dimensions and GD&T-like checks, sections and the 2D sheet, deviation against a reference part, wall thickness, the report — by hand or as an automatic run over many scans; measure-reference — the measuring tools’ shapes with examples, what each answer costs, what each refusal means —…

ParameterTypeDescription
sectionstringOne section of the guide, by its heading — a ## section or a ### part of one (without its number, or a part of it that names one section), whole: a section the whole read named in later, when its mo…
topicA guide by its id, or several to read in order — as many as fit in one answer, the rest named in next. Leave it out for the index.

history_checkpoint Mark the history

Mark where the undo history stands, before a run of changes that should stand or fall together: history.restore { checkpoint } later undoes every step made since, back to this mark. Changes nothing. Returns the checkpoint, the step on top and how many there are.

history_redo Redo

Redo the step undone last. Returns the step’s name and the session afterwards in brief (detail "full": the whole of it).

ParameterTypeDescription
detailstringbrief (the default): what the steps change, in brief, as after; full: the whole session, as state.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

history_restore Back to a mark in the history

Undo every step made since history.checkpoint gave this checkpoint, newest first — a run of changes that went wrong in the middle taken back whole. Refused, undoing nothing, when the mark is gone: undone past it, or the history started afresh (a scan or project opened). Returns the steps undone, newest first, and the session afterwards.

ParameterTypeDescription
checkpoint *stringWhat history.checkpoint returned.
detailstringbrief (the default): what the steps change, in brief, as after; full: the whole session, as state.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

history_undo Undo

Undo the last step — one of the person’s or one of these commands, each of which is one step. Returns the step’s name and the session afterwards in brief (detail "full": the whole of it).

ParameterTypeDescription
detailstringbrief (the default): what the steps change, in brief, as after; full: the whole session, as state.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

project_load Open a project

Open a .scanruler project in place of the session — its models, then every measurement in it, remeasured, each fit as it was saved. Refuses while the session holds measurements unless discard is true. Needs the browser. Returns the session, with a warning naming any fitted element whose surface was not found again (its saved fit stands). Not undoable: an opened project starts a new history. The file is read from `path` on this computer and streamed to the page. With `saveTo`, the session is saved as a project file there first (as project_save does), then replaced as with discard: true — on…

ParameterTypeDescription
path *stringThe file to read, on this computer: an absolute path, or a relative one. A relative path is taken from the folder of the scan or project last opened or saved (scanruler_status: server.relativeTo) —…
discardbooleantrue: replace the session though it holds measurements (lost unless saved as a project first). Refused otherwise when there is work to lose.
namestringIts name, for the status line. Defaults to the file's own name.
saveTostringSave the session as a .scanruler project file here first — a file path, or a folder to save it into under its own name — then go on as with discard: true. If the save fails nothing is replaced. Th…
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

project_rename Name the project

Give the project a name — what Save Project saves it under, the stem of every export and the browser tab’s title, kept in the project file. An empty name takes it off, and the scan’s or the image’s name stands in again. session.state reads it as project.name.

ParameterTypeDescription
name *stringThe name; empty takes it off.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

project_save Save the project

The session as a .scanruler project file, as Save Project downloads it: the scan, the reference, the image and every measurement, each rebuilt when it is opened. Needs the browser. Returns the file’s bytes and its name, holds (what is in it, counted — read it before calling the file a revision: a page reset holds no model), aligned (whether the scan stands in an aligned frame) and says (what a workspace wants said of the work saved). The file is written to `path`; the result says where and how large it is, not its bytes.

ParameterTypeDescription
pathstringWhere to write the file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a file of th…

report_get Get the report

The measurement report. format "text" is word for word what the workspace’s Copy report button gives — measure (elements and dimensions with verdicts), deviation, thickness or flat (2D). format "json" (the default) is the whole session’s report structured: what the numbers rest on (units, scale, frame, alignment, fit method, outlier cut-offs), every element with its fit, every dimension with value, unit, limit and verdict, the tally of checks, the sections, and the deviation, thickness and 2D results with their settings.

ParameterTypeDescription
formatstringjson (the default) or text.
workspacestringFor text: whose report — measure (the default), deviation, thickness or flat.

scan_draft Read the draft against a pull

The scan’s walls that run near a pull direction — the sides a mould opens along — gathered into patches, each with draftDeg, the angle it leans off the pull: positive where the wall faces partly along the pull, negative where it faces back (a back draft, an undercut); with sigmaDeg, spreadDeg, centroid, box, area (mm²), count, facing, turnDeg and round for a boss’s or hole’s round side. Needs pull; box, nearDeg (10), patches (12), minArea (1 mm²) and split (a plane no patch reaches across: "symmetry", a plane element, "XY", "YZ", "XZ" or { point, normal }) narrow it. Trap: read it…

ParameterTypeDescription
pull *arrayThe pull direction, any length.
boxobjectOnly the scan inside this box.
minAreanumbermm²; 1 by default.
nearDegnumberDegrees; 10 by default.
patchesintegerHow many patches; 12 by default.
splitKeep every patch to one side of this plane.

scan_fit_surface Fit a sloped or curved patch

A patch of the scan measured as a surface — a sloped side, a twisted ruled face, a dome, a saddle — from vertices or a box (normal keeps those facing a way). Returns the patch’s frame (origin, normal, basisU, basisV) and each model as a height over (u, v): plane (a + b·u + c·v), bilinear (+ d·u·v) and quadric (+ d·u² + e·u·v + f·v², with curvature { k1, k2, r1, r2, axis1, axis2, shape }), each with coefficients, rms and worst; model: best (the default) fits every one and names the simplest whose rms is within a tenth of the lowest. Trap: 7 points at least, at most limit (20000)…

ParameterTypeDescription
boxobjectThe scan inside a box, in place of vertices.
limitintegerHow many points at most; 20000 by default.
modelstringWhich surface; best (the default) fits each and names the simplest that holds.
normalobjectWith box: only the vertices facing this way.
verticesarrayThe scan vertices of the patch.

scan_heightmap Map the scan’s heights

Where the scan is first met looking along an axis (axis, -z by default: the top surface from above) or square onto a plane (plane: an element, "XY", "YZ", "XZ", or { origin, normal, u? }), over a grid of cells: pocket floors, ledges, a step's height, a face's tilt, a pad's tiers, an icon on a key in one call. of: height (the default), deviation (the map's reading where each ray lands) or relief (the height less the surface round it, for icons, grooves and lettering). Returns cell, origin [u0, v0], cols, rows, grid (rows of mm from the low v up, null where nothing; grid[r][c] stands at u0 + (c…

ParameterTypeDescription
axisstringThe way looked: -z (the default) from above, +z from below, ±x, ±y.
boxobjectThe part looked at; the scan’s box by default. With plane: [u, v, height], or world: { min, max }.
cellnumberThe cell’s side, mm.
flipbooleanWith plane: look from its other side.
gapnumberlevels: the least gap between two levels, mm.
gridbooleanThe grid of numbers (the default unless levels); false returns the picture alone.
inlinebooleanfalse, with path: the picture is written to the file and not shown — the answer says where. A picture costs far more context than its text; save the ones you only deliver.
levelsbooleanGather the values into levels, largest first, in place of the grid; of a height, a warp taken out first when it ran two together, and each level of 5 % or more with its plane.
ofstringheight (the default), deviation (the map’s, where the ray lands) or relief (height less the surface round it).
pathstringAlso write the picture to a file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a p…
picturebooleanAdd a picture of the map with a scale.
planeLook square onto this plane instead of along an axis.
slopeDegnumberlevels of a height: cells steeper are left out, degrees; 10 by default, 90 keeps every one.
smoothnumberrelief: the smoothing sigma, mm; three cells by default.

scan_nearest Find a place on the scan

Where a place lands on the scan: the vertex (a point snaps to the nearest), its coordinates and outward normal, a triangle it is a corner of, and how far it lies from the point asked about. Use it to check a point lies on the surface before fitting there.

ParameterTypeDescription
at *The place on the scan.

scan_open Open a scan

Open a mesh as the scan to measure — STL, PLY, OBJ or 3MF, or a STEP part cut into triangles — in place of the one there is; everything measured on the old one goes with it, so it refuses while the session holds measurements unless discard is true (the refusal names what is held). A reference part opened from a file stays, its alignment and maps gone (referenceKept); one made from the session’s own work goes (referenceDropped). Returns the scan: name, units, vertex and triangle counts, bounding box, centre and diagonal (size), mm. Not undoable: a new scan starts a new history. The file i…

ParameterTypeDescription
path *stringThe file to read, on this computer: an absolute path, or a relative one. A relative path is taken from the folder of the scan or project last opened or saved (scanruler_status: server.relativeTo) —…
discardbooleantrue: replace the session though it holds measurements (lost unless saved as a project first). Refused otherwise when there is work to lose.
namestringThe file's name with its extension — "ballbar.stl". Defaults to the file's own name.
saveTostringSave the session as a .scanruler project file here first — a file path, or a folder to save it into under its own name — then go on as with discard: true. If the save fails nothing is replaced. Th…
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
unitsstringThe file’s units: mm (the default), cm, m or in. Everything is measured in mm once read.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

scan_outline Read the scan’s outline

The scan’s outline seen along an axis, or square onto a plane, read as a sketch would draw it: a flange’s plan, a bezel’s opening, a gasket’s shape — each loop as the fewest lines and arcs that follow it within tolerance (mm, 0.2 by default), a round loop as one circle. axis, plane, flip and box as scan.heightmap takes them, u, v as it lays them. Returns loops, the largest first (4 by default): hole, area (mm²), box, points ([u, v] corners), rounds { at, radius, center }, arcs { from, radius, center, mid } (from points[from] through mid to the next point: mid says which way it bulge…

ParameterTypeDescription
axisstringThe way looked: -z (the default) from above, and so on.
boxobjectOnly the scan inside it; the whole scan by default. With plane: [u, v, height], or world: { min, max }.
flipbooleanWith plane: look from its other side.
loopsintegerHow many loops, the largest first; 4 by default.
planeLook square onto this plane instead of along an axis.
tolerancenumberHow closely the sketch follows the outline, mm; 0.2 by default.

scan_pattern Count the repeats round an axis

Rotational repeats about an axis — a fan's blades, a flange's holes, a wheel's spokes, a gear's teeth — counted from the scan: it is cut square to the axis at each height in at, and each cut (between radius.min and radius.max) is turned against itself. Needs axis: a cylinder, cone, line or circle element, "X", "Y", "Z", or { origin, dir }. Returns per height count, pitchDeg, phaseDeg, betweenDeg (angles as section.cut { across: { axis, angleDeg } } takes them), score (0 to 1; under 0.5 count is 1 and tried says the best), rms, worst, instances (each angleDeg, radius, offDeg, rms, worst, sh…

ParameterTypeDescription
axis *The axis the copies repeat round.
atarrayHeights to cut at; 6 spread over the scan by default.
instancesbooleanList each copy; true by default.
maxCountintegerThe most copies looked for; 60 by default.
radiusobjectOnly the cut between these distances from the axis.

scan_qa Check the scan before modelling

One call before modelling, to know what the scan will and will not give. Returns rims (the open edges of its holes: count, total length, the longest few with rim number, centre, size and circle where one fits — element.fit { kind: "circle", rim } makes it an element), noise (the median scatter of small plane fits, mm; 0 on a CAD tessellation), tessellation where the mesh is an STL exported from CAD (cad, its facets exactly flat; sparse where its vertices lie only on edges and rims, too far apart to fit on — densifyTo, the edge length to subdivide it to first, noise.measured the bends betwe…

ParameterTypeDescription
axisThe thickness axis.

scan_query Read the scan’s points

The scan’s vertices inside a box, or within a radius of a point (near), with their outward normals — the points on a face, to measure a dimension or a draft off; normal keeps only those facing a direction. Returns matched, the vertex numbers, points and normals (mm, current frame), the box round them, centroid and mean normal; fields: count, ids or all (the default) says how much. Trap: at most limit come back (1000 by default, 20000 at most), every k-th spread evenly, step saying k — mark: true marks every matching vertex, not the thinned list, for element.fit_marked { marked: true }. C…

ParameterTypeDescription
boxobjectA box in the current frame.
fieldsstringcount: the numbers alone (the default with mark); ids: with the vertices; all: with points and normals (the default).
limitintegerHow many vertices at most; 1000 by default, 20000 at most.
markbooleanLeave every matching vertex marked, for element.fit_marked { marked: true }.
nearobjectA ball about a point, in place of box.
normalobjectOnly the vertices whose outward normal faces this way.

scan_scale Scale the scan

Scale the scan to its true size — a photogrammetry scan (Meshroom, say) has no size of its own, and session.state says noTrueSize when one looks like it. Give references: lengths measured on the scan with their true lengths from the real part — a length dimension already made (distance or diameter), an element’s diameter (sphere, cylinder, circle), or two points — or a factor outright. Several references are averaged by length; each one’s own factor and how far it is off the average (offPct) come back, so a bad one shows. Best references: long, and between centres (hole to hole, ball…

ParameterTypeDescription
dryRunbooleanWork out the factor and the size it gives, and scale nothing.
factornumberScale by this factor outright, instead of from references — 25.4 for a file in inches read as mm.
referencesarrayLengths to scale from — one or more.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

scan_segment Find the scan’s flat regions

The scan’s planar regions, found all at once: grown from the flattest places outward within maxDeg (15°) and maxRms (0.05 mm), those smaller than minArea given back. Returns found, considered, claimed, noise and the regions, largest first, at most limit (20): id, normal, point, sigma, area (mm²), box, vertices, neighbours { id, deg, smooth } and, with symmetric, mirror (its twin across that plane). Trap: a round surface comes out as strips that look like facets — such a region says curved { sagitta } and run, and curvedRuns joins them into surfaces with a note saying what to model each a…

ParameterTypeDescription
boxobjectOnly the scan inside this box.
kindstringWhat to find; plane, the default and for now the only one.
limitintegerHow many regions are listed; 20 by default.
listbooleanWith mark: the list of regions too.
markLeave this region’s points marked, or several regions’.
maxDegnumberDegrees; 15 by default.
maxRmsnumbermm; 0.05 by default.
minAreanumbermm²; by default a square 2 % of the scan’s diagonal on a side.
symmetricPair regions mirrored across this plane: a plane element, or "XY", "YZ", "XZ".

section_cut Cut a section

Cut the scan with a plane and keep the cut as a section, put on the 2D sheet. across: an element with a direction (plane, cylinder, cone, line, circle) by id or name; "XY", "YZ" or "XZ" through the part’s centre; or { axis, angleDeg }, a plane through an axis turned angleDeg about it — a half section of a turned part. offset slides the plane along its normal, mm (a coordinate plane: the coordinate itself). kind "shadow" keeps the scan’s shadow instead: the whole part projected onto the plane, its outer boundary as loops read as lines and arcs (tolerance, play, smoothDeg), stood up as a b…

ParameterTypeDescription
across *An element with a direction, a coordinate plane, or { axis, angleDeg }.
extrudebooleanShadow: stood up as a block through the part, for export.step; true by default.
kindstringcut (the default), or shadow: the whole scan projected onto the plane.
namestringA name; otherwise numbered — "Section 2".
offsetnumberAlong the normal, mm. A cut’s only.
playnumberShadow: clearance outside the part, mm; 1 by default, negative a press fit.
smoothDegnumberShadow: corners turning less than this are rounded, degrees; 30 by default, 0 keeps all sharp.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
tolerancenumberShadow: lines and arcs read to this, mm; 0.1 by default.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

section_get Read a section’s polylines

A section’s cut as polylines: each chain’s points in order — [u, v] mm on the sheet, what flat.fit and a sketch on the section take, or with space "world" or "both" [x, y, z] in the current frame — with the plane (origin, normal, basisU, basisV) and per chain closed, length, points, bounds. Trap: at most limit points over all chains (4000 by default, 50000 at most); past it every k-th point is kept and step says k. chains picks chains by index; skin "outer" or "inner" reads one skin of a thin wall alone, facing the points whose way out lies within withinDeg of dir, each chain then comi…

ParameterTypeDescription
section *The section, by id or name.
chainsarrayWhich chains; every one by default.
facingobjectOnly the points whose way out of the material lies within withinDeg of dir.
limitintegerPoints at most over every chain; 4000 by default, 50000 at most.
skinstringOne skin of a thin wall alone.
spacestringsheet (the default): [u, v]; world: [x, y, z]; both.

section_render Picture a section

A picture of a section as a PNG, for checking a slice against what was built on it: the scan’s cut as points on the sheet ([u, v] mm, +u right, +v up), a mm grid with values in the margins, a scale bar, and the workspaces’ layers over it (a model’s cut as outlines, a sketch’s pieces). Scan points within ten tolerances of an outline are read against it: on it (grey) or off it (red). Needs section, or plane to cut the scan for the picture alone ({ origin, normal }, "XY"/"YZ"/"XZ", an element, or { sketch }). Returns gap { points, read, over, outside, inside, max, rms, overBox }, layers,…

ParameterTypeDescription
frameobjectLook at a square of the sheet: { at, size }, or { world: { min, max } } (or { min, max }).
heightintegerPixels down, 64 to 2048.
inlinebooleanfalse, with path: the picture is written to the file and not shown — the answer says where. A picture costs far more context than its text; save the ones you only deliver.
layersarrayThe layers to draw, by key; every one by default, [] for the scan alone.
offsetsarraySeveral parallel cuts in one picture: mm along the normal — on a coordinate plane by name, from the world’s zero, so "XY" with [0, 5] cuts at Z 0 and Z 5.
pathstringAlso write the picture to a file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a p…
planeA plane to cut the scan by for the picture alone, in place of a section.
sectionThe section, by id or name.
tolerancenumber± mm a scan point may lie off an outline and still be on it; the Deviation workspace’s by default.
upstringThe world axis that runs up the picture; the sheet as it lies by default.
widthintegerPixels across, 64 to 2048.

session_recent What recent jobs did

What became of the commands an agent’s server ran under its jobs — each change and each batch is one, and the server names it — newest first: the job, the command, running, done or failed, when it started and its ms, and its result or its error { code, message }. A result past 16,000 characters is left out (resultOmitted says its size). The page keeps the last 100 for as long as it stays open, so a server started after the one that asked can still say what a job did. job: only that job’s.

ParameterTypeDescription
jobstringOnly this job’s commands, as the server named it.
limitintegerHow many at most, newest first — 20 by default.

session_reset Start over

Close the scan, the reference part and the 2D image, and with them every measurement and the project’s name, as opening an empty project does. Refuses while the session holds measurements unless discard is true. Not undoable: the history starts over too. With `saveTo`, the session is saved as a project file there first (as project_save does), then replaced as with discard: true — one call to keep what a page holds and start anew.

ParameterTypeDescription
discardbooleantrue: replace the session though it holds measurements (lost unless saved as a project first). Refused otherwise when there is work to lose.
saveTostringSave the session as a .scanruler project file here first — a file path, or a folder to save it into under its own name — then go on as with discard: true. If the save fails nothing is replaced. Th…
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

session_state Read the session

The whole session as JSON: the app and its plugins, the project (name, unsaved, holds), the workspace on screen, busy, the scan (file, units, counts, bounding box, centre, size, alignment), every element with its fit, every dimension with value, limit and verdict, the sections, what is open in the panels, the deviation, wall thickness and 2D state with their statistics, the guided hint, the undo history and ui.units. Trap: the screen may show inches; every answer here is in millimetres, angles in degrees. Read it before acting and after.

thickness_measure Measure the wall thickness

Measure the wall thickness at every point of the scan, as the Wall Thickness workspace’s Measure button does, with the search settings given or those in hand. Returns the statistics (min, max, mean, sigma, share under the thin-wall limit, points measured) and the settings. One undo step.

ParameterTypeDescription
coneAngleDegnumberray: the cone’s half-angle, degrees.
coneRaysintegerray: rays in the cone about the normal; 0 for the normal alone.
maxThicknessnumberThe thickest wall searched for, mm.
methodstringray: along the inward normal to the far wall (the shortest of a cone with coneRays). sphere: the largest sphere that fits at the point.
normalDeviationDegHow far the far wall may turn from facing back, degrees, or null for any.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

thickness_settings Set how the wall thickness is searched and read

The search settings (method, maxThickness, coneRays, coneAngleDeg, normalDeviationDeg — they take effect at the next thickness.measure) and the reading: low and high, the ends of the colour scale, mm; bands, a stepped scale or null; limit, the thin-wall limit the statistics count under, mm. Returns the thickness state. One undo step.

ParameterTypeDescription
bandsStepped colours, or null.
coneAngleDegnumberray: the cone’s half-angle, degrees.
coneRaysintegerray: rays in the cone about the normal; 0 for the normal alone.
highnumberColour scale’s high end, mm.
limitnumberThin-wall limit, mm.
lownumberColour scale’s low end, mm.
maxThicknessnumberThe thickest wall searched for, mm.
methodstringray: along the inward normal to the far wall (the shortest of a cone with coneRays). sphere: the largest sphere that fits at the point.
normalDeviationDegHow far the far wall may turn from facing back, degrees, or null for any.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…

view_render Picture the view

A picture of the 3D view as a PNG — what the viewport shows, without the HTML labels (dimension values, names). view and/or fit turn the view first, as view.set does; frame frames a box or a place (mmAcross says what the picture spans). Trap: only fit: true fits — a view alone keeps the zoom, and a frame stays for the pictures after it (fitted and framedEarlier say so). show puts keys on screen or away for the picture alone ({ scan: false } pictures what was built on the scan); a key that has to be read, a workspace’s map, is waited for up to 35 s, and the answer says how far it got if n…

ParameterTypeDescription
fitbooleanFit everything shown into the frame, keeping the direction.
frameFrame a box or a place instead of everything shown; the direction stays, fit is left alone.
heightintegerPixels down, 64 to 2048.
inlinebooleanfalse, with path: the picture is written to the file and not shown — the answer says where. A picture costs far more context than its text; save the ones you only deliver.
pathstringAlso write the picture to a file: a file path — one there already is replaced — or a folder (one there, or a path ending in /) to write it into under the name ScanRuler gives it, numbered past a p…
sectionThe section view: cut open at a plane, the near half taken away, closed parts capped. Set after any turn.
showobjectKeys to show (true) or put away (false): scan, reference, sections, elements (with dimensions), labels, map (the deviation map, in Deviation and in Reverse engineer), and a workspace’s own (view.set…
viewstringA standard view: iso (front, right, above) and the other iso corners, top (down Z, Y up), bottom, front (from −Y, Z up), rear, left (from −X), right.
viewsarraySeveral standard views in one picture, each fitted.
widthintegerPixels across, 64 to 2048.

view_set Turn the view

Turn the 3D view to a standard view and/or fit everything shown — with neither, it fits — or frame a box or a place; the zoom a frame leaves stays for what comes after. show puts keys on screen or away and leaves them so; section cuts everything open at a plane and leaves it so. Waits for the session to settle first. Not a step of the history. Needs the viewport. Returns view, fitted, framed, framedEarlier, mmAcross ([width, height] mm), section (null when off) and shown: every key and whether it is, with <key>Why for a workspace key that is off.

ParameterTypeDescription
fitbooleanFit everything shown into the frame, keeping the direction.
frameFrame a box or a place instead of everything shown; the direction stays, fit is left alone.
sectionThe section view: cut open at a plane, the near half taken away, closed parts capped. Set after any turn.
showobjectKeys to show (true) or put away (false): scan, reference, sections, elements (with dimensions), labels, map (the deviation map, in Deviation and in Reverse engineer), and a workspace’s own (view.set…
viewstringA standard view: iso (front, right, above) and the other iso corners, top (down Z, Y up), bottom, front (from −Y, Z up), rear, left (from −X), right.

workspace_set Show a workspace

Put a workspace on screen: measure (fitting elements and dimensions), deviation (scan against a reference part or an element), thickness (wall thickness), flat (2D measuring of an image or a section), or a plugin’s by its id — session.state lists them under app.plugins. Commands put their own workspace on screen; this is for showing the person something.

ParameterTypeDescription
workspace *stringThe workspace — measure, deviation, thickness, flat, or a plugin’s id.
timingsbooleantrue: the answer adds ms and, where the change built, steps.played — each step with its ms.
waitbooleanfalse: answer { queued: true, job } at once and run on; scanruler_wait { for: "job", job } gives the answer. true, the default: answer when done — or queued all the same past the server’s answer l…