← Back to Skills Marketplace
vilda007

OpenSCAD Automation

by Vilém Kužel · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ✓ Security Clean
60
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install openscad-automation
Description
Direct OpenSCAD scripting and rendering automation for OpenClaw - create, render, and export 3D models via CLI
README (SKILL.md)

OpenSCAD Automation Skill

Version: 1.1.0
Author: Klepeto 🦞
Description: Direct OpenSCAD scripting, rendering automation, and library integration


What is OpenSCAD?

OpenSCAD is a free, open-source "Programmer's Solid 3D CAD Modeller". Instead of interactive modeling like Fusion 360 or Tinkercad, you write code that describes objects. The script is compiled into a 3D model.

Why OpenSCAD?

  • 📐 Parametric designs - Change one variable, entire model updates
  • 🔧 Precise dimensions - Perfect for mechanical parts, enclosures, adapters
  • 📦 Version control friendly - .scad files are plain text, diffable in Git
  • ⚙️ Mathematical shapes - Gears, threads, spirals, organic forms via code
  • 🎨 Generative art - Algorithms creating complex patterns
  • 🔄 Reusable libraries - Import community libraries for common parts

When to Use OpenSCAD vs Other CAD

Use OpenSCAD Use Fusion 360 / Tinkercad
Parametric designs Organic, freeform shapes
Precise mechanical parts Quick prototyping
Mathematical surfaces Visual, interactive design
Batch generation One-off models
Version-controlled designs Visual iteration

Get OpenSCAD: https://openscad.org (Windows, macOS, Linux)


Installation

Windows

  1. Install OpenSCAD: Download from https://openscad.org
    • Default location: ????\OpenSCAD\openscad.exe
  2. OpenClaw Workspace: ????\.openclaw\workspace

macOS

brew install openscad

Linux

# Ubuntu/Debian
sudo apt install openscad

# Fedora
sudo dnf install openscad

OpenClaw Path: ~/.openclaw/workspace

Verify Installation

# Windows PowerShell
& "????\OpenSCAD\openscad.exe" --version

# macOS/Linux
openscad --version

Expected output: OpenSCAD version 2021.01 (or newer)


Capabilities

  • ✅ Write .scad files directly to workspace
  • ✅ Render to STL (3D printing)
  • ✅ Render to PNG (previews)
  • ✅ Render to SVG (2D projections)
  • ✅ Execute OpenSCAD CLI with proper PowerShell syntax
  • ✅ Provide parametric templates
  • ✅ Batch render multiple variants
  • ✅ Use community libraries (BOSL, NopSCADlib, etc.)
  • ✅ Generate customizers with // comments

Language Reference

Basic Syntax

// Variables
width = 50;
height = 30;
depth = 20;

// Primitive solids
cube([width, height, depth], center = true);
sphere(r = 10);
cylinder(h = 30, r = 5);

// Transformations
translate([x, y, z]) { ... }
rotate([x, y, z]) { ... }  // degrees
scale([x, y, z]) { ... }

// Boolean operations
union() { ... }      // combine
difference() { ... } // subtract
intersection() { ... } // keep overlap

Special Variables (Resolution)

$fn = 100;    // Number of fragments (circles)
$fa = 5;      // Minimum angle
$fs = 0.5;    // Minimum size

Tip: Higher $fn = smoother curves, slower render. Default is 12.

Control Flow

// Conditionals
if (width > 50) {
    cube(20);
} else {
    sphere(10);
}

// Loops
for (i = [0:5]) {
    translate([i * 10, 0, 0])
        cube(5);
}

// List comprehensions
sizes = [for (i = [1:10]) i * 2];

Modules and Functions

// Module (creates geometry)
module box(w, h, d) {
    cube([w, h, d], center = true);
}

box(50, 30, 20);

// Function (returns value)
function diameter(pitch, teeth) = pitch * teeth / PI;

gear_d = diameter(2, 20);

Import/Export

// Import STL, OFF, AMF, 3MF
import("part.stl");

// Import DXF, SVG (2D)
import("profile.dxf");

// Export via CLI (not in script)
// & openscad.exe -o output.stl input.scad

Modifier Characters

* cube(10);    // Disable (comment out)
! sphere(10);  // Show only (root)
# cylinder(10); // Highlight (debug, red)
% cube(10);    // Background (transparent)

Cheat Sheet (Quick Reference)

2D Primitives

circle(r = 10 | d = 20);
square(size = 10, center = true);
square([w, h], center = true);
polygon([[x1,y1], [x2,y2], ...]);
text("Hello", size = 10, font = "Arial");

3D Primitives

sphere(r = 10 | d = 20);
cube(size = 10, center = true);
cube([w, d, h], center = true);
cylinder(h = 30, r = 5 | d = 10, center = true);
cylinder(h = 30, r1 = 5, r2 = 3, center = true); // cone
polyhedron(points = [...], faces = [...]);

Extrusions

linear_extrude(height = 10, twist = 45, slices = 20) {
    circle(10);
}

rotate_extrude(angle = 360) {
    translate([10, 0]) circle(2);
}

Transformations

translate([x, y, z]) { ... }
rotate([x, y, z]) { ... }  // degrees around each axis
rotate(a, [x, y, z]) { ... }  // rotate a degrees around vector
scale([x, y, z]) { ... }
resize([x, y, z], auto = true) { ... }
mirror([x, y, z]) { ... }
color("red") { ... }
color("#FF0000") { ... }
color([1, 0, 0, 1]) { ... }  // RGBA 0-1

Boolean Operations

union() {
    cube(10);
    sphere(10);
}

difference() {
    cube(20);
    sphere(10);  // subtracted from cube
}

intersection() {
    cube(20);
    sphere(10);  // only overlapping volume
}

Mathematical Functions

abs(x)      // absolute value
sin(x)      // sine (degrees)
cos(x)      // cosine
tan(x)      // tangent
acos(x)     // arccosine
asin(x)     // arcsine
atan2(y, x) // arctangent
floor(x)    // round down
ceil(x)     // round up
round(x)    // round nearest
sqrt(x)     // square root
pow(x, y)   // x^y
ln(x)       // natural log
log(x)      // base-10 log
min(a, b)   // minimum
max(a, b)   // maximum
norm(v)     // vector norm
cross(a, b) // cross product

String Functions

str("Value: ", 42)      // concatenate
chr(65)                  // character from code (A)
ord("A")                 // code from character (65)
len("hello")             // length (5)

Type Tests

is_undef(x)    // is undefined
is_bool(x)     // is boolean
is_num(x)      // is number
is_string(x)   // is string
is_list(x)     // is list/vector
is_function(x) // is function

Command-Line Usage

Render to STL (3D Printing)

& "????\OpenSCAD\openscad.exe" -o "output.stl" "model.scad"

Render to PNG (Preview)

& "????\OpenSCAD\openscad.exe" -o "preview.png" --imgsize 1024,1024 "model.scad"

Render to SVG (2D Projection)

& "????\OpenSCAD\openscad.exe" -o "output.svg" --projection both "model.scad"

With Parameters

& "????\OpenSCAD\openscad.exe" -o "out.stl" -D "width=50" -D "height=30" "parametric.scad"

Open in GUI

& "????\OpenSCAD\openscad.exe" "model.scad"

Common CLI Options

Option Description
-o \x3Cfile> Output file (STL, PNG, SVG, etc.)
-D \x3Cvar name="val"> Set variable before rendering
--imgsize W,H PNG image size
--projection [both] SVG projection type
--render Force full CGAL render
--enable \x3Cfeature> Enable experimental features
--viewall Fit model in view (PNG)
--colorscheme \x3Cname> Color theme (starnight, beforedawn, etc.)

Community Libraries

OpenSCAD has a rich ecosystem of community libraries. Import them with use \x3Clibrary.scad> or include \x3Clibrary.scad>.

General Purpose Libraries

BOSL2 (Belfry OpenSCAD Library v2)

Best for: Everyday modeling helpers, shapes, masks

use \x3CBOSL2/std.scad>
use \x3CBOSL2/rounding.scad>

rounded_cube([50,30,20], r=5);

NopSCADlib

Best for: 3D printer parts, electronics enclosures, hardware

use \x3CNopSCADlib/screws.scad>
use \x3CNopSCADlib/enclosures.scad>

screw_hole(3);  // M3 screw hole

UB.scad

Best for: 3D printing workflow, mechanical parts, view helpers

use \x3CUB.scad/UB.scad>

view_rotate();  // Animation helpers

dotSCAD

Best for: Mathematical modeling, reduced complexity

use \x3CdotSCAD/modeling.scad>
use \x3CdotSCAD/math.scad>

Specialized Libraries

threads.scad

Best for: Metric threads, bolts, nuts, augers

use \x3Cthreads.scad>

metric_bolt(d=10, pitch=1.5, length=50);
metric_nut(d=10);

Round-Anything

Best for: Filleted/rounded parts, ergonomic design

use \x3Cround-anything.scad>

round_anything(pts, radius);

YAPP Box

Best for: Electronics project boxes with PCB mount

use \x3CYAPP_Box.scad>

// Define PCB dimensions, generate enclosure

Board Game Toolkit

Best for: Board game organizers, boxes, inserts

use \x3Cboardgame_toolkit.scad>

box_with_lid(w, h, d);

STEMFIE

Best for: Educational construction sets, compatible parts

use \x3Cstemfie.scad>

stemfie_beam(length);
stemfie_plate(width, height);

Installing Libraries

  1. Download .scad files from GitHub
  2. Place in your OpenSCAD libraries folder:
    • Windows: ????\Documents\OpenSCAD\libraries\
    • macOS: ~/Documents/OpenSCAD/libraries/
    • Linux: ~/.local/share/OpenSCAD/libraries/
  3. Import in your scripts:
    use \x3CBOSL2/std.scad>
    

Templates

Basic Cube

// cube.scad
cube([20, 20, 20], center = true);

Parametric Box with Lid

// box_with_lid.scad
width = 80;
height = 60;
depth = 40;
wall = 2;
lip = 1;

// Box base
difference() {
    cube([width, height, depth], center = true);
    translate([0, 0, lip])
        cube([width - wall*2, height - wall*2, depth], center = true);
}

// Lid
translate([0, 0, depth/2 + lip])
    cube([width, height, 5], center = true);

Gear (Simple)

// gear.scad
$fn = 100;
teeth = 20;
module_gear = 2;  // module (tooth size)

pitch_diameter = teeth * module_gear;
outer_diameter = pitch_diameter + 2 * module_gear;

difference() {
    cylinder(h = 10, d = outer_diameter);
    cylinder(h = 12, d = pitch_diameter * 0.4);  // shaft hole
}

Enclosure with Screw Bosses

// enclosure.scad
use \x3CNopSCADlib/screws.scad>

width = 100;
height = 80;
depth = 30;
wall = 2;

// Outer box
difference() {
    cube([width, height, depth], center = true);
    translate([0, 0, 1])
        cube([width - wall*2, height - wall*2, depth], center = true);
}

// Screw bosses (M3)
boss_positions = [[-40, -30], [40, -30], [-40, 30], [40, 30]];
for (pos = boss_positions) {
    translate([pos[0], pos[1], -depth/2])
        screw_hole(3, l = depth);
}

Phone Stand

// phone_stand.scad
$fn = 100;

// Base
cube([80, 60, 5], center = true);

// Back support (angled)
rotate([20, 0, 0])
    translate([0, -20, 30])
        cube([60, 10, 50], center = true);

// Front lip
translate([0, 25, 10])
    cube([60, 5, 15], center = true);

Workflow

1. Design

Tell the agent what you want:

"Create a parametric phone stand adjustable for 60-80mm phones"

Agent writes .scad file to workspace.

2. Preview

& "????\OpenSCAD\openscad.exe" -o "preview.png" --imgsize 1024,1024 "design.scad"

3. Export for Printing

& "????\OpenSCAD\openscad.exe" -o "design.stl" "design.scad"

4. Iterate

"Make the angle 15° instead of 20°, add cable slot"

Agent modifies parameters, re-render.


Tips & Best Practices

Performance

  • Use $fn wisely: 50-100 for visible curves, 12-24 for hidden features
  • Simplify early: Remove unnecessary details before final render
  • Test small: Preview with low resolution, render high-res only when ready

Design

  • center = true: Makes positioning easier
  • Use variables: All dimensions as variables for easy tweaking
  • Comment parameters: // [10:100:10] creates Customizer sliders
  • Modular design: Break complex models into modules

3D Printing

  • Wall thickness: Minimum 2-3x nozzle diameter (0.8-1.2mm for 0.4mm nozzle)
  • Tolerances: Add 0.2-0.3mm clearance for moving parts
  • Orientation: Design for optimal print orientation (minimize supports)
  • Export as STL: Binary STL is smaller than ASCII

Debugging

// Highlight problematic part
# translate([0, 0, 10])
    cube(20);

// Disable temporarily
* sphere(10);

// Show only this part
! cylinder(20);

// Debug output
echo("Width =", width);

Error Handling

Error Cause Solution
Unexpected token PowerShell syntax Use & before quoted path
File not found Wrong path Check relative path from workspace
CGAL error Non-manifold geometry Check for holes, intersections, inverted normals
No top level object Empty script Add at least one primitive
Too many points Excessive $fn Reduce resolution
Import failed Missing file Verify file exists and path is correct
Circular dependency Modules calling each other Restructure code

Learning Resources

Official Documentation

Tutorials

  • Wikibooks Tutorial: https://en.wikibooks.org/wiki/OpenSCAD_Tutorial
    • Chapter 1: Getting started
    • Chapter 2: Scaling and parameterizing
    • Chapter 3: Combining objects
    • Chapter 4: Modules
    • Chapter 5: Libraries
    • Chapter 6: Control flow
    • Chapter 7: Loops and patterns
    • Chapter 8: Extrusion
    • Chapter 9: Math and geometry

Community


Integration with Other Tools

Fusion 360

  • OpenSCAD: Parametric, mathematical, programmatic
  • Fusion 360: Interactive, visual, assemblies
  • Workflow: Export STL from OpenSCAD → Import to Fusion 360 for assembly

Slicers (PrusaSlicer, Cura)

  • Direct STL import from OpenSCAD output
  • Parametric workflow: Adjust OpenSCAD variables → Re-slice → Print

Git / Version Control

  • .scad files are plain text - perfect for Git
  • Track design iterations
  • Branch for variants
  • Diff to see what changed

Created: 2026-05-24 | Updated: 2026-05-24 (v1.1.0 - Added full documentation, libraries, cheat sheet)
Klepeto 🦞

Usage Guidance
Install this if you want an agent to generate and render OpenSCAD models locally. Keep generated CAD and render outputs in a dedicated folder, review target filenames before export, and ask the agent to confirm before modifying existing .scad, .stl, .png, or .svg files.
Capability Tags
crypto
Capability Assessment
Purpose & Capability
The stated purpose is OpenSCAD scripting and rendering automation, and the artifact focuses on creating .scad files and exporting STL, PNG, and SVG outputs through the OpenSCAD CLI.
Instruction Scope
The skill clearly says the agent may write and modify workspace design files, but it does not explicitly require confirmation before reusing or overwriting output filenames.
Install Mechanism
The package contains only a markdown skill file; installation guidance points users to install OpenSCAD separately through normal OS package managers or the official site.
Credentials
Local file creation, rendering, and optional OpenSCAD library use are proportionate to CAD automation; no credential access, telemetry, exfiltration, or unrelated data access is evident.
Persistence & Privilege
Generated .scad, .stl, .png, and .svg files persist in the workspace and could clutter or replace existing outputs, but there is no background persistence, hidden privilege escalation, or automatic long-running behavior.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install openscad-automation
  3. After installation, invoke the skill by name or use /openscad-automation
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.1.0
Added comprehensive OpenSCAD documentation: language reference, cheat sheet, community libraries guide (BOSL2, NopSCADlib, threads.scad, etc.), learning resources, and templates
v1.0.1
Fixed: Removed hardcoded paths, added OpenSCAD description and download links
v1.0.0
Initial release - Direct OpenSCAD scripting and rendering automation
Metadata
Slug openscad-automation
Version 1.1.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

What is OpenSCAD Automation?

Direct OpenSCAD scripting and rendering automation for OpenClaw - create, render, and export 3D models via CLI. It is an AI Agent Skill for Claude Code / OpenClaw, with 60 downloads so far.

How do I install OpenSCAD Automation?

Run "/install openscad-automation" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is OpenSCAD Automation free?

Yes, OpenSCAD Automation is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does OpenSCAD Automation support?

OpenSCAD Automation is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created OpenSCAD Automation?

It is built and maintained by Vilém Kužel (@vilda007); the current version is v1.1.0.

💬 Comments