New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

replicad-threads

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replicad-threads

Helper function to create threads using replicad

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

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.

FAQs

Package last updated on 07 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts