sgenoud / replicad-shrink-wrap

A replicad library to create a hull out of drawings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

replicad shrink wrap

This is a library based on replicad.

This library contains a set of helpers to shrink wrap a drawing. This corresponds to the hull operation in some CAD software.

As a library

This module can be used either as a library:

pnpm install replicad-shrink-wrap

Within the replicad studio

You can also import it within the replicad studio:

import shrinkWrap from "https://cdn.jsdelivr.net/npm/replicad-shrink-wrap/dist/studio/replicad-shrink-wrap.js";
/** @typedef { typeof import("replicad") } replicadLib */
/** @type {replicadLib} */
const { drawRoundedRectangle, drawCircle, draw } = replicad;

export default function main() {
  const circle = drawCircle(7).translate(8, 18);
  const rect = drawRoundedRectangle(20, 14, 5);

  return [
    { shape: rect, color: "silver" },
    { shape: circle, color: "silver" },
    shrinkWrap(rect.fuse(circle), 50),
  ];
}

Go an play with it there

About

A replicad library to create a hull out of drawings

License:MIT License


Languages

Language:JavaScript 100.0%