scad-utils for OpenSCAD

repository·master·Indexed 41 days ago

https://github.com/openscad/scad-utils

A collection of utility libraries for OpenSCAD featuring the Morphology module for 2D shape operations (inset, outset, fillet, rounding, and shell) and the Mirror module for simplified mirroring along the X, Y, and Z axes.

Tokens
451
Snippets
2
Records
2
Agent score
2%

What's inside scad-utils

  1. Use 2D morphology operations in OpenSCAD

    master

    The Morphology module provides functions to manipulate 2D shapes through offsets, rounding, and shelling. These functions are designed to be used as wrappers around 2D shapes (like polygon).

    Available Functions:

    • inset(d=1): Creates a polygon at an offset d inside a 2D shape.
    • outset(d=1): Creates a polygon at an offset d outside a 2D shape.
    • fillet(r=1): Adds fillets of radius r to all concave corners of a 2D shape.
    • rounding(r=1): Adds rounding to all convex corners of a 2D shape.
    • shell(d, center=false): Creates a shell of width d along the edge of a 2D shape.
      • Positive d: Shell is placed on the outside.
      • Negative d: Shell is placed on the inside.
      • center=true and positive d: Shell is centered on the edge.
    module shape() {
        polygon([[0,0],[1,0],[1.5,1],[2.5,1],[2,-1],[0,-1]]);
    }
    
    $fn=32;
    
    // Examples of usage:
    inset(d=0.3) shape();
    outset(d=0.3) shape();
    rounding(r=0.3) shape();
    fillet(r=0.3) shape();
    shell(d=0.3) shape();
    shell(d=-0.3) shape();
    shell(d=0.3, center=true) shape();
  2. Use mirroring functions for 2D/3D shapes

    master

    The Mirror module provides simple functions to mirror objects along the primary axes.

    Available Functions:

    • mirror_x()
    • mirror_y()
    • mirror_z()
    module arrow(l=1,w=.6,t=0.15) {
        mirror_y() polygon([[0,0],[l,0],[l-w/2,w/2],[l-w/2-sqrt(2)*t,w/2],[l-t/2-sqrt(2)*t,t/2],[0,t/2]]);
    }