MacCADfront matter

[08]entry 8 of 34

MacCAD

CAD · Rust/Swift2026

Fig. 1. A machined plate as it is drafted: its bore, bolt holes and slot drawn on both faces, centre lines and a dimension along the edge, the outline traced as the tool draws it and a cursor snapping from hole to hole.

this entry is written twice, in full

  1. 1.in brief

    native 2D CAD for Apple Silicon on a Rust engine

  2. 2.in general

    A native, open-source 2D CAD app for the Mac, drawn in Metal around a double-precision Rust engine.

  3. 3.in particular

    A Rust document engine in f64 behind a single-owner C ABI, a Metal canvas that draws in camera-relative floats, and an R-tree that picks among 100,000 lines in about a third of a microsecond.

  1. 1.in brief

    a drawing program for architects and engineers, made for the Mac

  2. 2.in general

    A free, open-source program for precise technical drawings on a Mac, around a drawing engine built from scratch.

  3. 3.in particular

    An engine that keeps every measurement to about sixteen digits, a screen that draws it on the Mac’s graphics chip, and a search structure that finds the line you clicked among a hundred thousand in about a third of a millionth of a second.


context

MacCAD is a native, open-source 2D CAD app for Apple Silicon: Swift2, AppKit4 and SwiftUI5 around cad-core, a Rust1 crate that owns documents, commands, history, geometry, spatial indexing and exchange, with the canvas drawn in Metal3. It works offline on local files, saves editable .maccad documents, imports DXF and, experimentally, DWG, and exports a limited DXF subset and scaled PDF. It ships as a DMG for macOS 14+ with signed Sparkle9 updates and a GPL corresponding-source archive, on the same direct-distribution model as Trav.

the problem

CAD is unforgiving in ways most graphics is not. A drawing in millimetres can span kilometres, so model coordinates need double precision, which a GPU does not want to draw in. A drafter expects every operation, trims and fillets included, to be undoable and to survive a save and an autosave. And the files people already have are DWG, a closed format, and DXF, which every program writes slightly differently; an importer that silently drops what it cannot read is worse than one that refuses.

what i built

  1. 1.

    cad-core in Rust1: an f64 document bounded to ±1e12 drawing units, a command engine with undo and redo over every change, and an R-tree (rstar6) bulk-loaded over entity bounds for picking and window or crossing selection

  2. 2.

    Drafting: lines, bulged polylines, rectangles, polygons, circles, arcs, ellipses, clamped control-point splines, points, text, linear, aligned, radius and diameter dimensions, leaders and convex hatches; and move, copy, rotate, scale, mirror, offset, trim, extend, fillet, chamfer, join, break, stretch, rectangular and polar arrays, and explode

  3. 3.

    Snaps to ends, midpoints, centres and quadrants, analytic line, circle and arc intersections, and nearest, perpendicular and tangent points from a base point; layers with visibility, locking, colour, linetype and lineweight

  4. 4.

    A single-owner C ABI: one serial document queue owns each handle, JSON requests go in, and geometry comes back as binary arrays of segments and triangles that Swift2 copies before freeing

  5. 5.

    A Metal3 canvas that converts each batch to floats relative to the camera, so the GPU draws in single precision while the model stays in double, with a command bar (history, Tab completion, absolute and relative coordinates) and a properties and layers inspector

  6. 6.

    Native documents: version 2 .maccad files that migrate version 1, AppKit4’s coordinated saves and autosave, and PDF plots from A4 to A0 and US sizes, at an exact scale or fitted, in colour or monochrome, with plotted lineweights

  7. 7.

    Exchange that reports what it loses: DXF through dxf-rs7 with an import report of everything omitted or simplified, an R2013 export subset, and DWG converted by a bundled LibreDWG8 0.14 in a separate process killed after 30 seconds, never overwriting the source

  8. 8.

    Direct distribution: an ad-hoc signed DMG, Sparkle9 updates signed with MacCAD’s own key, version-specific archives, SHA-256 checksums, and the GPL source archive with locked Rust1 dependencies and the LibreDWG8 tarball

outcome

5,430 lines of Rust1 in the engine and 1,265 lines of Swift2 in the app, with 30 core tests covering spline evaluation, bulges, fillets, corner-edit atomicity, arrays and history, selection, snaps, format migration and DXF handling; all 30 pass. On an Apple M2 its own benchmark, over three runs, validates and indexes 100,000 lines in about 16.5 ms, builds the full scene in about 9.4 ms and answers 1,000 picks in about 0.35 ms; that is CPU time, not GPU frame rate. Not there yet: DWG writing, layouts and viewports, external references, associative annotation, and qualification on professional drawings.

It is a drafting preview and says so: every tool it has is drawn, edited, undone and saved natively, and everything it cannot do yet, from DWG writing to layouts, is listed in a compatibility matrix rather than implied.

context

MacCAD is a free, open-source program for technical drawing (the flat, precisely measured plans that buildings and parts are made from), written for Macs with Apple’s own chips. The interface is a real Mac app; underneath is an engine that keeps the drawing, the commands, the undo history and the geometry, and the drawing is put on screen by the graphics chip. It works offline on files on your own Mac, saves its own editable files, opens the two formats professional drafting programs use (one of them experimentally), and exports to one of them and to scaled PDFs. It comes as an installer that updates itself, with its full source code published alongside, the same way Trav is distributed.

the problem

Technical drawing is unforgiving in ways most graphics is not. A drawing measured in millimetres can stretch for kilometres, so positions need far more precision than a graphics chip likes to draw with. Someone drafting expects every change, even cutting one line back to another or rounding a corner, to be undoable and to survive saving and an automatic save. And the drawings people already have come in a closed format and an open one that every program writes slightly differently; a program that quietly throws away what it cannot read is worse than one that refuses.

what i built

  1. 1.

    An engine that holds every position to about sixteen significant digits within sensible limits, a list of commands where every change can be undone and redone, and a search structure over the shapes’ outlines, so clicking or dragging a box picks the right ones at once.

  2. 2.

    The drawing tools: lines, curved multi-part lines, rectangles, polygons, circles, arcs, ellipses, smooth curves, points, text, four kinds of dimension, labelled arrows and simple fills; and the editing tools: move, copy, rotate, scale, mirror, offset, cut back, extend, round or bevel corners, join, break, stretch, repeat in rows or around a centre, and break apart.

  3. 3.

    Snapping to the exact ends, middles, centres and quarter points of shapes, to where lines and curves cross, and to the nearest, square-on or touching point from a starting point; plus layers that can be hidden, locked, coloured and given line styles and thicknesses.

  4. 4.

    A carefully defined handover between the engine and the app: each drawing has one owner that handles requests one at a time, requests go in as text, and the shapes come back as compact lists of numbers that the app copies before handing them back.

  5. 5.

    A drawing surface on the graphics chip that measures everything from where you are looking, so the chip can use its fast, less precise numbers while the drawing keeps its full precision; plus a command line with history and auto-complete that accepts typed coordinates, and a panel for properties and layers.

  6. 6.

    Its own file format, which upgrades files from the earlier version, saved safely and automatically the way Mac apps do, and printing to PDF on any standard paper size, at an exact scale or fitted to the page, in colour or black and white, with line thicknesses.

  7. 7.

    Importing that tells you what it lost: a reader for the open format that reports everything it left out or simplified, a limited exporter, and the closed format converted by a bundled open-source converter in a separate program that is stopped after thirty seconds, never touching the original file.

  8. 8.

    Distribution without an app store: an installer, updates checked against MacCAD’s own signature, a separate download for each version, checksums for every file, and the full source code, including what it depends on, published with each release as its licence requires.

outcome

About 6,700 lines of code, with 30 automated tests covering curves, corners, history, selection, snapping, file upgrades and the open format; all of them pass. On a recent Mac its own benchmark files 100,000 lines in about 16 thousandths of a second, prepares the whole scene in about 9, and answers a thousand clicks in about a third of a thousandth; those are times for the main processor, not for drawing frames on screen. Not done yet: saving in the closed format, multi-sheet layouts, linked drawings, dimensions that follow their shapes, and testing on real professional drawings.

It is an early preview and says so: everything it can do can be drawn, edited, undone and saved properly, and everything it cannot do yet, from saving in the most common professional format to multi-sheet layouts, is listed openly rather than implied.