A Node.js CLI tool that converts OpenSCAD files to PNG images without requiring OpenSCAD installation. Uses OpenSCAD WebAssembly for conversion and implements a software renderer for STL to PNG conversion. Features: - Converts .scad files to STL and PNG outputs - Renders from 8 different viewpoints - No OpenSCAD installation required - Pre-commit hooks to keep examples up to date - GitHub Actions workflow for CI 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
4.6 KiB
Updating OpenSCAD Dependencies
This guide explains how to update the OpenSCAD WebAssembly files used by scad-to-png.
Current Version
The project currently uses OpenSCAD WASM files from:
- Source: https://files.openscad.org/playground/
- Version: OpenSCAD-2025.03.25.wasm24456-WebAssembly-web.zip
- Location:
openscad-web/directory
Checking for Updates
-
OpenSCAD Playground Builds: Visit https://files.openscad.org/playground/ to see available WebAssembly builds.
-
OpenSCAD Development Snapshots: Check https://openscad.org/downloads.html#snapshots for the latest development builds.
-
GitHub Releases: Monitor https://github.com/openscad/openscad-wasm/releases for official releases.
Update Process
Step 1: Download the Latest Web Build
# Navigate to project directory
cd /path/to/scad-to-png
# Download the latest web build (adjust URL as needed)
curl -L -o openscad-web-new.zip "https://files.openscad.org/playground/OpenSCAD-YYYY.MM.DD.wasmXXXXX-WebAssembly-web.zip"
Important: Always download the web version, not the node version. The file should have -WebAssembly-web.zip in its name.
Step 2: Backup Current Version
# Backup existing files
mv openscad-web openscad-web-backup
Step 3: Extract New Version
# Extract new files
unzip openscad-web-new.zip -d openscad-web
# Verify contents
ls -la openscad-web/
You should see:
openscad.js- The JavaScript wrapperopenscad.wasm- The WebAssembly binary
Step 4: Test the Update
# Run test
npm test
# Run examples
npm run example:box
npm run example:gear
# Test with your own files
./scad-to-png your-file.scad
Step 5: Verify Compatibility
Check for:
- Successful initialization: No "GUI mode" errors
- STL generation: Files are created correctly
- Rendering: PNG images are generated properly
Step 6: Update Documentation
If the update is successful:
- Update this file with the new version info
- Update CLAUDE.md if there are any API changes
- Commit the changes
Rollback Process
If issues occur:
# Remove problematic version
rm -rf openscad-web
# Restore backup
mv openscad-web-backup openscad-web
# Test to ensure it works
npm test
Version History
| Date | Version | Notes |
|---|---|---|
| 2024-03-25 | OpenSCAD-2025.03.25.wasm24456-WebAssembly-web | Initial version used |
Troubleshooting Updates
Common Issues
-
"Requested GUI mode but can't open display!"
- You downloaded the node version instead of the web version
- Solution: Download the
-WebAssembly-web.zipfile
-
Module loading errors
- The API might have changed
- Check if initialization parameters need updating in
openscad-wrapper.mjs
-
Missing features
- New versions might require additional configuration
- Check the OpenSCAD WASM changelog for breaking changes
Testing Checklist
- Basic shapes (cube, sphere, cylinder)
- Boolean operations (difference, union, intersection)
- Complex models (gears, threads)
- Large models (performance test)
- All 8 view angles generate correctly
- Error handling still works
Automated Update Script
Save this as update-openscad.sh:
#!/bin/bash
# Configuration
PLAYGROUND_URL="https://files.openscad.org/playground/"
BACKUP_DIR="openscad-web-backup-$(date +%Y%m%d)"
echo "Checking for latest OpenSCAD WASM build..."
# Get latest web build URL (requires parsing HTML)
# This is a simplified example - you'd need to parse the actual HTML
LATEST_URL="$PLAYGROUND_URL/OpenSCAD-2025.03.25.wasm24456-WebAssembly-web.zip"
echo "Downloading from: $LATEST_URL"
# Backup current version
if [ -d "openscad-web" ]; then
echo "Backing up current version to $BACKUP_DIR"
mv openscad-web "$BACKUP_DIR"
fi
# Download and extract
curl -L -o openscad-web-new.zip "$LATEST_URL"
unzip openscad-web-new.zip -d openscad-web
# Test
echo "Running tests..."
npm test
if [ $? -eq 0 ]; then
echo "Update successful!"
rm openscad-web-new.zip
else
echo "Tests failed, rolling back..."
rm -rf openscad-web
mv "$BACKUP_DIR" openscad-web
exit 1
fi
Alternative Sources
- Build from source: Follow instructions at https://github.com/openscad/openscad-wasm
- OpenSCAD Playground: The playground might have newer experimental builds
- Custom builds: You can build with specific features enabled/disabled
Notes for Maintainers
- Always test with the
test.scadfile first - Keep at least one backup of a known working version
- Document any API changes in CLAUDE.md
- Update the version history table after successful updates