Added pcb_component_position().

This commit is contained in:
Chris Palmer 2019-08-18 12:19:48 +01:00
parent 4ac48c9603
commit e3a500e9c6
2 changed files with 18 additions and 1 deletions

View File

@ -1658,11 +1658,12 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| ```pcb_assembly(type, height, thickness)``` | Draw PCB assembly with spaces and fasteners in place |
| ```pcb_base(type, height, thickness, wall = 2)``` | Generate STL for a base with PCB spacers |
| ```pcb_component(comp, cutouts = false, angle = undef)``` | Draw pcb component from description |
| ```pcb_component_position(type, name)``` | Position child at the specified component position |
| ```pcb_components(type, cutouts = false, angle = undef)``` | Draw list of PCB components on the PCB |
| ```pcb_cutouts(type, angle = undef)``` | Make cut outs to clear components on a PCB |
| ```pcb_grid(type, x, y, z = 0)``` | Positions children at specified grid positions |
| ```pcb_screw_positions(type)``` | Positions children at the mounting hole positions |
| ```pcb_spacer(screw, height, wall = 1.8)``` | Generate STL for PCB spacer |
| ```pcb_spacer(screw, height, wall = 1.8, taper = 0)``` | Generate STL for PCB spacer |
| ```rj45(cutout = false)``` | Draw RJ45 Ethernet connector |
| ```terminal_35(ways)``` | Draw 3.5mm terminal block |
| ```uSD(size, cutout = false)``` | Draw uSD socket |

View File

@ -667,6 +667,22 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
}
}
module pcb_component_position(type, name) { //! Position child at the specified component position
for(comp = pcb_components(type)) {
p = pcb_coord(type, [comp.x, comp.y]);
if(comp[3][0] == "-") {
if(comp[3] == str("-", name))
translate([p.x, p.y])
vflip()
children();
}
else
if(comp[3] == name)
translate([p.x, p.y, pcb_thickness(type)])
children();
}
}
module pcb_components(type, cutouts = false, angle = undef) { //! Draw list of PCB components on the PCB
not_on_bom(pcb_parts_on_bom(type))
for(comp = pcb_components(type)) {