package OSCADml

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

Install

Dune Dependency

Authors

Maintainers

Sources

OSCADml-0.2.3.tbz
sha256=61bc12919734a42004f9f54bb03aa5403eac9cdd645cad1fb97ddd2eba148583
sha512=9aca48afeb2c89ace6b07110b6aadedac7d877fb9b0d1990b0c0b622829ff45ced3841fdae30b5b869293dea1b3ae39f1b00fc767c8e3f69d7e78f6412801ffb

doc/axial_chalice.html

Axial Chalice

open OCADml
open OSCADml

A function from z (angle a is ignored) to radius that we will use to define both the outer boundary of the chalice, as well as the cup volume to difference out of it. Since we are ignoring a, the radius will be consistent all the way around the z-axis for each height z.

let f ~z ~a:_ = Float.(5. *. (cos (log ((z /. 5.) +. 1.) *. pi) +. 2.))

Form the outer and inner (to be subtracted from outer) meshes by evaluating f between the given z bounds. We'd like inner to be narrower that outer such that it fits inside, so we subract from the radius returned from f uniformly.

let outer = Mesh.axial_plot ~min_z:0. ~z_steps:50 ~max_z:50. f
let inner = Mesh.axial_plot ~min_z:2. ~z_steps:50 ~max_z:51. (fun ~z ~a -> f ~z ~a -. 2.)

Convert the outer and inner meshes to Scad.ts, and difference them before outputing to file.

let () =
  Scad.to_file "axial_chalice.scad" @@ Scad.(difference (of_mesh outer) [ of_mesh inner ])

OCaml

Innovation. Community. Security.