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

swcad-js

v0.14.2

Published

Salvador Workshop's JSCAD utilities and toolkit

Readme

swcad-js

Salvador Workshop's CAD coding tools (in JavaScript)


swcad-js demo - arch-foils

Overview

Online viewer

sw-jscad-viewer.netlify.app

A heavily customized version of the JSCAD UI (https://github.com/hrgdavor/jscadui)

API Docs

salvador-workshop.github.io/swcad-js/

Repository

github.com/salvador-workshop/swcad-js/

NPM package

npmjs.com/package/swcad-js

swcad-js demo - walls-entryway

Usage

Works with JSCAD, however you consume it.

Try copying the example below into sw-jscad-viewer (sw-jscad-viewer.netlify.app).

/* ----------------------------------------
 * Initialization
 * ------------------------------------- */

const jscad = require('@jscad/modeling')

const { cuboid } = jscad.primitives
const { translate } = jscad.transforms

const swcadJs = require('swcad-js').init({ jscad });
console.log('swcadJs', swcadJs)

const {
  math,
  transform,
} = swcadJs.calcs

const {
  colors,
} = swcadJs.utils

const {
  openWebJoist,
} = swcadJs.components

const {
  routedCuboid,
} = swcadJs.components.routedShapes


//==============================================================================


/* ----------------------------------------
 * Model / Scene Prep
 * ------------------------------------- */

// "INTRO" PLINTH

const introPlinthSize = [
  math.inchesToMm(4),
  math.inchesToMm(4),
  math.inchesToMm(5),
]

const endBlockSize = [
  introPlinthSize[0],
  introPlinthSize[1],
  introPlinthSize[2] / 4,
]

const midBlockOverhang = math.inchesToMm(5 / 8)

const midBlockSize = [
  introPlinthSize[0] - (midBlockOverhang * 2),
  introPlinthSize[1] - (midBlockOverhang * 2),
  introPlinthSize[2] / 2,
]

// Midsection is built with jscad
// Top and Bottom ends are built with swcad-js

const mid = cuboid({ size: midBlockSize })

const baseOpts = {
  size: endBlockSize,
  topBit: 'chamfer',
  topBitOpts: {
    radius1: 6,
    radius2: 8,
    offset1: 3,
    offset2: 2,
    offset3: 3,
    offset4: 2,
  },
  bottomBit: 'none',
  bottomBitOpts: {
  },
}

const baseData = routedCuboid(baseOpts)
const base = baseData[0]

const topOpts = {
  size: endBlockSize,
  topBit: 'roundOver',
  topBitOpts: {
    radius1: 3,
    radius2: 4,
    offset1: 1.5,
    offset2: 1.5,
  },
  bottomBit: 'cove',
  bottomBitOpts: {
    radius1: 6,
    radius2: 8,
    offset1: 2.5,
    offset2: 2.5,
    offset3: 2.5,
    offset4: 2.5,
  },
}

const topData = routedCuboid(topOpts)
const top = topData[0]

// The library also has helper functions

const introPlinth = transform.stack({}, [base, mid, top])

// OPEN WEB JOIST

const openWebJoistOpts1 = {
  length: math.inchesToMm(6),
  width: math.inchesToMm(1.25),
}

const openWebJoistOpts2 = {
  length: math.inchesToMm(6.5),
  width: math.inchesToMm(1.5),
  reinforcementLevel: 2
}

const openWebJoistData1 = openWebJoist(openWebJoistOpts1)
const openWebJoistData2 = openWebJoist(openWebJoistOpts2)

const openWebJoistModel1 = openWebJoistData1[0]
const openWebJoistModel2 = openWebJoistData2[0]


//==============================================================================


/* ----------------------------------------
 * Main function for JSCAD
 * ------------------------------------- */


function main() {
  const spaceUnit = math.inchesToMm(4)

  return [
    translate([spaceUnit * 0, spaceUnit * 0, spaceUnit * 0], introPlinth),
    translate([spaceUnit * 1, spaceUnit * 0, spaceUnit * 0], openWebJoistModel1),
    translate([spaceUnit * 2, spaceUnit * 0, spaceUnit * 0], openWebJoistModel2),
  ]
}

module.exports = { main }

swcad-js demo - plinth + joist

API

as of version 0.12.5

The swcad-js library's main functional divisions:

Data — Static info

  • constants
  • functions
  • specifications
  • standards
  • standards.crafts
  • standards.lumber
  • standards.masonry
  • standards.paper
  • standards.tiles

Calcs — Calculations of all sorts

  • geometry
  • geometry.points
  • geometry.regPoly
  • geometry.reinforcement
  • math
  • position
  • position.cuboid
  • position.rectangle
  • position.triangle
  • transform

Profiles — 2D profiles, surfaces, sections

  • beadsBits.corner
  • connections
  • curve
  • shapes
  • shapes.ellipse
  • shapes.rectangle
  • shapes.square
  • shapes.triangle
  • structure.arch
  • structure.foil
  • structure.mesh
  • text
  • trim
  • trim.aranea

swcad-js demo - router-bits

ProfileSpec — 2D profiles conforming to specs

  • lumber
  • paper

Components — Basic reusable 3D units

  • beadsBits
  • beadsBits.corner
  • mesh
  • moulding
  • routedShapes
  • text

swcad-js demo - routed shapes 1

swcad-js demo - routed shapes 2

ComponentSpec — 3D components conforming to specs

  • brick
  • crafts
  • tile

Models — Complex 3D models

  • arch
  • foil
  • structure
  • structure.wall
  • structure.wallEntryway

Utils — Auxiliary utilities

  • colors
  • layout
  • palette

Structure

swcad-js demo - joist

Internally, the library is split into several packages that follow the main API divisions:

swcad-js-calcs — Calculations of all sorts

swcad-js-component-spec — 3D components conforming to specs

swcad-js-components — Basic reusable 3D units

swcad-js-core — Integrates all these packages together into the final package

swcad-js-data — Static info

swcad-js-models — Complex 3D models

swcad-js-profile-spec — 2D profiles conforming to specs

swcad-js-profiles — 2D profiles, surfaces, sections

swcad-js-utils — Auxiliary utilities