From d939401183d12af3452e17aa5b020dab50f8edb0 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 10 Mar 2023 21:11:03 +0000 Subject: [PATCH] Added vero_grid_pos() function. --- readme.md | 1 + vitamins/veroboard.scad | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index 2c9e3c1..7a5deb0 100644 --- a/readme.md +++ b/readme.md @@ -4424,6 +4424,7 @@ Veroboard with mounting holes, track breaks, removed tracks, solder points and c | Function | Description | |:--- |:--- | | `vero(name, assembly, holes, strips, pitch = 2.54, fr4 = false, screw = M3_cap_screw, mounting_holes = [], breaks = [], no_tracks = [], components = [], joints = [])` | Constructor | +| `vero_grid_pos(type, x, y)` | Convert grid position to offset from the centre | | `vero_length(type)` | Length of the board | | `vero_size(type)` | Board size | | `vero_thickness(type)` | Thickness of the substrate | diff --git a/vitamins/veroboard.scad b/vitamins/veroboard.scad index 3babd73..225bd04 100644 --- a/vitamins/veroboard.scad +++ b/vitamins/veroboard.scad @@ -60,13 +60,14 @@ module solder_meniscus(type, ir = 0.3, r = undef) { //! Draw a solder meniscus } } -module vero_grid_pos(type, x, y) { //! Convert grid position to offset from the centre - holes = vero_holes(type); - strips = vero_strips(type); - translate([((x + holes) % holes) - holes / 2 + 0.5, - ((y + strips) % strips) - strips / 2 + 0.5] * vero_pitch(type)) +function vero_grid_pos(type, x, y) = //! Convert grid position to offset from the centre + let(holes = vero_holes(type), strips = vero_strips(type)) + [((x + holes) % holes) - holes / 2 + 0.5, + ((y + strips) % strips) - strips / 2 + 0.5] * vero_pitch(type); + +module vero_grid_pos(type, x, y) //! Convert grid position to offset from the centre + translate(vero_grid_pos(type, x, y)) children(); -} module vero_mounting_hole_positions(type) //! Positions children at the mounting holes for(p = vero_mounting_holes(type))