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 🙏

© 2025 – Pkg Stats / Ryan Hefner

replicad-threads

v1.1.0

Published

Helper function to create threads using replicad

Readme

Replicad thread

A small library to build threads using replicad.

This is a library based on replicad.

This library contains a set of helpers to create thread for your 3D models.

As a library

This module can be used either as a library:

pnpm install replicad-threads

Within the replicad studio

You can also import it within the replicad studio:

import { makeThread } from "https://cdn.jsdelivr.net/npm/replicad-threads@latest/dist/studio/replicad-threads.js";

/** @typedef { typeof import("replicad") } replicadLib */
/** @type {replicadLib} */
const { makeCylinder } = replicad;

export default function main() {
  const thread = makeThread({
    pitch: 5,
    radius: 10,
    height: 20,
    rootWidth: 3,
    apexWidth: 1,
    toothHeight: 1,
  });
  return thread.translate(0, 0, 1).fuse(makeCylinder(10, 22));
}

API

makeThread({ pitch, radius, height, rootWidth, apexWidth, toothHeight })

Creates a thread shape. The thread is a helix with a trapezoidal profile, with the following parameters:

  • pitch: the distance between two consecutive threads.
  • radius: the base radius of the thread.
  • height: the height of the thread.
  • rootWidth: the width of the thread profile at the root (the radius)
  • apexWidth: the width of the thread profile at the apex (the radius + toothHeight)
  • toothHeight: the height of the tooth. A negative value will create an internal thread.

This thread will get small at the beginning and end of the thread. There are additional function to create alternative shapes:

  • makeRawThread: creates a thread with a blunt end.
  • makeChamferedThread: creates a thread with a chamfered end.

trapezoidalThreadConfig(pitch, threadAngle, external: true)

Creates a partial configuration (you need to provide the radius and the height).

trapezoidalThreadConfigConjugate(threadConfig, clearance)

Creates a conjugate thread configuration. This is useful to create the corresponding internal thread from an external one (or vice versa). You can add an offset which will be added to the radius to allow for some tolerance.

metricThreadConfig(name, height, external, clearance)

Creates a thread configuration for a metric thread. The name is the name of the thread (e.g. "M6") and the height is the height of the thread. Note that external and internal threads have different configurations, you will use this function with external: true for external threads and external: false for internal threads.

addClearance(threadConfig, clearance)

Adds a clearance to a thread configuration. This is useful to create a thread that will fit into another one (especially for 3D printing). This function is used by the previous ones if you specify a clearance.

Example

You can find a full example in the ./example directory. See what it look here.