Skip to main content

brep_cam/
lib.rs

1//! CAM toolpath engine for the BREP kernel: contracts and geometric core.
2//!
3//! This crate is pure Rust and builds for native targets and for
4//! `wasm32-unknown-unknown`. Algorithms work in MACHINE coordinates with the
5//! cutter axis along `+Z`; the setup's rigid transform is the single place
6//! model coordinates become machine coordinates. Every strategy emits the
7//! same typed motion stream ([`model::Toolpath`]) that preview, simulation
8//! and the post-processors read, and the same inputs always produce a
9//! byte-identical stream.
10//!
11//! Module map:
12//! - [`model`]: setups, machines, tools, operations, targets, toolpaths and reports.
13//! - [`numeric`]: the tolerance object.
14//! - [`mesh`]: the immutable triangle snapshot with body/face identity.
15//! - [`index`]: broad-phase triangle queries.
16//! - [`cutter`]: validated cutter profiles.
17//! - [`cancel`]: cancellation and progress at bounded work chunks.
18//! - [`stock`]: the setup's stock resolved into machine coordinates.
19//! - [`stock_sim`]: the Z-dexel stock and exact 3-axis material removal.
20//! - [`collision`]: shank/holder/rapid collision checks during simulation.
21//! - [`verify`]: the stock-versus-part deviation map.
22//! - [`cycle_time`]: machining time estimates from the motion stream.
23//! - [`error`]: the crate error type.
24//! - `kernel_adapter` (feature `kernel`): BREP bodies to mesh snapshots, the only kernel dependency.
25
26pub mod cancel;
27pub mod collision;
28pub mod cutter;
29pub mod cycle_time;
30pub mod error;
31pub mod geom;
32pub mod index;
33#[cfg(feature = "kernel")]
34pub mod kernel_adapter;
35pub mod mesh;
36pub mod model;
37pub mod numeric;
38pub mod stock;
39pub mod stock_sim;
40pub mod verify;
41// Lane C2: drop cutter and parallel finishing.
42pub mod drop;
43#[path = "strategy/parallel.rs"]
44pub mod parallel;
45// Lane C3: push cutter, waterline and contour finishing.
46pub mod push;
47pub mod waterline;
48// Lane C2 (C9 rows): drop-cutter finishing strategies.
49#[path = "strategy/project.rs"]
50pub mod project;
51#[path = "strategy/radial.rs"]
52pub mod radial;
53#[path = "strategy/spiral.rs"]
54pub mod spiral;
55#[path = "strategy/morphed_spiral.rs"]
56pub mod morphed_spiral;
57#[path = "strategy/pencil.rs"]
58pub mod pencil;
59#[path = "strategy/scallop.rs"]
60pub mod scallop;
61// Lane C4: filtering, arc fitting, linking, program assembly and post-processing.
62pub mod arcfit;
63pub mod filter;
64pub mod link;
65pub mod post;
66pub mod program;
67// Lane C8: drilling cycles, hole recognition and ordering.
68pub mod drill;
69pub mod holes;
70// Lane C11: turning.
71pub mod turning;
72// Lane C12: tool library, feeds & speeds, templates.
73pub mod feeds;
74pub mod library;
75pub mod template;
76// Lane C10: machine kinematics and multi-axis strategies.
77pub mod kinematics;
78// Lane C5: the 2D geometry engine and the 2.5D operations.
79pub mod planar;
80#[cfg(feature = "parallel")]
81pub(crate) mod par;
82// Lane C13: 2.5D feature recognition and automatic programming.
83pub mod features;
84pub mod autoprogram;
85#[path = "strategy/face.rs"]
86pub mod face;
87#[path = "strategy/pocket2d.rs"]
88pub mod pocket2d;
89#[path = "strategy/contour2d.rs"]
90pub mod contour2d;
91#[path = "strategy/slot.rs"]
92pub mod slot;
93#[path = "strategy/trace.rs"]
94pub mod trace;
95#[path = "strategy/chamfer2d.rs"]
96pub mod chamfer2d;
97#[path = "strategy/engrave.rs"]
98pub mod engrave;
99#[path = "strategy/bore.rs"]
100pub mod bore;
101#[path = "strategy/circular.rs"]
102pub mod circular;
103#[path = "strategy/thread_mill.rs"]
104pub mod thread_mill;
105pub mod multiaxis;
106#[path = "strategy/rotary.rs"]
107pub mod rotary;
108#[path = "strategy/swarf.rs"]
109pub mod swarf;
110#[path = "strategy/multiaxis_contour.rs"]
111pub mod multiaxis_contour;
112#[path = "strategy/multiaxis_finish.rs"]
113pub mod multiaxis_finish;
114// Lane C6: adaptive clearing, 3D pocket clearing and rest roughing.
115pub mod adaptive;
116#[path = "strategy/pocket3d.rs"]
117pub mod pocket3d;
118#[path = "strategy/rest_rough.rs"]
119pub mod rest_rough;
120#[path = "strategy/adaptive2d.rs"]
121pub mod adaptive2d;
122#[path = "strategy/adaptive3d.rs"]
123pub mod adaptive3d;
124
125pub use collision::{simulate_checked, simulate_checked_on_machine, CheckedSimulation, Collision, CollisionAgainst, CollisionOptions, CollisionPart};
126pub use cancel::{CancelToken, Cancelled, NullSink, Progress, ProgressSink, RecordingSink, Runner, WorkBudget};
127pub use cutter::{
128    BallConeCutter, BallCutter, BullCutter, ConeCutter, Cutter, CutterError, CutterKind, CutterProfile,
129    FlatCutter, ProfilePoint, ProfileSegment, SegmentKind, Shank, ToolMesh, ToolMeshGroup, ToolPart, ToolProfile,
130};
131pub use cycle_time::{estimate_cycle_time, CycleTime, MotionTime};
132pub use error::CamError;
133pub use index::{AnyIndex, BruteForceIndex, IndexStats, ProjectionMode, TreeIndex, TreeOptions, TriangleIndex};
134pub use mesh::{to_machine, FaceSource, MeshBuildReport, MeshBuilder, MeshError, MeshSnapshot, Triangle, TriangleSource};
135pub use model::*;
136pub use numeric::{NumericError, Tolerance};
137pub use stock::{resolve_stock, ResolvedStock, StockBox, StockCylinder, StockError};
138pub use stock_sim::{
139    mesh::{stock_mesh, stock_mesh_region, touched_region, StockMesh},
140    remaining::{remaining_stock_mesh, remaining_stock_mesh_region, RemainingStockMesh},
141    removal::{RemovalOptions, SimulationReport},
142    carry::{carry_from_setup, carry_stock, CarriedStock},
143    envelope::StockEnvelope,
144    job::{job_dexel_options, job_stock, unavailable_warning, uses_pre_op_stock, JobStock, JobStockResult, SetupHistory, SetupStart},
145    preop::{PlannedOp, PreOpStockCache, PreOpStockError, PreOperationStock},
146    Column, DexelGrid, DexelOptions, StockSimError,
147};
148
149#[path = "strategy/flow.rs"]
150pub mod flow;
151
152#[path = "strategy/morph.rs"]
153pub mod morph;
154
155#[path = "strategy/rest_finish.rs"]
156pub mod rest_finish;
157
158#[path = "strategy/linking.rs"]
159pub mod strategy_linking;
160pub use verify::{deviation_map, DeviationClass, DeviationMap, DeviationOptions, FaceDeviation};
161
162pub mod probe;
163#[path="strategy/probe_wcs.rs"]
164pub mod probe_wcs;
165#[path="strategy/probe_geometry.rs"]
166pub mod probe_geometry;
167
168// Lane C1: one generator entry point over every strategy, for the application's worker.
169pub mod dispatch;
170
171// Operation patterns and explicit manual NC entries.
172pub mod pattern;
173
174// Optional feed optimisation and certified smoothing of linked toolpaths.
175pub mod polish;