negative-support
v0.4.10
Published
Generate 3D-print negative-space support structures from STL, OBJ, or STEP files
Maintainers
Readme
negative-support — Negative-Space 3D Print Support Generator
Generates model-conforming support structures for 3D printing. Unlike slicer-generated tree or grid supports, these are negative-space supports — exact shapes created by subtracting the model from a surrounding block, producing solid mesh that conforms to the model's actual surface contours.
Available on npm and as a browser app at negative.support/generate.
Install
npm install -g negative-supportOr run directly with npx:
npx negative-support model.stlUsage
negative-support model.step # STEP with B-Rep overhang detection
negative-support model.stl # STL with triangle-normal overhang detection
negative-support model.obj -m 0.15 -a 40 # tighter margin + stricter angle
negative-support model.step --3mf # 3MF with model + supports + slicer settings
negative-support model.stl -o out.stl # custom output path
negative-support model.stl -q # quiet mode for scriptingOptions
| Flag | Default | Description |
| ----------------------- | ---------------------- | -------------------------------- |
| -o, --output <path> | <input>_supports.stl | Output path |
| -m, --margin <mm> | 0.2 | Gap between supports and model |
| -a, --angle <degrees> | 45 | Overhang angle threshold |
| --min-volume <mm³> | 1.0 | Discard pieces smaller than this |
| --3mf | | Export 3MF with model + supports |
| -q, --quiet | | Suppress progress display |
| --version | | Show version |
| --status | | Show license status |
| --activate <token> | | Activate license token |
How It Works
1. Overhang Detection
Both STEP and mesh files produce targeted per-region supports through overhang detection:
- STEP files (
.step/.stp) — B-Rep face topology provides exact face boundaries and normals via occt-import-js. Each face with a downward normal steeper than the angle threshold becomes a support region. - Mesh files (
.stl/.obj) — Triangle normals are computed per-face, then adjacent overhang triangles are clustered via BFS flood fill over shared edges. Each cluster becomes a support region, producing results comparable to STEP.
2. Support Generation
For each overhang region:
- Bounding box column — A vertical column is extracted from the region's AABB, extending down to the build plate
- Negative space — The inflated model (offset outward by
marginalong vertex normals) is subtracted from the column using boolean operations (manifold-3d) - Decomposition — The resulting shape is split into separate pieces
- Filtering — Pieces smaller than
minVolumeor not touching the build plate are discarded - Merge — Overlapping pieces from adjacent regions are merged via geometric intersection testing
3. Output
- STL (default) — All support pieces merged into a single binary STL
- 3MF (
--3mf) — Model + individual support pieces as separate objects with per-piece slicer settings (1 wall, 10% cubic infill)
API
Call activate() with your license token before generating. The token is the same one you use for the CLI.
import { generateSupports, activate } from 'negative-support'
import { readFileSync, writeFileSync } from 'fs'
await activate('ns_live_...')
const buffer = readFileSync('model.stl').buffer
const result = await generateSupports(buffer, {
format: 'stl',
margin: 0.2,
angle: 45,
})
writeFileSync('supports.stl', Buffer.from(result.stl))
console.log(result.stats) // { pieces, faces, volume }generateSupports() will throw if called without activation or if the free tier is exhausted. result.supportPieces contains individual ParsedMesh objects for custom export or 3MF packaging.
Documentation
Full docs at negative.support/docs.
Development
git clone --recurse-submodules https://github.com/drcmda/negative-support
npm install
npm run dev # Frontend dev server on :5173
npm run dev:server # API dev server on :8787
npm test # Full test suite
npm run build # Build frontend
npm run deploy # Build frontend + deploy to CloudflareLicense
See negative.support for licensing details.
