As the title says, I started writing a package for defining CAD objects in Julia.
Why would this be useful?
I believe it is useful to have an alternative to OpenSCAD which offers all the advantages of a full-fledged programming language (including for example the ability to include external libraries, or to read files), and the capacity of directly manipulating the contents of the objects (whereas OpenSCAD’s modules
are completely opaque to the script). Moreover, extending OpenSCAD is always quite hard, because that programming language is so limited (it has all the inconvenients of a functional language with few of their advantages — although recent releases promise function values, that’s still very experimental). Writing new packages directly in Julia would be easier.
Given its easy syntax and its speed, I believe Julia to be the right tool for this project. We can also leverage the rich ecosystem of geometry, computation and visualization modules. (This is one reason why I did not just use ImplicitCAD. The other is that some operations are probably easier to write with meshes than with signed distance functions. However, note that the Solids
package is quite open to a SDF back-end!)
What can it do right now?
Not too much right now.
As a small proof of concept, the package Solids.jl
today has more or less the following capacities:
- a full syntax for defining and transforming “ideal” 2d and 3d objects (without too many parentheses), which is similar to OpenSCAD but full-fledged Julia code;
- an almost complete 2d subsystem (= conversion of ideal 2d objects to a set of polygons);
- a convenient way of reading all the objects in a script;
- OpenSCAD output (only for objects which also exist in that language though).
An example of code written with this module follows:
using Solids
Square(20)
linear_extrude(30) * [
intersection(
translate([10,0]) * Circle(3),
translate([13,0]) * Circle(3),
),
color("pink") * scale(2) * Square(1),
]
What should it do next?
The next big steps would be writing the full 3d system (using one of the packages which interface CGAL for example); providing visualization (using e.g. GLMakie
); and exporting directly to 3d file formats such as STL. These steps, while big, do not seem impossible given all the variety of packages in the Julia ecosystem.
As I’m quite a beginner in Julia (this being my first attempt at a package), this is as much of a call for help as it is an announcement. Any help or advice is welcome!