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 🙏

© 2024 – Pkg Stats / Ryan Hefner

jscad-threadlib

v0.0.3

Published

JSCAD threadlib allows you to create threads in JSCAD designs by picking a standard thread from the built in thread table or specify your own thread parameters. It is a port of the OpenSCAD thread library [threadlib](https://github.com/adrianschlatter/thr

Downloads

8

Readme

JSCAD threadlib

JSCAD threadlib allows you to create threads in JSCAD designs by picking a standard thread from the built in thread table or specify your own thread parameters. It is a port of the OpenSCAD thread library threadlib to JSCAD.

Installation

Depending on how you use JSCAD, you need to either install jscad-threadlib using npm or require it in your JSCAD design. Then you can call the thread function with the desired thread parameters.

npm install jscad-threadlib
import { thread } from "jscad-threadlib";

When using jscad-threadlib in jscad.app, you can use require, no need to install anything. The package will be downloaded automatically from a CDN.

const { thread } = require("jscad-threadlib");

Usage

The thread function takes either a string with a designator for a standard thread or an array with thread parameters:

Using a standard thread:

const thread1 = thread({
  thread: "PCO-1810-ext", // PET bottle thread
  turns: 3,
});

You can find a list of all supported standard threads in the here.

If you want to contribute a thread, please read the contribution guidelines, open a pull request to the original OpecnSCAD threadlib repository and let me know in an issue.

Specifying your own thread specification:

// Specifying thread parameters
const myThreadSpecs = [
  3.18, // Pitch (mm)
  12.055, // Rotation Radius (mm)
  24.51, // Support Diameter (mm)
  [
    [0, -1.13],
    [0, 1.13],
    [1.66, 0.5258],
    [1.66, -0.5258],
  ], // Section Profile (mm, Points[])
];

const thread2 = thread({
  thread: myThreadSpecs,
  turns: 3,
  higbeeArc: 20,
  segments: 120,
});

Bolt and Nut Example

You can use the bolt and nut functions to create a bolt and a nut with matching threads. The bolt function takes the same parameters as the thread function. The nut function has an additional outerRadius parameter.

Currently you need to select the correct thread designator (suffix -ext for bolts and -int for nuts) manually.

const myBolt = bolt({
  thread: "PCO-1810-ext",
  turns: turns,
});

const supportDiameter = getThreadSpecs(threadDesignator)[2];

const myNut = nut({
  thread: "PCO-1810-int",
  turns: turns,
  outerRadius: supportDiameter + 3,
});