ZipToolView zip files online — 100% private

How we put four CAD engines in a browser tab

It started with a feature request of six words — support previewing CAD and circuit-diagram files — and an uncomfortable realization: ZipTool already met these files every day. Engineering deliverables travel as archives. A zipped board release is Gerbers plus a drill file plus the schematic; a mechanical handoff is a STEP model sitting next to the drawing that dimensions it. Our viewer would open the zip, list every entry, and then shrug at all of it — every one of those files rendered as "binary, nothing to show." A tool whose entire pitch is your files never leave your machine was quietly telling engineers to upload theirs somewhere else.

This post is the log of fixing that in one wave: four format families — DXF drawings, Gerber and Excellon fabrication files, KiCad schematics and boards, STEP/IGES solid models — each with its own engine, its own integration story, and its own way of failing silently. As with the 4 GB post, the register is engineering log: numbers with sources, traps included, limits stated at the end.

The short version: drop a .dxf, .gtl, .kicad_pcb, or .step on the tool today and it renders — a WebGL drawing with a layer panel, copper as crisp vector graphics at true board scale, a full schematic on a real canvas, and a B-rep solid you can orbit with its assembly intact. All four engines run in the tab; after the page loads you can go offline. The feature pages — DXF, Gerber, KiCad, STEP — are the user-facing half; this is the how.

Four formats that share an audience and nothing else

"CAD file" is a user word. It names a job — I received an engineering file and need to see it — and behind it sit format families with no common substrate: not the same syntax, not the same era, not even the same idea of what a file is. The first job of the wave was refusing to design for the word and instead looking at the four things actually inside the archives our users open.

DXF is text, and structurally dull in the best way. Drawing Exchange Format arrived with AutoCAD in 1982, and its entire grammar is an alternation: a numeric group code saying what the next line means, then the line. Code 0 names an entity, 8 a layer, 10/20/30 a center's X/Y/Z, 40 a radius. A weekend parser covers it. The weight lives above the grammar — entities referencing layers, linetypes, and dimension styles — and in one detail that surprised us: text entities want a real font to draw against, which is why the DXF engine fetches a 757 KB typeface before it renders its first annotation.

Gerber is not a drawing format at all. RS-274X is the command language of photoplotters — the machines that exposed the film used to fabricate circuit boards, one flash at a time. A Gerber file is a machine program: select aperture, move with the light off, draw with it on, flash. The image is what executing the program implies. The PCB world adds its own convention on top: file contents are nearly anonymous, and identity lives in the filename — .gtl is top copper, .gbl bottom copper, .gts the solder mask, .drl the drill tape. A board release is a folder of near-identical command streams whose names carry the meaning. Reading those names is a solved problem — the whats-that-gerber library is essentially a dictionary of the convention — and we lean on it.

KiCad files are an application, not a format. The schematic and board files are s-expressions — parenthesized property trees, textually trivial — but rendering one means re-implementing the drawing rules of an entire EDA application: symbol libraries, junction dots, zone fills, silk and copper as separate stacked passes. Nobody should hand-roll that, and we did not.

STEP is mathematics, not a drawing. ISO 10303 describes solids as boundary representation — exact surfaces, true curves, an assembly tree, units, colors. A STEP file does not say "draw these triangles"; it says "here is a cylinder of radius r on this axis, filleted thus," and any picture of it must be computed: tessellated from exact geometry into triangles at a controlled tolerance. That computation is a geometry kernel's day job. IGES — the 1980-vintage predecessor with its fixed 80-column records — is the same problem in an older coat.

DXF: a numeric group code, then its value, forever — here, a circle on a layer
  0
CIRCLE
  8
FLANGE-BASE
 10
45.0
 20
45.0
 30
0.0
 40
12.5
Gerber: a photoplotter program — format spec, millimeters, a 0.15 mm round aperture, then a move with the light off (D02) and a draw with it on (D01)
%FSLAX34Y34*%
G04 coordinates: absolute, 3.4 decimals*
%MOMM*%
%ADD10C,0.150000*%
D10*
X21590000Y-12700000D02*
X31750000Y-12700000D01*
  • DXF (1982): group-code/value text pairs — a weekend parser, plus a real font (757 KB) for text entities.
  • Gerber/Excellon: photoplotter and drill-machine command streams; identity lives in filenames (.gtl, .gbl, .drl…), read by convention.
  • KiCad: s-expression trees that need a whole EDA application's rendering rules — reuse one, do not re-implement it.
  • STEP/IGES: exact B-rep solids; any display requires tessellation by a geometry kernel (Open CASCADE, here as WebAssembly).

Four engines, four shapes of integration

One engine per family, each chosen for what the family actually is. DXF runs through dxf-viewer (MPL-2.0), which parses the group-code pairs into batched WebGL geometry — pan and zoom come free on the GPU, and layers arrive as the toggles mechanical people expect. Gerber runs through gerber-to-svg (MIT), and the fit is almost comically good: a photoplotter command stream maps close to one-to-one onto vector graphics. Aperture flashes become shapes, draws become strokes, and the finished board arrives as an SVG the browser renders natively — at the true extents reported from the coordinates, not an estimate. The entire engine is 177 KB.

KiCad runs through KiCanvas (MIT): a complete EDA renderer compiled into a 477 KB custom element. You hand it file content; it hands back a canvas with pan, zoom, and selection — an application nested in the page rather than a library you call. STEP and IGES run through occt-import-js (LGPL-2.1): Open CASCADE — the geometry kernel FreeCAD is built on — compiled to WebAssembly, about 7 MB, downloaded the first time a solid arrives and cached by the browser thereafter. It reads the B-rep, tessellates each face, and returns a mesh hierarchy carrying per-part colors, which we walk into the same three.js stage as the STL viewer — the example assembly arrives as 18 separately colored solids with the tree intact.

The payload discipline is the same one the rest of the tool follows: every engine loads behind first use. Zero engine bytes ride in any page's first load — the 4 GB post's budget rules apply unchanged — and each engine caches independently of the app bundle, so a CAD-curious visitor who never drops a STEP file never downloads a geometry kernel.

the assembly walk — the kernel's mesh tree into the existing 3D stage (simplified)
const result = await occt.ReadStepFile(bytes, null) // exact B-rep in
// result.meshes[] — one tessellated mesh per solid
// result.root     — the assembly tree, with transforms and colors

function toGroup(node) {
  const group = new THREE.Group()
  if (node.mesh) {
    group.add(new THREE.Mesh(
      toGeometry(node.mesh), // positions, normals, indices
      new THREE.MeshStandardMaterial({ color: node.color }),
    ))
  }
  for (const child of node.children ?? []) group.add(toGroup(child))
  return group
}
  • dxf-viewer (MPL-2.0): group pairs → batched WebGL; layers as toggles; a 757 KB font for annotations.
  • gerber-to-svg (MIT): plotter commands → SVG primitives, near 1:1; board size from actual coordinate extents. 177 KB.
  • KiCanvas (MIT): a full EDA renderer as a 477 KB custom element — reuse the application, do not re-implement it.
  • occt-import-js (LGPL-2.1): Open CASCADE as ~7 MB wasm, first-use download, cached; B-rep → mesh tree with colors, into the existing three.js stage.
  • All four lazy: zero engine bytes at page load; the first-byte budget is unchanged.

The traps that failed silently

None of the four integrations ever failed loudly. Every bug in this wave had the same shape: the code ran, nothing surfaced, and the feature simply did not exist. Five traps, each worth a debug round:

The npm package is not the browser build. gerber-to-svg's package entry points at its Node build — readable-streams and Buffer — which warns and then throws under a browser bundler. The browser build ships in the same package as dist/gerber-to-svg.min.js, and it is a var-assignment UMD: it assigns a global and exports nothing, so importing it as a module resolves to an empty module. The working integration is a classic <script> tag and a read of the global. The lesson generalizes to any engine integration: read the package's dist/ before trusting its package.json.

The bundler's public-directory ban. Vite refuses module imports of anything under the site's static directory — those files are copied verbatim, never processed, and the error is a hard one even when you ask politely with an ignore comment. Self-hosted engine bundles therefore load as classic scripts, which turns out to be the better shape anyway: the engines never enter the application bundle's dependency graph, cannot regress its size, and cache independently of it.

A virtual filesystem that routes by filename. KiCanvas accepts files through an internal VFS that decides how to handle each one by its name and extension. A browser blob URL's name is a UUID with no extension — hand the element a blob: link and the file never routes anywhere: no error, no log, nothing. The fix hands over the content instead of a URL, as an inline <kicanvas-source name="board.kicad_pcb"> element carrying the file's text. A related quirk: the element reports success by setting a boolean loaded attribute and reports failure by doing nothing at all — so "did it render" is answered with a MutationObserver and a timeout, not a promise.

Theme names that fall back silently. KiCanvas takes a theme attribute, and light is not one of its values. The real names are kicad (light, native look) and witchhazel (dark — the default). Ask for light and you get dark, without a warning. We know because our first theme test looked broken in exactly the direction an invalid enum falls back to, and the "bug" was the fallback, not the renderer.

Our own front door. The last trap was ours. Every file entering the tool passes a classifier that decides what the dropped thing is — and a viewer the classifier does not know about is refused silently: no error, no console line, the file just does not appear. Until the classifier learned the new extensions, every example button on all four new pages was dead, and nothing anywhere said why. A new viewer touches a handful of wiring points — format sniffer, viewer dispatcher, type registry, that classifier — and all of them fail loudly when forgotten except the last one, which fails by silence, first.

trap 1 — the browser build exports nothing; classic script + global (as shipped)
// package.json "main" is the Node build (readable-stream + Buffer —
// it throws under a bundler). The dist/ browser build is a
// var-assignment UMD: importing it as a module gives you nothing.
await loadScript('/gerber-viewer/gerber-to-svg.min.js')
const convert = window.gerberToSvg // the only door in
const report = convert(gerberText, { color: '#0f172a' }, (err, svg) => {
  // svg: the finished board as vector graphics
  // report: { units, width, height } — the true board extents
})
trap 3 — hand over the content, not a blob URL (as shipped)
<!-- A blob: URL's "name" is a UUID with no extension — the engine's
     VFS routes by filename, so the file never arrives anywhere. -->
<kicanvas-embed controls="basic" controlslist="nodownload"
               theme="witchhazel" zoom="objects">
  <kicanvas-source name="board.kicad_pcb">
    (the file's text, inline — success is a boolean "loaded" attribute
     observed with a MutationObserver, because failure is silent)
  </kicanvas-source>
</kicanvas-embed>
  • gerber-to-svg's npm entry is the Node build; the browser build is an exports-free UMD — classic <script> + global.
  • Vite hard-bans module imports of the static directory — engine bundles load as classic scripts and stay out of the app graph.
  • KiCanvas' VFS routes by filename; blob URLs have UUID names — inline the content as <kicanvas-source> instead.
  • KiCanvas themes are named kicad and witchhazel; unknown names fall back to dark, silently.
  • Our loose-file classifier refuses unknown viewers without a sound — the wiring point that fails by silence, and the first one a file meets.

Demo files: why we don't ship a toy square

The temptation after wiring a viewer is to draw a square and ship it. A toy file exercises the happy path and nothing else — no layer conventions, no unit flavors, no fonts, no assembly colors — and engineers can tell at a glance that it is fake, which quietly un-ships the claim that this is a viewer for their files.

What ships instead: the Gerber and drill examples are production fabrication layers of the Tomu FPGA board — a real open-source hardware project, Apache-2.0. The KiCad examples are the schematic from KiCanvas' own documentation plus the Tomu board layout, both MIT. The STEP example is the AS1 assembly from the CAx-IF STEP interoperability library — the industry's standard torture model for STEP readers: a base plate, two brackets, bolts, and a shaft; 18 parts in a 433 KB file, each carrying its color.

The DXF example is the honest exception: we generated it ourselves — a flange-plate drawing built by a script in the repository on the ezdxf library, exercising lines, arcs, circles, center lines, dimensions with arrowheads, and multiple layers — because the licensed fixture we had rendered as four lonely dimension annotations: technically correct, visually indistinguishable from a broken viewer. Every redistributed file's origin and license is recorded in a public provenance document, and each engine's license text ships beside its bytes.

  • Toy demos exercise the happy path; engineers recognize real artifacts at a glance — that recognition is the claim.
  • Gerber/drill: Tomu FPGA production layers (Apache-2.0). KiCad: KiCanvas demo schematic + Tomu layout (MIT).
  • STEP: the CAx-IF AS1 conformance assembly — 18 parts, per-part colors, 433 KB.
  • DXF: self-generated flange-plate (in-repo script, ezdxf) — the available fixture rendered as four lone annotations.
  • Provenance doc lists every file's origin; license texts ship beside every engine (MPL-2.0 / MIT / MIT / LGPL-2.1).

The privacy argument, sharpened

ZipTool's pitch holds for any file, but CAD is the sharpest case in the building: supplier parts under NDA, unreleased product geometry, a board design weeks from tape-out. These are files whose owners would rather not open them at all than open them on someone else's server — and the standard answer to "quick look at a STEP" has been exactly that, an upload. The tests from the privacy post apply here verbatim: load the page, go offline, then drop the model. Everything still works — parse, tessellate, render — because everything runs in the tab.

The one heavyweight is the kernel: about 7 MB of WebAssembly, downloaded the first time a solid model arrives and cached by the browser afterwards. That is the entire recurring cost of exact B-rep geometry on your machine instead of your model on someone else's server. The other three engines run 177 KB to 757 KB, and none of them loads until the corresponding file does.

  • CAD is the sharpest privacy case: NDA parts, unreleased geometry, pre-tape-out boards — the audience that cannot use upload viewers at all.
  • Offline after page load: parse, tessellate, and render all in-tab; the two-minute tests from the privacy post apply verbatim.
  • Heaviest single download: the ~7 MB geometry kernel, once, then cached. Everything else is sub-megabyte and lazy.

What it still does not do

An engineering log that omits the walls is marketing, so: DWG is refused, on purpose. AutoCAD's native format is undocumented binary that changes shape between releases; a viewer that half-decodes it produces confident wrong renders, which is worse than a refusal. The honest path is a real export — AutoCAD's own DXF export, or any free desktop tool — which produces a DXF this viewer opens.

Old KiCad files are declined too. KiCad 6+ formats are the supported surface; older files upgrade cleanly by re-saving them in a current KiCad, and half-rendering them would repeat the DWG mistake. And it views; it does not measure — no dimensioning, no GD&T/PMI display on STEP, no editing. The screen is honest about being tessellated: the data is exact, the display is triangles computed from it at a sensible tolerance, and zoomed far enough in, facet edges can appear on curved surfaces.

Size caps produce clear refusals rather than a frozen tab: 64 MB for DXF, 32 MB for Gerber, 128 MB for solids. Past those, the viewer says no with a message, instead of saying nothing while the tab dies.

  • DWG: declined on purpose — undocumented, release-varying binary; half-decoding yields confident wrong renders. Export a DXF instead.
  • KiCad 6+ only; older files re-save cleanly in a current KiCad.
  • View, not measure: no dimensioning, no PMI; tessellated display of exact data (facets visible at extreme zoom).
  • Caps of 64 MB (DXF) / 32 MB (Gerber) / 128 MB (solids) — honest refusals, not hung tabs.

Speak the languages inside the archive

Engineering files travel as archives — that was true when the request arrived, and it is why a zip viewer kept meeting CAD it could not show. The tool now speaks the four languages that arrive inside them: the drawing, the board, the schematic, and the solid. The pages — DXF viewer, Gerber viewer, KiCad viewer, STEP viewer — are the user-facing half; the engines, the traps, and the demo provenance are this post.

The through-line with the 4 GB post and the privacy post is one architecture wearing different clothes: move the work into the tab, and the properties users actually want — no upload, no size invoice, no server to trust — stop being promises and become consequences. Drop a file on any of the four pages and pull your network cable. That test never gets old for us either.

  • Engineering files travel as archives; the viewer now speaks drawing (DXF), board (Gerber/Excellon), schematic (KiCad), and solid (STEP/IGES).
  • Same architecture as the 4 GB and privacy posts: work in the tab, and the guarantees become consequences.
  • Try it: any of the four pages, offline, with your own file — the two-minute test from the privacy post.