trace_outline
Trace a flat object from a scan or photo into a 2D outline in mm, including holes and scaling, for a part script. Use the confirmation image to verify the result before exporting.
Instructions
Trace a flat object in a scan or photo (parts//ref/, from upload_reference) into a
2D outline in mm for a part script: the largest object's outline and its holes, simplified to
tolerance mm (few points: dense polylines build slowly), or with smooth=True through-points
for a periodic spline. Scale, one of: dpi (a flatbed scan; omit everything to read it from the
file), grid (cell size in mm of a grid or cutting mat under the object), reference ('card' =
a credit card 85.60 x 53.98 mm beside the object, or 'L,S' mm of another rectangle), or points
('x1,y1,x2,y2' pixels, origin top left) with distance (mm between them). pick: 'x,y' pixel
inside the object to trace when it is not the largest. threshold (0..1) and invert (object
lighter than the background) override the automatic threshold. Writes out/docs/_outline.json
(the points), out/docs/_outline.py (a snippet with OUTLINE, OUTLINE_HOLES and a face function)
and out/images/_trace.png (the outline on the image: show it to the user to confirm). A scan is
accurate to about a pixel; a photo only as far as it is square-on, flat and undistorted:
check a known dimension before trusting it.
Remote server (HTTP/SSH): the files stay on the server, as a temporary working copy deleted
when unused; bring the part home with download_part (one zip in the parts// layout).
Never use ssh, scp or a shell on the server: there is none.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dpi | No | ||
| file | Yes | ||
| grid | No | ||
| part | Yes | ||
| pick | No | ||
| inline | No | ||
| invert | No | ||
| points | No | ||
| smooth | No | ||
| distance | No | ||
| reference | No | ||
| threshold | No | ||
| tolerance | No |