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;