gleamscad

A Gleam library for programmatically generating OpenSCAD files.

Features

Package Version Hex Docs

Supported feature set

Not every feature of OpenSCAD is supported yet. For a comparison of all features of OpenSCAD see: https://openscad.org/cheatsheet/

Boolean operations

2D

3D

Transformations

Example

gleam add gleamscad@1
import gleamscad as cad

pub fn main() {
  cad.cube(12.34, cad.NotCentered)
  |> cad.translate(1.0, 2.0, 3.0)
  |> cad.rotate(90.0, 0.0, 0.0)
  |> cad.to_openscad
  |> echo
}

This will result in (indentations added for clarity):

rotate([90.0, 0.000000000, 0.000000000])
{
	translate([1.0, 2.0, 3.0])
	{
		cube(size=[12.34, 12.34, 12.34], center=false);
	}
}

Further documentation can be found at https://hexdocs.pm/gleamscad.

Development

gleam run   # Run the project
gleam test  # Run the tests
Search Document