Use 2D morphology operations in OpenSCAD
masterThe 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 offsetdinside a 2D shape.outset(d=1): Creates a polygon at an offsetdoutside a 2D shape.fillet(r=1): Adds fillets of radiusrto 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 widthdalong the edge of a 2D shape.- Positive
d: Shell is placed on the outside. - Negative
d: Shell is placed on the inside. center=trueand positived: Shell is centered on the edge.
- Positive
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();