mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-08-29 18:19:58 +02:00
PCB blocks can now have rounded edges for more realistic cans.
This commit is contained in:
@@ -2394,7 +2394,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
|
|||||||
| Module | Description |
|
| Module | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
| `barrel_jack(cutout = false)` | Draw barrel power jack |
|
| `barrel_jack(cutout = false)` | Draw barrel power jack |
|
||||||
| `block(size, colour, makes_cutout, cutouts)` | Draw a coloured cube to represent a random PCB component |
|
| `block(size, colour, makes_cutout, cutouts, r = 0, rtop = 0)` | Draw a coloured cube to represent a random PCB component |
|
||||||
| `buzzer(height, diameter, colour)` | Draw PCB buzzer with specified height, diameter and colour |
|
| `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, or cylinder if width is zero |
|
| `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 |
|
| `flat_flex(type, cutout = false)` | Draw flat flexistrip connector as used on RPI0 |
|
||||||
@@ -2560,7 +2560,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
|
|||||||
| Module | Description |
|
| Module | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
| `barrel_jack(cutout = false)` | Draw barrel power jack |
|
| `barrel_jack(cutout = false)` | Draw barrel power jack |
|
||||||
| `block(size, colour, makes_cutout, cutouts)` | Draw a coloured cube to represent a random PCB component |
|
| `block(size, colour, makes_cutout, cutouts, r = 0, rtop = 0)` | Draw a coloured cube to represent a random PCB component |
|
||||||
| `buzzer(height, diameter, colour)` | Draw PCB buzzer with specified height, diameter and colour |
|
| `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, or cylinder if width is zero |
|
| `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 |
|
| `flat_flex(type, cutout = false)` | Draw flat flexistrip connector as used on RPI0 |
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 278 KiB After Width: | Height: | Size: 278 KiB |
@@ -1071,7 +1071,7 @@ module trimpot10(vertical, cutout = false) { //! Draw a ten turn trimpot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module block(size, colour, makes_cutout, cutouts) //! Draw a coloured cube to represent a random PCB component
|
module block(size, colour, makes_cutout, cutouts, r = 0, rtop = 0) //! Draw a coloured cube to represent a random PCB component
|
||||||
if(cutouts) {
|
if(cutouts) {
|
||||||
if(makes_cutout)
|
if(makes_cutout)
|
||||||
translate([-50, 0, size.z / 2 - panel_clearance])
|
translate([-50, 0, size.z / 2 - panel_clearance])
|
||||||
@@ -1079,8 +1079,10 @@ module block(size, colour, makes_cutout, cutouts) //! Draw a coloured cube to re
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
color(colour)
|
color(colour)
|
||||||
translate_z(size.z / 2)
|
if(rtop)
|
||||||
cube(size, center = true);
|
let($fn = 32) rounded_top_rectangle(size, r, rtop);
|
||||||
|
else
|
||||||
|
rounded_rectangle(size, r);
|
||||||
|
|
||||||
module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb component from description
|
module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb component from description
|
||||||
function show(comp, part) = (comp[3] == part || comp[3] == str("-",part)) && (!cutouts || angle == undef || angle == comp.z);
|
function show(comp, part) = (comp[3] == part || comp[3] == str("-",part)) && (!cutouts || angle == undef || angle == comp.z);
|
||||||
@@ -1116,7 +1118,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
|
|||||||
if(show(comp, "molex_usb_Ax1")) molex_usb_Ax1(cutouts);
|
if(show(comp, "molex_usb_Ax1")) molex_usb_Ax1(cutouts);
|
||||||
if(show(comp, "smd_led")) smd_led(comp[4], comp[5], cutouts);
|
if(show(comp, "smd_led")) smd_led(comp[4], comp[5], cutouts);
|
||||||
if(show(comp, "7seg")) let(z = param(6, 0)) translate_z(z) 7_segment_digits(comp[4], comp[5], pin_length = z + 3, cutout = cutouts);
|
if(show(comp, "7seg")) let(z = param(6, 0)) translate_z(z) 7_segment_digits(comp[4], comp[5], pin_length = z + 3, cutout = cutouts);
|
||||||
if(show(comp, "block")) block(size = [comp[4], comp[5], comp[6]], colour = comp[7], makes_cutout = param(8));
|
if(show(comp, "block")) block(size = [comp[4], comp[5], comp[6]], colour = comp[7], makes_cutout = param(8), r = param(9, 0), rtop = param(10, 0));
|
||||||
if(!cutouts) {
|
if(!cutouts) {
|
||||||
// Components that don't have a cutout parameter go in this section
|
// Components that don't have a cutout parameter go in this section
|
||||||
if(show(comp, "button_6mm")) square_button(button_6mm);
|
if(show(comp, "button_6mm")) square_button(button_6mm);
|
||||||
|
@@ -864,7 +864,7 @@ XIAO = [
|
|||||||
[for(x = [0:6], y = [-1,1]) [x * 2.54 + 2.71, y * 3 * 2.54 + 9], // Inboard hole positions
|
[for(x = [0:6], y = [-1,1]) [x * 2.54 + 2.71, y * 3 * 2.54 + 9], // Inboard hole positions
|
||||||
for(x = [0:6], y = [-1,1]) [x * 2.54 + 2.71, y * 9 + 9]], // Hole positions on the edge, pad overlaps the inboard holes
|
for(x = [0:6], y = [-1,1]) [x * 2.54 + 2.71, y * 9 + 9]], // Hole positions on the edge, pad overlaps the inboard holes
|
||||||
[ // components
|
[ // components
|
||||||
[7.6, 9, 0, "block", 12.3, 12, 2.41, silver], // can
|
[7.6, 9, 0, "block", 12.3, 12, 2.41, silver, false, 0.3, 0.3], // can
|
||||||
[21 + 1.76 - 7.35 / 2, 9, 0, "usb_C"],
|
[21 + 1.76 - 7.35 / 2, 9, 0, "usb_C"],
|
||||||
],
|
],
|
||||||
[] // accessories
|
[] // accessories
|
||||||
@@ -913,7 +913,7 @@ ESP32_DOIT_V1 = let(l = 51.45, w = 28.33, pitch = inch(1), pins = 15, poffset =
|
|||||||
[l / 2 + poffset, w / 2 - pitch / 2, 0, "-2p54joiner", pins, 1],
|
[l / 2 + poffset, w / 2 - pitch / 2, 0, "-2p54joiner", pins, 1],
|
||||||
[l / 2 + poffset, w / 2 + pitch / 2, 0, "-2p54joiner", pins, 1],
|
[l / 2 + poffset, w / 2 + pitch / 2, 0, "-2p54joiner", pins, 1],
|
||||||
[1.75, w / 2, 180, "usb_uA" ],
|
[1.75, w / 2, 180, "usb_uA" ],
|
||||||
[35, w / 2, 0, "block", 17.7, 16, 3, silver], // can
|
[35, w / 2, 0, "block", 17.7, 16, 3, silver, false, 0.3, 0.3], // can
|
||||||
for(y=[-1,1]) [3.5, y * 6.5, 0, "chip", 4, 3, 1.6, silver], // Mock button surround
|
for(y=[-1,1]) [3.5, y * 6.5, 0, "chip", 4, 3, 1.6, silver], // Mock button surround
|
||||||
for(y=[-1,1]) [3.5, y * 6.5, 0, "chip", 1.8,0, 2.0, grey(20)], // Mock buttons
|
for(y=[-1,1]) [3.5, y * 6.5, 0, "chip", 1.8,0, 2.0, grey(20)], // Mock buttons
|
||||||
for(y=[-1,1]) [21.6, y * 9, 0, "smd_led", LED0603, y < 0 ? "red" : "blue"],
|
for(y=[-1,1]) [21.6, y * 9, 0, "smd_led", LED0603, y < 0 ? "red" : "blue"],
|
||||||
|
Reference in New Issue
Block a user