npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@richardmcquiston01/more-open-scad

v0.2.0

Published

Framework agnostic TypeScript based package for generating STL files using commands similar to OpenSCAD.

Readme

MoreOpenSCAD

Overview

Framework agnostic TypeScript based package for generating STL files using commands similar to OpenSCAD. Distributable via NPM for inclusion in TypeScript projects.

Prerequisites

  • Node.js 18+ or Bun 1.0+
  • TypeScript 5+ (for consuming projects that want type checking)

Installation

bun add @richardmcquiston01/more-open-scad
# or
npm install @richardmcquiston01/more-open-scad

Usage

Build a shape with a primitive, chain transforms onto it, then export it to STL.

import { cube, Vec3, toBinarySTL } from '@richardmcquiston01/more-open-scad';

const shape = cube(20, { center: true })
  .translate(Vec3.vec3(0, 0, 10))
  .rotateAxisAngle(Vec3.vec3(0, 0, 1), Math.PI / 4);

const stl = toBinarySTL(shape); // Uint8Array

Primitives

cube(size, options?), sphere(r, options?), cylinder(h, options?), and polyhedron(points, faces) (the arbitrary-mesh escape hatch) each build a Solid, matching OpenSCAD's semantics for the same primitive. See each function's JSDoc for its options (center, fn, r/r1/r2, etc.).

Transforms

Every Solid has chainable, immutable transform methods: translate, rotate (Euler angles), rotateAxisAngle, scale (uniform or per-axis), mirror, and multmatrix (an arbitrary 4x4 transform, for anything the named methods don't cover). Each call returns a new Solid — none of them mutate the original.

Boolean operations

union(a, b), difference(a, b), and intersect(a, b) combine two solids into a new one, matching OpenSCAD's union()/difference()/intersection():

import { cube, difference, Vec3 } from '@richardmcquiston01/more-open-scad';

const block = cube(20, { center: true });
const hole = cube(8, { center: true }).translate(Vec3.vec3(0, 0, 6));

const blockWithHole = difference(block, hole);

Neither input Solid is mutated; each call returns a new one. Combine more than two solids by chaining calls, e.g. union(union(a, b), c).

Exporting to STL

toBinarySTL(solid) returns a Uint8Array (the binary STL format); toASCIISTL(solid, name?) returns a string (the ASCII STL format). Neither writes to disk — this package stays framework-agnostic by handing back bytes/text and leaving file I/O to you:

Node.js:

import { writeFileSync } from 'node:fs';
import { cube, toBinarySTL } from '@richardmcquiston01/more-open-scad';

writeFileSync('cube.stl', toBinarySTL(cube(20, { center: true })));

Browser (trigger a download):

import { cube, toBinarySTL } from '@richardmcquiston01/more-open-scad';

const stl = toBinarySTL(cube(20, { center: true }));
const url = URL.createObjectURL(new Blob([stl], { type: 'model/stl' }));

const link = document.createElement('a');
link.href = url;
link.download = 'cube.stl';
link.click();
URL.revokeObjectURL(url);

Before exporting, isManifold(solid) checks whether a Solid is watertight (every edge shared by exactly two triangles wound in opposite directions) — useful as a sanity check that geometry is 3D-print-ready.

License

MIT

Copyright

(c) 2026 Richard McQuiston.

Buy Me a Coffee

If this app, code, or repository has helped you or someone you know, please consider donating. I appreciate any help to offset the costs of development and/or AI Credits.

Donate via Stripe, or scan:

Donate via Stripe