From e952aa7840cf4f3765c518a481d32f582bef27b4 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Sat, 11 Sep 2021 11:28:21 +0100 Subject: [PATCH] PCB chip compoment can now be round if width is zero to fake round buttons. --- readme.md | 2 +- vitamins/pcb.scad | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index d9040ca..3aefa56 100644 --- a/readme.md +++ b/readme.md @@ -2339,7 +2339,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | `barrel_jack(cutout = false)` | Draw barrel power jack | | `block(size, colour, makes_cutout, cutouts)` | Draw a coloured cube to represent a random PCB component | | `buzzer(height, diameter, colour)` | Draw PCB buzzer with specified height, diameter and colour | -| `chip(length, width, thickness, colour, cutout = false)` | Draw a coloured cube to represent a chip, or other rectangular component | +| `chip(length, width, thickness, colour, cutout = false)` | Draw a coloured cube to represent a chip, or other rectangular component, or cylinder if width is zero | | `flat_flex(type, cutout = false)` | Draw flat flexistrip connector as used on RPI0 | | `flex(cutout = false)` | Draw flexistrip connector | | `hdmi(type, cutout = false)` | Draw HDMI socket | diff --git a/vitamins/pcb.scad b/vitamins/pcb.scad index e48ca0f..bb623d4 100644 --- a/vitamins/pcb.scad +++ b/vitamins/pcb.scad @@ -88,10 +88,13 @@ module pcb_hole_positions(type, all = true) { // Position children at the hole p module pcb_screw_positions(type) //! Positions children at the mounting hole positions pcb_hole_positions(type, false) children(); -module chip(length, width, thickness, colour, cutout = false) //! Draw a coloured cube to represent a chip, or other rectangular component +module chip(length, width, thickness, colour, cutout = false) //! Draw a coloured cube to represent a chip, or other rectangular component, or cylinder if width is zero if(!cutout) color(colour) - translate_z(thickness / 2) cube([length, width, thickness], center = true); + if(width) + translate_z(thickness / 2) cube([length, width, thickness], center = true); + else + cylinder(d = length, h = thickness); module usb_A_tongue() { l = 9;