code wiki / (root) / nx_pcb_cam.nx

nx_pcb_cam.nx

buildroot/runtime/nx_pcb_cam.nx

5629 B128 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic pcb
docsdependenciesstructsconstsfunctions

about

nx_pcb_cam.nx -- SOVEREIGN PCB isolation-milling CAM: copper geometry -> CNC G-code toolpaths. This CLOSES THE IN-HOUSE LOOP of the Omniforge "chips" leg: instead of sending Gerber to an external fab, we mill the board ourselves on a CNC (or a 3D-printer-derived mill) by cutting AWAY the copper around each trace/pad so the remaining copper is electrically isolated. The core operation is geometric OFFSETTING: each trace centreline is offset perpendicular by (copper_half_width + tool_radius) to both sides; each pad gets a square isolation ring at (pad_radius + tool_radius). INTEGER-ONLY / NO-FLOAT: coordinates in micrometers, perpendicular normals via an inlined integer sqrt (proven Newton idiom, exact for axis-aligned segments), coordinates formatted to decimal mm with the SHARED g_mm6 from nx_pcb_gerber (DRY). Reuses the same toolpath family as the slicer/CAM. NEVER-BRICK (#26): emits G-code FILES only; no machine control / firmware writes here. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_pcb_gerber.nx nx_pcb_cam.nx nx_pcb_cam_gate.nx

imports: nx_syscalls.nxnx_pcb_gerber.nx

imported by: nx_pcb_cam_gate.nx

structs

none

consts

14const K_MAGIC_12000: i64 = 12000

functions

17func cam_isqrt(v: i64) -> i64
called by 1: cam_emit
28func cam_z(buf: *u8, len: *i64, z_um: i64) -> i64
called by 2: cam_plungecam_retract calls 2: g_putsg_mm6
36func cam_rapid(buf: *u8, len: *i64, x_um: i64, y_um: i64) -> i64
called by 2: cam_passcam_ring calls 2: g_putsg_mm6
44func cam_cut(buf: *u8, len: *i64, x_um: i64, y_um: i64, feed: i64) -> i64
called by 2: cam_passcam_ring calls 3: g_putsg_mm6g_puti
53func cam_plunge(buf: *u8, len: *i64, cut_depth_um: i64, plunge: i64) -> i64
called by 2: cam_passcam_ring calls 3: g_putscam_zg_puti
61func cam_retract(buf: *u8, len: *i64, safe_z_um: i64) -> i64
67func cam_pass(buf: *u8, len: *i64, x1: i64, y1: i64, x2: i64, y2: i64,
77func cam_ring(buf: *u8, len: *i64, x0: i64, y0: i64, x1: i64, y1: i64,
91func cam_emit(