docs.rs failed to build cutrail-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
cutrail
English | 日本語
A material removal simulation core for machining, written in Rust. The stock is kept as a triangle mesh and the volume swept by the tool is subtracted with robust mesh booleans. cutrail supports 3- and 5-axis milling, reads and writes STEP, STL, OBJ, glTF and 3MF, compares the result against a design model, and runs in WebAssembly.
Features
- Robust material removal. The stock is a mesh held by manifold-rust (a pure-Rust port of Manifold). Coincident floors and walls, which every real toolpath produces, never make a cut fail. Failures are typed errors and leave the state untouched.
- Tools and motions. Flat, ball and bull-nose end mills. Linear, arc and helical moves. The tool axis can point anywhere, and the axis may rotate within a segment (5-axis). Sweeps are built as convex hulls subdivided by chord tolerance.
- Bounded cost per cut. The stock is tiled; only tiles overlapping the sweep are updated. After 100,000 segments the time per segment is still a few milliseconds.
- I/O. Stock from boxes, cylinders, meshes (STL) or STEP. Output as STL, OBJ, glTF or 3MF. Results of 3-axis flat-end-mill machining (including arc moves) can be exported as an analytic B-rep (planes and cylinders) in STEP, verified as valid solids in FreeCAD and OpenCASCADE.
- Verification. Comparison against a design model (volumes and regions of excess material and gouges), shank/holder collision detection, removed volume and changed bounds per cut.
- Integration. A pose-stream adapter that turns sampled tool poses into segments, incremental mesh transfer of changed tiles, and WebAssembly bindings for Web Workers and Node.
Quick start
[]
= "0.1"
| Cargo feature | Adds |
|---|---|
stepio |
Reading stock and design models from STEP (via truck) |
serde |
Serialize / Deserialize for poses, segments, tools, options, reports, meshes and B-reps |
parallel |
Parallel booleans in manifold-rust (native only) |
use ;
A 5-axis move only needs the tool pose (tip and axis) at both ends:
let seg = linear;
Main API
| Type / function | Role |
|---|---|
Engine / MachiningEngine<K> |
Stock state, cutting, validation, history: new, cut, cut_many, cut_batch, parts, mesh, changed_since, write_mesh_file, write_step, compare_with_design |
EngineOptions |
Chord tolerance, tile size, collision check and other settings |
Tool, Cutter, Shank, Holder |
Tools; the cutting part is distinguished from shank and holder |
Pose, MotionSegment |
Tip position and axis direction, linear and arc segments, pose_at(t) |
CutReport, CutOutcome, Collision |
Result of one cut (NoChange / Updated / Exhausted, removed volume, changed bounds, collision) |
TriMesh |
Mesh I/O (STL and OBJ in; STL, OBJ, glTF, 3MF out) and vertex merging |
StockShape |
Box, cylinder or mesh stock |
step (feature stepio) |
Read stock and design models from STEP |
Brep |
Reconstructed analytic B-rep and STEP export |
DesignComparison |
Difference against a design model (excess material and gouges) |
SegmentBuilder |
Coalesces sampled poses into segments by distance and angle thresholds and a chord-deviation bound |
Kernel |
Abstraction over the geometry kernel; ManifoldKernel is the default |
Accuracy and performance
- Cylindrical surfaces are polygonized to the chord tolerance
sweep_tolerance(default 0.01 mm) using a radius whose mean width matches the diameter. The removed-volume error is about 0.3% for a 4 mm tool. - Rotating segments are subdivided so that the chord error of the farthest tool point stays within the tolerance.
- Pocketing 100,000 one-millimeter segments with 10 mm tiles: the median time per segment grows from 2 ms (first 100) to 6 ms (last 100) and memory stays at 92 MB. 5-axis sweeps cost about 1.7x a 3-axis sweep; WebAssembly (Node) runs at about 1.5x the native time.
- A 99 s robot machining cycle recorded at 100 Hz (botrail) replays in 1.8 s as 710 segments with the chord-deviation bound at 0.01 mm, within 0.04% of the removed volume of the one-segment-per-sample reference.
- Details in docs/accuracy-and-performance.md.
Limitations
- Tools are bodies of revolution (flat, ball, bull-nose). Turning, threading and cutter compensation are out of scope.
- Analytic B-rep export covers horizontal moves, plunges and horizontal arcs of flat end mills in 3-axis machining; other surfaces are exported as facets.
- Tolerance offsets in the design comparison use a polyhedral sphere, so very small tolerances need finer settings.
SegmentBuilderonly emits linear segments; pass arcs explicitly asMotionSegment::arc.- The API is 0.x.
KernelandManifoldKernelexpose manifold-rust types, so a minor release may change them;Engineand the geometry types are the stable surface.
Documentation
- docs/architecture.md: overall design and why the stock is a mesh
- docs/guide.md: usage (options, tools, motions, output, STEP, comparison, collisions, WebAssembly)
- docs/accuracy-and-performance.md: how accuracy is controlled and measured performance
- docs/brep-export.md: analytic surface reconstruction and STEP export
Development
&&
&&
Dependencies
- manifold-rust (Apache-2.0): mesh booleans
- truck (Apache-2.0, feature
stepio): STEP reading and tessellation - zip for 3MF, web-time for timing in WebAssembly, thiserror
License
Apache-2.0 (LICENSE)