diff --git a/readme.md b/readme.md index 41c4e61..c5c30c3 100644 --- a/readme.md +++ b/readme.md @@ -21,34 +21,34 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa Ball_bearings Nuts Box Annotation Bom Batteries O_ring Butt_box Bezier Clip Belts Opengrab Cable_grommets Dogbones Global - Blowers Pcbs Carriers Fillet Polyholes - Bulldogs Pillars Corner_block Hanging_hole Rounded_rectangle - Buttons Pin_headers Door_hinge Layout Sphere - Cable_strips Psus Door_latch Maths Teardrops - Components Pulleys Fan_guard Offset - D_connectors Rails Fixing_block Quadrant - Displays Ring_terminals Flat_hinge Round - Extrusions Rockers Foot Rounded_cylinder - Fans Rod Handle Rounded_polygon - Fuseholder Screws Pcb_mount Sector - Geared_steppers Scs_bearing_blocks Psu_shroud Sweep - Green_terminals Sealing_strip Ribbon_clamp Thread - Hot_ends Sheets Screw_knob Tube - Hygrometer Sk_brackets Socket_box - Iecs Spades Ssr_shroud - Inserts Spools Strap_handle - Jack Springs - Kp_pillow_blocks Ssrs - Ldrs Stepper_motors - Leadnuts Toggles - Leds Transformers - Light_strips Tubings - Linear_bearings Variacs - Mains_sockets Veroboard - Meter Washers - Microswitches Wire - Microview Zipties - Modules + Blowers Pcb Carriers Fillet Polyholes + Bulldogs Pcbs Corner_block Hanging_hole Rounded_rectangle + Buttons Pillars Door_hinge Layout Sphere + Cable_strips Pin_headers Door_latch Maths Teardrops + Components Psus Fan_guard Offset + D_connectors Pulleys Fixing_block Quadrant + Displays Rails Flat_hinge Round + Extrusions Ring_terminals Foot Rounded_cylinder + Fans Rockers Handle Rounded_polygon + Fuseholder Rod Pcb_mount Sector + Geared_steppers Screws Psu_shroud Sweep + Green_terminals Scs_bearing_blocks Ribbon_clamp Thread + Hot_ends Sealing_strip Screw_knob Tube + Hygrometer Sheets Socket_box + Iecs Sk_brackets Ssr_shroud + Inserts Spades Strap_handle + Jack Spools + Kp_pillow_blocks Springs + Ldrs Ssrs + Leadnuts Stepper_motors + Leds Toggles + Light_strips Transformers + Linear_bearings Tubings + Mains_sockets Variacs + Meter Veroboard + Microswitches Washers + Microview Wire + Modules Zipties --- @@ -1765,6 +1765,88 @@ A permanent magnet that can be magnatized and de-magnatized electronically. | 1 | ```opengrab()``` | OpenGrab V3 electro permanent magnet | +Top + +--- + +## Pcb +PCBs and perfboard with optional components. The shape can be a rectangle with optionally rounded corners or a polygon for odd shapes like Arduino. + + +[vitamins/pcb.scad](vitamins/pcb.scad) Implementation. + +[tests/pcb.scad](tests/pcb.scad) Code for this example. + +### Properties +| Function | Description | +|:--- |:--- | +| ```hdmi_depth(type)``` | Front to back depth | +| ```hdmi_height(type)``` | Outside height above the PCB | +| ```hdmi_height1(type)``` | Inside height at the sides | +| ```hdmi_height2(type)``` | Inside height in the middle | +| ```hdmi_thickness(type)``` | Wall thickness of the metal | +| ```hdmi_width1(type)``` | Inside width at the top | +| ```hdmi_width2(type)``` | Inside width at the bottom | +| ```pcb_accessories(type)``` | List of accessories to go on the BOM, SD cards, USB cables, etc. | +| ```pcb_colour(type)``` | Colour of the subtrate | +| ```pcb_components(type)``` | List of components | +| ```pcb_grid(type)``` | Grid if a perfboard | +| ```pcb_hole_d(type)``` | Mounting hole diameter | +| ```pcb_holes(type)``` | List of hole positions | +| ```pcb_land_d(type)``` | Pad around mounting hole | +| ```pcb_length(type)``` | Length | +| ```pcb_name(type)``` | Description | +| ```pcb_parts_on_bom(type)``` | True if the parts should be separate BOM items | +| ```pcb_polygon(type)``` | Optional outline polygon for odd shaped boards | +| ```pcb_radius(type)``` | Corner radius | +| ```pcb_thickness(type)``` | Thickness | +| ```pcb_width(type)``` | Width | + +### Functions +| Function | Description | +|:--- |:--- | +| ```pcb_component_position(type, name, index = 0)``` | Return x y position of specified component | +| ```pcb_coord(type, p)``` | Convert offsets from the edge to coordinates relative to the centre | +| ```pcb_grid_pos(type, x, y, z = 0)``` | Returns a pcb grid position | +| ```pcb_screw(type, cap = hs_cap)``` | Mounting screw type | + +### Modules +| Module | Description | +|:--- |:--- | +| ```barrel_jack(cutout = false)``` | Draw barrel power jack | +| ```buzzer(height, diameter, colour)``` | Draw PCB buzzer with specified height, diameter and color | +| ```chip(length, width, thickness, colour, cutout = false)``` | Draw a coloured cube to represent a chip, or other rectangular component | +| ```flat_flex(cutout = false)``` | Draw flat flexistrip connector as used on RPI0 | +| ```flex(cutout = false)``` | Draw flexistrip connector | +| ```hdmi(type, cutout = false)``` | Draw HDMI socket | +| ```jack(cutout = false)``` | Draw 3.5mm jack | +| ```molex_254(ways)``` | Draw molex header | +| ```pcb(type)``` | Draw specified PCB | +| ```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 position | +| ```pcb_screw_positions(type)``` | Positions children at the mounting hole positions | +| ```pcb_spacer(screw, height, wall = 1.8, taper = 0)``` | Generate STL for PCB spacer | +| ```rj45(cutout = false)``` | Draw RJ45 Ethernet connector | +| ```terminal_35(ways, colour = "blue")``` | Draw 3.5mm terminal block | +| ```uSD(size, cutout = false)``` | Draw uSD socket | +| ```usb_Ax1(cutout = false)``` | Draw USB type A single socket | +| ```usb_Ax2(cutout = false)``` | Draw USB type A dual socket | +| ```usb_B(cutout = false)``` | Draw USB B connector | +| ```usb_uA(cutout = false)``` | Draw USB micro A connector | + +![pcb](tests/png/pcb.png) + +### Vitamins +| Qty | Module call | BOM entry | +| ---:|:--- |:---| +| 1 | ```pcb(TestPCB)``` | Test PCB | + + Top --- @@ -1834,8 +1916,9 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | ```pcb_screw_positions(type)``` | Positions children at the mounting hole positions | | ```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 | +| ```terminal_35(ways, colour = "blue")``` | Draw 3.5mm terminal block | | ```uSD(size, cutout = false)``` | Draw uSD socket | +| ```usb_Ax1(cutout = false)``` | Draw USB type A single socket | | ```usb_Ax2(cutout = false)``` | Draw USB type A dual socket | | ```usb_B(cutout = false)``` | Draw USB B connector | | ```usb_uA(cutout = false)``` | Draw USB micro A connector | @@ -1997,8 +2080,8 @@ Pin headers and sockets, etc. | ```idc_transition(type, cols = 5, skip = [], cutout = false)``` | Draw IDC transition header | | ```jst_xh_header(type, pin_count, right_angle=false, colour, pin_colour)``` | Draw JST XH connector | | ```pin(type, length = undef)``` | Draw a header pin | -| ```pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cutout = false)``` | Draw pin header | -| ```pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt = false, cutout = false)``` | Draw pin socket | +| ```pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cutout = false, colour)``` | Draw pin header | +| ```pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt = false, cutout = false, colour)``` | Draw pin socket | ![pin_headers](tests/png/pin_headers.png) diff --git a/tests/pcb.scad b/tests/pcb.scad index 7be8597..db51d89 100644 --- a/tests/pcb.scad +++ b/tests/pcb.scad @@ -1,5 +1,5 @@ // -// NopSCADlib Copyright Chris Palmer 2018 +// NopSCADlib Copyright Chris Palmer 2020 // nop.head@gmail.com // hydraraptor.blogspot.com // @@ -107,4 +107,3 @@ test_pcb = ["TestPCB", "Test PCB", if($preview) let($show_threads = true) pcb(test_pcb); - diff --git a/tests/png/pcb.png b/tests/png/pcb.png new file mode 100644 index 0000000..1007e7f Binary files /dev/null and b/tests/png/pcb.png differ