package OCADml

  1. Overview
  2. Docs

Configuration module for declaring how extrusions from 2d to 3d via sweep should be capped off.

type offset = {
  1. d : float;
  2. z : float;
}

Offset diameter d (positive or negative), and corresponding vertical step z (enforced positive only when consumed).

type offset_mode =
  1. | Delta
  2. | Chamfer
  3. | Radius of {
    1. fn : int option;
    2. fs : float option;
    3. fa : float option;
    }
type offsets

A list of offset describing a 3d end-cap extrusion roundover. Abstracted to enforce use of constructors.

type holes = [
  1. | `Same
    (*

    Offset d and z values from outer are copied.

    *)
  2. | `Flip
    (*

    Offset d and z values from outer are copied, but d sign is flipped.

    *)
  3. | `Spec of offsets
    (*

    Supplies a different set of offsets for the holes. Note that this should have the same z values, or else the roundover mesh will not be well formed.

    *)
  4. | `Mix of [ `Same | `Flip | `Spec of offsets ] list
]

Specifies how holes in the end-cap should be treated, either relative to the outer shape, or independantly. When multiple holes are present, `Mix allows each one to be specified separately, to treat all the same, use the other variants directly.

type poly = {
  1. outer : offsets;
  2. holes : holes;
  3. mode : offset_mode;
}
type poly_spec = [
  1. | `Empty
  2. | `Flat
  3. | `Round of poly
]

Specifies whether an end of the extrusion should be left `Empty, sealed with a `Flat face, or `Rounded over with a given offset specification.

type caps

Cap specification (flat, open, or round) type of t. See capped for construction.

type t = [
  1. | `Looped
  2. | `Caps of caps
]

Top-level configuration type for sweep, allowing for the end-caps to be specified using the types above, or to simply loop the first and last layers of the mesh together (see: endcaps `Loop as used by of_rows).

val chamf : ?angle:float -> ?cut:float -> ?width:float -> ?height:float -> unit -> offsets

chamf ?angle ?cut ?width ?height ()

Create offsets that will produce a chamfer roundover. One of cut (amount of corner "cut off"), width (horizontal distance of chamfer), or height (vertical distance of chamfer) can be specified to be used in conjunction with angle (default = pi / 4), or width and height can be provided together, in which case angle is not used.

val circ : ?fn:int -> [< `Cut of float | `Radius of float ] -> offsets

circ ?fn roundover

Create offsets that will produce a circular roundover, according to either a given `Cut distance, or a `Radius, over fn steps (default 16).

val tear : ?fn:int -> [< `Cut of float | `Radius of float ] -> offsets

tear ?fn roundover

Create offsets that will produce a teardrop rounover (circular, endind in a chamfer).

val bez : ?curv:float -> ?fn:int -> [< `Cut of float | `Joint of float ] -> offsets

bez ?curv ?fn spec

Create offsets that will produce a smooth bezier roundover. The amplitude of the curve can be given by `Cut (amount of corner "cut off"), or `Joint (distance vertically the bezier covers). curv is the curvature smoothness parameter, ranging from gradual 0., to abrupt 1. (default 0.5).

val offsets : offset list -> offsets

offsets offsets

Sanitize (enforce positive and increasing z values) and pack a list of offset.

val unwrap_offsets : offsets -> offset list

unwrap_offsets offsets

Retrieve list of offset from the abstract offsets.

val round : ?mode:offset_mode -> ?holes:holes -> offsets -> [> `Round of poly ]

round ?mode ?holes offsets

Construct a roundover poly_spec. mode specifies the kind offset (see Path2.offset) performed on the paths on each "vertical" step of the roundover. Roundover behaviour for inner paths are specified with holes. This defaults to `Flip, as for the more common positive roundovers (flaring inward), using `Same polarity would lead to "pinching off" of the holes.

val looped : [> `Looped ]

looped

Looped, indicating that the top should loop around to the bottom of a sweep.

val capped : top:poly_spec -> bot:poly_spec -> [> `Caps of caps ]

capped ~top ~bot

Construct a Cap.t specifying how the top and bot caps of a sweep extrusion should be sealed off (or not).

val flat_caps : [> `Caps of caps ]

flat_caps

Default Cap.t configuration for flat (no roundover) sealed caps.

val open_caps : [> `Caps of caps ]

open_caps

Default Cap.t configuration for unsealed caps (open ends).