package OSCADml

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

Install

Dune Dependency

Authors

Maintainers

Sources

OSCADml-0.2.2.tbz
sha256=8c0eeb5055dd16bb0f9b25b4d21d5312c431969fd0871fc045df2f93147ae39a
sha512=b28bd304ef3196193ba6fe33f51f0f1e2c6bb3cd41c47335a513d9fb4b1f5eca8bcbabcf8683d9b35e3cbd4f3dabe2c7bcc8f5c4b087f96a7ac70117fc4babfa

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.