package OSCADml

  1. Overview
  2. Docs
OCaml DSL for 3D solid modelling in OpenSCAD

Install

Dune Dependency

Authors

Maintainers

Sources

OSCADml-0.2.1.tbz
sha256=406e45c5df8122e8b065342e10ba9deb7a066683b256619462c405da69ba5baa
sha512=20db4192d6204d9fd5914562ec83d8edbbb1f5c89a72e61928bf662fdcc9ecea38760b26c99af801ddfc5b877c451ad11c16fc89a6a36ef8c20881375627295b

doc/rounded_text.html

Rounded text extrusion

open OCADml
open OSCADml

Generate a list of Poly2.t spelling out Hello World!. At the moment, PolyText.text is not as flexible and feature rich as Scad.text (OpenSCADs text shape function), but this gives up point representations that be can work with directly.

let hello = PolyText.text ~center:true ~fn:5 ~size:5. ~font:"Ubuntu" "Hello!"

Circular roundovers with fn steps, specified by a distance to be `Cut off of the corners. You can expect some finickiness with applying roundovers to the polygons produced by PolyText.text, as the paths coming from Cairo may have some points quite close together, and sharp corners, leading to illegal paths when further roundover operations are applied.

let caps =
  let spec = Mesh.Cap.(round ~mode:Delta @@ circ ~fn:5 (`Cut 0.025)) in
  Mesh.Cap.capped ~top:spec ~bot:spec

Map over the character polys in hello with a rounded extrusion funcion specified by caps, and convert into Scad.ts that we can union to create our final model.

let extruder poly = Scad.of_mesh @@ Mesh.extrude ~caps ~height:0.5 poly
let () = List.map extruder hello |> Scad.union |> Scad.to_file "rounded_text.scad"

OCaml

Innovation. Community. Security.