Around February 2019 I bootstrapped a scripted CAD environment named “ScriptCAD”, and resembles closely to OpenSCAD.org and OpenJSCAD.org (which I co-developed for a couple of years) with a new take, developed from scratch:
Separate internal representation from display representation
Triangulation or Implicit representation
only triangulate at late stage at display or export
Intuitive Graphical User Interface (GUI)
Simple export various formats
Select top-level solids
Source <-> TreeView <-> 3D Model selection
The transparent Source vs Object Tree vs 3D Space has been in the back of my mind for a long time as I keep the connection of each stage intact and transparent.
Ease of use
hiding JS module complexity and notions
Browser use (either use built-in editor or drag-n-drop source with autoreload)
Command Line Interface (CLI) use
Screenshots & Examples
SpiritCAD.org Online as Preview
As of November 2019, ScriptCAD.org is reachable as an early preview (alpha stage), most examples work, some do not yet or display wrong output.
Note: there is only limited documentation yet (2019/11), and the API is subject of changes.
I still tune it to my use-cases and therefore API and overall design of the API might change, even drastically; once the API becomes more stable I will release the source code as well.
Some of use-cases (as seen in the gallery above):
coding low-level Gcode and use ScriptCAD to preview (render) Gcode including colors, scriptcad (CLI) outputs .gcode to actually print
testing single layer color mixed 3D Printing: forms, color mixing
ScriptCAD uses ThreeCSG/csg.js at its core to perform CSG operations, which can be very slow – hence, designing complex pieces can be slow as every change recomputes all again (I like to avoid this in future developments) yet as of 0.3.2 basic caching is implemented so only deltas are recomputed.
Back in 2003 I adapted OpenJsCad framework and extended it and documented it properly so it can be used in an easy way and then handed OpenJSCAD.org over to JS devs, who transformed it into the several NPM packages so it becomes usable for 3rd party packages easier.
Hierarchical Scene (computeScene())
computeSolidPolygon(): creates polyhedral approximation of solids
computeSolidImplicit(): create code for implicit rendering
polygon: throw triangles into WebGL space (e.g. with threejs)
implicit: render using GL shader
Browser: .stl, .amf, .obj, .3mf, .3mj
CLI: .stl, .amf, .obj, .3mf, .3mj, .png
keep it simple (no NPM module export or alike complexity)
CSG capability (union, intersection, difference)
name parts and enumerate parts/id
parametrical designs (expose certain variables)
extrude 2D polygons to another (not just hull)
morph from one solid to another
simple fillets and chamfers (reduce sharp edges for real world parts)
extensive and detailed documentation
100% API backward compatibility (no depreciation)
Few notes how to achieve those:
using three.js and ThreeCSG: reliable and well maintained package somewhat, ThreeCSG seems outdated/abandoned; alternatively using csg.js and/or OpenJSCAD packages as fallback, but hiding all the module handling
separate creating scene and rendering scene altogether:
polygons or rendering triangles are a stage, but not the core of the CAD, but true solids like a (perfect) sphere
use WebGL as one backend among others
use implict representations alternatives
fillets and chamfers: even those look simple, those are hard(er) to do in polygonal/triangulated stage, but simple to do with implicit representation
2019/11/25: 0.2.5: ScriptCAD.org launched as preview and a limited ScriptCAD Reference
2019/11/05: 0.2.3: various features implemented, e.g. exclusive(), 3MJ import and export support added.
2019/03/04: 0.1.5: more drawing models, selectable windows, more examples:
Brief overview of features of 0.1.5:
2019/01/18: select Source -> TreeView -> 3D Scene or any stage and respective part is highlighted
I used ScriptCAD to generate paths with certain colors, and visualize it within ScriptCAD Web-GUI, and on the command-line the same code generated actual Gcode for one of my 3D printers, Ashtar K#2 equipped with Diamond Hotend 3-in-1 (mixing colors) – it allowed me to control every detail, something an ordinate slicer would not have provided:
OpenSCAD.org: scripted CAD using dedicated language which is rather functional than procedural