Module Dometyl.Plate

Switch plate generation.

module Lookups : sig ... end

Provides per-column lookup functions to be used by make for placement of Key.ts to form Column.ts, and for arrangment and orientation of the generated columns to form the plate.

type config = {
  1. n_body_rows : int -> int;
  2. body_centres : int -> float;
  3. n_body_cols : int;
  4. centre_col : int;
  5. spacing : float;
  6. tent : float;
  7. n_thumb_rows : int -> int;
  8. thumb_centres : int -> float;
  9. n_thumb_cols : int;
  10. thumb_offset : OCADml.V3.t;
  11. thumb_angle : OCADml.V3.t;
}

Non-function parameters used for the construction of the plate.

type t = {
  1. config : config;
  2. scad : OSCADml.Scad.d3;
  3. body : Columns.t;
  4. thumb : Columns.t;
}

The plate is constructed from a main body of Columns.t and a thumb cluster, modelled as a separate Column.t. As with lower types, the config as well as the aggregate Scad.d3 are carried around for convenient access.

val translate : OCADml.V3.t -> t -> t
val xtrans : float -> t -> t
val ytrans : float -> t -> t
val ztrans : float -> t -> t
val rotate : ?about:OCADml.V3.t -> OCADml.V3.t -> t -> t
val xrot : ?about:OCADml.V3.t -> float -> t -> t
val yrot : ?about:OCADml.V3.t -> float -> t -> t
val zrot : ?about:OCADml.V3.t -> float -> t -> t
val axis_rotate : ?about:OCADml.V3.t -> OCADml.V3.t -> float -> t -> t
val quaternion : ?about:OCADml.V3.t -> OCADml.Quaternion.t -> t -> t
val scale : OCADml.V3.t -> t -> t
val xscale : float -> t -> t
val yscale : float -> t -> t
val zscale : float -> t -> t
val mirror : OCADml.V3.t -> t -> t
val affine : OCADml.Affine3.t -> t -> t
val make : ?n_body_cols:int -> ?centre_col:int -> ?spacing:float -> ?tent:float -> ?n_thumb_cols:int -> ?rotate_thumb_clips:bool -> ?thumb_offset:OCADml.V3.t -> ?thumb_angle:OCADml.V3.t -> ?body_lookups:Lookups.t -> ?thumb_lookups:Lookups.t -> ?caps:(int -> OSCADml.Scad.d3) -> ?thumb_caps:(int -> OSCADml.Scad.d3) -> Key.t -> t

make ?n_rows ?centre_row ?n_cols ?centre_col ?spacing ?tent ?rotate_thumb_clips ?thumb_offset ?thumb_angle ?body_lookups ?thumb_lookups ?caps ?thum_caps keyhole

Create a switch plate, with provided optional parameters and defaults. The default parameters may or may not be suitable as a jumping off point for your own design. To that end, other examples with divergent parameters are provided in the modules within the models/examples sub-directory of the dometyl repo.

  • n_body_cols specifies number of columns on the main body of the switch plate
  • centre_col specifies the column around which the others are positioned (typically 2, the middle finger) on the main body of the switch plate
  • spacing gives the distance in mm between each column by default. Further adjustment can of course be done with Lookups.t.offset.
  • tent angle in radians that the entire plate (including thumb) will be y-rotated
  • thumb_offset directs the translation used for thumb cluster placement (starting point if zero origin).
  • thumb_angle sets the euler (x -> y -> z) rotation used to orient the thumb before translating to its destination (rotation is about 0., oriented along x to start).
  • body_lookups and thumb_lookups provide various per-column key/column-placement and orientation functions for the construction of the body and thumb respectively. See Lookups.
  • caps is a lookup from row number to a Scad.d3 representing a keycap. This will be used to provide caps to Key.ts before they are distributed in Column.make.
  • thumb_caps same as caps, but for the thumb. If not provided, this default to caps.
  • keyhole is the Key.t that will be distributed to make up the main plate and thumb cluster, carring all contained coordinate information and accesory Scad.d3s along with them to their new homes.
val column_joins : ?in_d:float -> ?out_d1:float -> ?out_d2:float -> ?body_skip:(int * int) list -> ?body_join_skip:(int * int) list -> ?thumb_skip:(int * int) list -> ?thumb_join_skip:(int * int) list -> t -> OSCADml.Scad.d3

column_joins ?in_d ?out_d1 ?out_d2 t

Returns a Scad.d3 scad which joins together all columns of the main plate by hulling the Key.Face.scads of the Key.ts together, for a closed switch-plate look (and sturdiness). Typically, a function such as this or skeleton_bridges below will be used as as the plate_welder parameter to Case.make. Optional params in_d, out_d1 and out_d2 are passed on to Bridge.cols to control how far the lower key's face is moved out, and the upper keys face is moved in before being hulled with its neighbours across the gap. This can be used to thicken the generated supports.

val skeleton_bridges : ?in_d:float -> ?out_d1:float -> ?out_d2:float -> t -> OSCADml.Scad.d3

skeleton_bridges ?in_d ?out_d1 ?out_d2 t

Returns a Scad.d3 scad with "bridges" between the bottom row keys from index to middle, and the top keys for the remaining columns. Similar to the BastardKB skeletyl. This function, as well as column_joins make use of functions found in the Bridge module, if you are wanting to do something different, that would be a good place to get started. Optional params in_d, out_d1 and out_d2 are passed on to Bridge.cols to control how far the lower key's face is moved out, and the upper keys face is moved in before being hulled with its neighbours across the gap. This can be used to thicken the generated supports.

val to_scad : t -> OSCADml.Scad.d3

to_scad t

Extracts the Scad.d3 from t.

val collect : (int -> Key.t -> OSCADml.Scad.d3 list -> OSCADml.Scad.d3 list) -> t -> OSCADml.Scad.d3

collect f t

Fold over all Key.ts contained within t, extracting Scad.d3s with f, and unioning them. Used for collect_caps and collect_cutouts.

val collect_caps : t -> OSCADml.Scad.d3

collect_caps t

Return a Scad.d3 representing the union between all caps carried by the Key.ts that make up the plate t. Used to design around keycap closeness, and lookout for collisions etc.

val collect_cutouts : t -> OSCADml.Scad.d3

collect_cutout t

Return a Scad.d3 representing the union between all Key.t.cutouts found in the plate t. This is used by Case.make to perform the clearance cut from the Case.t.scad model to make room for whatever the Key.t.cutout is modelling (e.g. hotswap sockets). Like collect_caps, this could also be useful for visualization.