package OCADml

  1. Overview
  2. Docs

Configuration module with types and helpers for specifying path roundovers.

type radius = [
  1. | `Radius of float
]

Radius of circular arc roundovers.

type joint = [
  1. | `Joint of float
]

Distance away from the corner the roundover should start.

type cut = [
  1. | `Cut of float
]

Distance in from the corner that should be cut off by the roundover.

type width = [
  1. | `Width of float
]

Width of the segment replacing chamfered corners.

type corner

Roundover specification for a corner of a path.

type t

Full roundover specification for a path, either given as a mixed list of pairs of coordinates and corner specifications that apply to them, or a single spec to be applied to all corners of the included path.

Corners

val chamf : [ cut | joint | width ] -> corner

chamf spec

Create a chamfered corner specification.

val circ : [ cut | joint | radius ] -> corner

circ spec

Create a circular corner specification.

val bez : ?curv:float -> [ cut | joint ] -> corner

bez ?curv spec

Create a continuous curvature corner specification. curv sets the smoothness of bezier curvature (default = 0.5).

General specifications

val mix : (V2.t * corner option) list -> t

mix l

Wrap a list of points paired with (optional) corner specifications as a t. Note that it is the users responsibility to leave the specs for the first and last points as None if they intend to treat the path as open.

val flat : ?closed:bool -> corner:corner -> V2.t list -> t

flat ?closed ~corner path

Create a roundover specification that will apply corner to each of the points in path (other than the first and last points if closed is false, default = true).

Variable amplitude specifications

val chamfers : kind:[ `Cut | `Joint | `Width ] -> (V2.t * float) list -> t

chamfers ~kind spec_pts

Create an all chamfer t specification, with variable amplitude of the given kind paired with each point of the path.

val circles : kind:[ `Radius | `Cut | `Joint ] -> (V2.t * float) list -> t

circles ~kind spec_pts

Create an all circular t specification, with variable amplitude of the given kind paired with each point of the path.

val beziers : ?curv:float -> kind:[ `Cut | `Joint ] -> (V2.t * float) list -> t

bezier ?curv ~kind spec_pts

Create an all continuour curvature t specification, with variable amplitude of the given kind paired with each point of the path. Curvature smoothness of all roundovers is set by curv (default = 0.5). If variable smoothness is desired, bez and mix may be used in conjunction to achieve it.