From 92d7e18b16b03dc831a9b2c8f92be0ce1c6e441b Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Sat, 4 Jul 2020 09:53:09 +0100 Subject: [PATCH] Added pcb_size() function. --- readme.md | 2 ++ vitamins/pcb.scad | 2 ++ 2 files changed, 4 insertions(+) diff --git a/readme.md b/readme.md index 5ddbaa6..6a6abd2 100644 --- a/readme.md +++ b/readme.md @@ -2103,6 +2103,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | ```pcb_coord(type, p)``` | Convert offsets from the edge to coordinates relative to the centre | | ```pcb_grid_pos(type, x, y, z = 0)``` | Returns a pcb grid position | | ```pcb_screw(type, cap = hs_cap)``` | Mounting screw type | +| ```pcb_size(type)``` | Length, width and thickness in a vector | ### Modules | Module | Description | @@ -2235,6 +2236,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | ```pcb_coord(type, p)``` | Convert offsets from the edge to coordinates relative to the centre | | ```pcb_grid_pos(type, x, y, z = 0)``` | Returns a pcb grid position | | ```pcb_screw(type, cap = hs_cap)``` | Mounting screw type | +| ```pcb_size(type)``` | Length, width and thickness in a vector | ### Modules | Module | Description | diff --git a/vitamins/pcb.scad b/vitamins/pcb.scad index 378eaf8..b489ace 100644 --- a/vitamins/pcb.scad +++ b/vitamins/pcb.scad @@ -53,6 +53,8 @@ function pcb_accessories(type) = type[12]; //! List of accessories to go on the function pcb_grid(type) = type[13]; //! Grid if a perfboard function pcb_polygon(type) = type[14]; //! Optional outline polygon for odd shaped boards function pcb_screw(type, cap = hs_cap) = Len(type[15]) ? type[15] : find_screw(cap, screw_smaller_than(pcb_hole_d(type))); //! Mounting screw type +function pcb_size(type) = [pcb_length(type), pcb_width(type), pcb_thickness(type)]; //! Length, width and thickness in a vector + function pcb_grid_pos(type, x, y, z = 0) = //! Returns a pcb grid position [-pcb_length(type) / 2 + pcb_grid(type).x + 2.54 * x,