1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-09-02 20:02:46 +02:00

Compare commits

...

28 Commits

Author SHA1 Message Date
Chris Palmer
9da8a3cb26 Set ngb for most library assemblies. 2021-02-03 06:21:44 +00:00
Chris Palmer
36521cf0b9 Set ngb parameter of assembly() to remove it from the global BOM and merge
its parts into it parent's global BOM column.
2021-02-03 06:21:17 +00:00
Chris Palmer
f7fbbd5fe4 No longer runs markdown twice to make printme.html.
Instead uses empty spans to mark page breaks and then replaces them.
2021-02-01 00:10:54 +00:00
Chris Palmer
a769a38dff Generation of the html files included in the build times. 2021-01-31 10:52:26 +00:00
Chris Palmer
0485eeeb34 Removed page break at the end for printme.html 2021-01-31 10:50:20 +00:00
Chris Palmer
0a7208ff5a Fixed codespell path for multi-target builds. 2021-01-31 10:47:54 +00:00
Chris Palmer
f32182d6df Merge branch 'martinbudden-pulley_colour' 2021-01-26 17:35:02 +00:00
Chris Palmer
84fbd05f9b Updated readme for pulley colour. 2021-01-26 17:34:43 +00:00
Chris Palmer
2a1fa3fe6b Merge branch 'pulley_colour' of https://github.com/martinbudden/NopSCADlib into martinbudden-pulley_colour 2021-01-26 17:10:58 +00:00
Chris Palmer
176dc3231c Merge branch 'martinbudden-screw_m5_dome' 2021-01-26 17:03:32 +00:00
Chris Palmer
e7ac18e3c0 Updated images and readme. 2021-01-26 17:03:16 +00:00
Martin Budden
74b8dcb6d8 Added colour parameter to pulley. 2021-01-26 15:20:20 +00:00
Martin Budden
6269575fd4 Added M5_dome_screw. 2021-01-26 15:12:52 +00:00
Chris Palmer
2923e35725 Added microswitch_op_tol() and microswitch_fp_max() functions. 2021-01-24 21:44:57 +00:00
Chris Palmer
5a1b06fbb9 Merge branch 'martinbudden-BTT_SKR_MINI_E3_V2_0' 2021-01-24 11:20:37 +00:00
Chris Palmer
fd174bbfb4 Updated readme and images. 2021-01-24 11:20:01 +00:00
Chris Palmer
186f31bb09 Merge branch 'BTT_SKR_MINI_E3_V2_0' of https://github.com/martinbudden/NopSCADlib into martinbudden-BTT_SKR_MINI_E3_V2_0 2021-01-24 10:59:03 +00:00
Martin Budden
80f0490d58 Added BTT_SKR_MINI_E3_V2_0 pcb. 2021-01-24 10:55:49 +00:00
Chris Palmer
c9e9942070 Fixed some paths that used NopSCADlib instead of .. 2021-01-23 21:15:00 +00:00
Chris Palmer
e41366e20c Added explicit error message when tmp.png is not generated as expected.
Prints a newline after test runs rather than before.
2021-01-21 12:49:48 +00:00
Chris Palmer
0595fb5a92 Merge branch 'martinbudden-btt_skr_1_4' 2021-01-18 15:57:04 +00:00
Chris Palmer
abb676b75c Updated readme and cover picture for BTT_SKR_V1_4_TURBO PCB.
Added list of hidden pcbs to hide the boring ones.
Smaller PCBs closer together to make space.
2021-01-18 15:56:09 +00:00
Chris Palmer
19bae20e24 Merge branch 'btt_skr_1_4' of https://github.com/martinbudden/NopSCADlib into martinbudden-btt_skr_1_4 2021-01-18 12:54:03 +00:00
Chris Palmer
a7d181ffc4 Merge branch 'martinbudden-rectangular_tube' 2021-01-18 12:52:53 +00:00
Chris Palmer
6b2f8d282b Updated readme and images. 2021-01-18 12:52:41 +00:00
Chris Palmer
5bb95b2406 Merge branch 'rectangular_tube' of https://github.com/martinbudden/NopSCADlib into martinbudden-rectangular_tube 2021-01-18 10:34:51 +00:00
Martin Budden
bd2ea3f284 Added a rectangular tube. 2021-01-17 16:34:09 +00:00
Martin Budden
62183bcadc Added BTT SKR V1.4 Turbo pcb. 2021-01-17 16:29:42 +00:00
36 changed files with 577 additions and 244 deletions

View File

@@ -172,7 +172,7 @@ This is achieved by having a pair of modules: -
//! Place inserts in the bottom of the posts and push them home with a soldering iron with a conical bit heated to 200°C.
//
module handle_assembly() pose([225, 0, 150], [0, 0, 14]) //! Printed part with inserts in place
assembly("handle") {
assembly("handle", ngb = true) {
translate_z(handle_height())
stl_colour(pp1_colour) vflip() handle_stl();
@@ -201,6 +201,9 @@ When the parent assembly is shown exploded the handle's screws will be exploded
Note also the `pose([225, 0, 150], [0, 0, 14])` call before the `assembly()` call. This allows the sub-assembly to be posed differently in its build step but doesn't
affect its orientation in the parent assembly. The pose parameters are the rotation and the translation taken from the GUI.
Setting `ngb = true` in the `assembly()` prevents the handle assembly appearing as a columun in the top level BOM in the build instructions.
Instead its parts are merged into the parent BOM so the correct quantites are listed.
### Exploded diagrams
A lot of vitamins explode themselves when `$explode=1`. This is done with module `explode()` that can be passed a Z offset, or a 3D vector that gives the displacement

View File

@@ -2,6 +2,7 @@
{
"name": "base_assembly",
"big": null,
"ngb": false,
"count": 1,
"assemblies": {},
"vitamins": {
@@ -20,6 +21,7 @@
{
"name": "feet_assembly",
"big": null,
"ngb": false,
"count": 1,
"assemblies": {
"base_assembly": 1
@@ -46,6 +48,7 @@
{
"name": "mains_in_assembly",
"big": null,
"ngb": false,
"count": 1,
"assemblies": {
"feet_assembly": 1
@@ -82,6 +85,7 @@
{
"name": "main_assembly",
"big": null,
"ngb": false,
"count": 1,
"assemblies": {
"mains_in_assembly": 1

View File

@@ -15,6 +15,7 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
![Main Assembly](assemblies/main_assembled.png)
<span></span>
---
## Table of Contents
@@ -24,6 +25,7 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
1. [Mains In Assembly](#mains_in_assembly)
1. [Main Assembly](#main_assembly)
<span></span>
[Top](#TOP)
---
@@ -54,6 +56,7 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
| &nbsp;&nbsp;1&nbsp; | &nbsp;&nbsp;.&nbsp; | &nbsp;&nbsp;.&nbsp; | &nbsp;&nbsp;.&nbsp; | &nbsp;&nbsp;1&nbsp; | &nbsp;&nbsp;socket_box.stl |
| &nbsp;&nbsp;1&nbsp; | &nbsp;&nbsp;4&nbsp; | &nbsp;&nbsp;.&nbsp; | &nbsp;&nbsp;.&nbsp; | &nbsp;&nbsp;5&nbsp; | &nbsp;&nbsp;Total 3D printed parts count |
<span></span>
[Top](#TOP)
---
@@ -81,6 +84,7 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
![base_assembled](assemblies/base_assembled.png)
<span></span>
[Top](#TOP)
---
@@ -117,6 +121,7 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
![feet_assembled](assemblies/feet_assembled.png)
<span></span>
[Top](#TOP)
---
@@ -156,6 +161,7 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
![mains_in_assembled](assemblies/mains_in_assembled.png)
<span></span>
[Top](#TOP)
---
@@ -199,4 +205,5 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
![main_assembled](assemblies/main_assembled.png)
<span></span>
[Top](#TOP)

View File

@@ -35,7 +35,6 @@ include <vitamins/displays.scad>
include <vitamins/extrusions.scad>
include <vitamins/extrusion_brackets.scad>
include <vitamins/geared_steppers.scad>
include <vitamins/green_terminals.scad>
include <vitamins/hot_ends.scad>
include <vitamins/inserts.scad>
include <vitamins/kp_pillow_blocks.scad>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 870 KiB

After

Width:  |  Height:  |  Size: 875 KiB

View File

@@ -284,7 +284,7 @@ module camera_bracket(cam) { //! Make the STL for the camera bracket
}
module camera_assembly(cam, angle = 0) //! Camera case assembly
assembly(str("camera_", cam[0])) {
assembly(str("camera_", cam[0]), ngb = true) {
front = cam_front_size(cam);
screw = pcb_screw(camera_pcb(cam));
nut = screw_nut(screw);

View File

@@ -117,7 +117,7 @@ module corner_block(screw = def_screw, name = false) { //! Generate the STL for
}
module corner_block_assembly(screw = def_screw, name = false) //! The printed block with inserts
assembly(str("corner_block_M", 20 * screw_radius(screw))) {
assembly(str("corner_block_M", 20 * screw_radius(screw)), ngb = true) {
insert = screw_insert(screw);
stl_colour(name ? pp2_colour : pp1_colour)

View File

@@ -311,7 +311,7 @@ module _drag_chain_assembly(type, pos = 0, render = false) {
//! 1. Remove the support material from the links with side cutters.
//! 1. Clip the links together with the special ones at the ends.
module drag_chain_assembly(type, pos = 0, render = false) //! Drag chain assembly
assembly(str(drag_chain_name(type), "_drag_chain"), big = true)
assembly(str(drag_chain_name(type), "_drag_chain"), big = true, ngb = true)
if($children == 2)
_drag_chain_assembly(type, pos, render) {
children(0);

View File

@@ -106,7 +106,7 @@ module fixing_block(screw = def_screw) { //! Generate the STL
}
module fixing_block_assembly(screw = def_screw) pose([55, 180, 25], [0, 4.8, 4.8]) //! Printed part with the inserts inserted
assembly(str("fixing_block_M", 20 * screw_radius(screw))) {
assembly(str("fixing_block_M", 20 * screw_radius(screw)), ngb = true) {
translate_z(fixing_block_height(screw))
rotate([0, 180, 0])
stl_colour(pp1_colour) render() fixing_block(screw);

View File

@@ -129,7 +129,7 @@ module hinge_both(type) { //! Both parts together for printing
}
module hinge_assembly(type, angle = 0)
assembly(str("hinge_", type[0])) { //! Assembled hinge
assembly(str("hinge_", type[0]), ngb = true) { //! Assembled hinge
kr = hinge_knuckle_dia(type) / 2;
hr = hinge_pin_dia(type) / 2;
w = hinge_width(type);

View File

@@ -132,7 +132,7 @@ module insert_foot(type = insert_foot) { //! Generate STL for foot with insert
//! Place the insert in the bottom of the foot and push home with a soldering iron with a conical bit heated to 200&deg;C.
//
module insert_foot_assembly(type = insert_foot) //! Printed part with insert in place
assembly("insert_foot") {
assembly("insert_foot", ngb = true) {
screw = foot_screw(type);
insert = screw_insert(screw);

View File

@@ -81,7 +81,7 @@ module handle_stl() { //! generate the STL
//! Place inserts in the bottom of the posts and push them home with a soldering iron with a conical bit heated to 200&deg;C.
//
module handle_assembly() pose([225, 0, 150], [0, 0, 14]) //! Printed part with inserts in place
assembly("handle") {
assembly("handle", ngb = true) {
translate_z(handle_height())
stl_colour(pp1_colour) vflip() handle_stl();

View File

@@ -21,8 +21,8 @@
//! Creative Commons - Attribution - Share Alike license (see <https://creativecommons.org/licenses/by-sa/3.0/>)
//
include <NopSCADlib/core.scad>
include <NopSCADlib/vitamins/pulleys.scad>
include <../core.scad>
include <../vitamins/pulleys.scad>
printed_pulley_GT2_profile = [[0.747183,-0.5],[0.747183,0],[0.647876,0.037218],[0.598311,0.130528],[0.578556,0.238423],[0.547158,0.343077],[0.504649,0.443762],[0.451556,0.53975],[0.358229,0.636924],[0.2484,0.707276],[0.127259,0.750044],[0,0.76447],[-0.127259,0.750044],[-0.2484,0.707276],[-0.358229,0.636924],[-0.451556,0.53975],[-0.504797,0.443762],[-0.547291,0.343077],[-0.578605,0.238423],[-0.598311,0.130528],[-0.648009,0.037218],[-0.747183,0],[-0.747183,-0.5]];
@@ -180,7 +180,7 @@ module printed_pulley(type) { //! Draw a printable pulley
}
module printed_pulley_assembly(type, colour = pp1_colour) //! Draw a printed pulley with its grub screws in place
assembly(str("printed_pulley_", type[0])) {
assembly(str("printed_pulley_", type[0]), ngb = true) {
translate_z(pulley_offset(type)) {
stl_colour(colour)
if(printed_pulley_inverted(type))

View File

@@ -143,7 +143,7 @@ module psu_shroud(type, cable_d, name, cables = 1) { //! Generate the STL file f
}
module psu_shroud_assembly(type, cable_d, name, cables = 1) //! The printed parts with inserts fitted
assembly(str("PSU_shroud_", name)) {
assembly(str("PSU_shroud_", name), ngb = true) {
translate_z(psu_shroud_height(type))
vflip()

View File

@@ -82,7 +82,7 @@ module ribbon_clamp(ways, screw = screw) { //! Generate STL for given number of
}
module ribbon_clamp_assembly(ways, screw = screw) pose([55, 180, 25]) //! Printed part with inserts in place
assembly(let(screw_d = screw_radius(screw) * 2)str("ribbon_clamp_", ways, screw_d != 3 ? str("_", screw_d) : "")) {
assembly(let(screw_d = screw_radius(screw) * 2)str("ribbon_clamp_", ways, screw_d != 3 ? str("_", screw_d) : ""), ngb = true) {
h = ribbon_clamp_height(screw);
insert = screw_insert(screw);

View File

@@ -59,7 +59,7 @@ module screw_knob(screw) { //! Generate the STL for a knob to fit the specified
//! Place the screw through the printed part
module screw_knob_assembly(screw, length) //! Assembly with the screw in place
assembly(str("screw_knob_M", 20 * screw_radius(screw), "_", length)) {
assembly(str("screw_knob_M", 20 * screw_radius(screw), "_", length), ngb = true) {
translate_z(knob_height)
vflip()
stl_colour(pp1_colour) screw_knob(screw);

View File

@@ -107,7 +107,7 @@ module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a spec
}
module ssr_shroud_assembly(type, cable_d, name) //! The printed parts with inserts fitted
assembly(str("SSR_shroud_", name)) {
assembly(str("SSR_shroud_", name), ngb = true) {
translate_z(ssr_shroud_height(type))
vflip()

View File

@@ -162,7 +162,7 @@ module strap_end(type = strap) { //! Generate the STL for end piece
//! * Place the insert into the hole and push home with a soldering iron with a tapered bit heated to 200&deg;C.
//
module strap_end_assembly(type = strap)
assembly("strap_end") {
assembly("strap_end", ngb = true) {
stl_colour(pp1_colour)
strap_end(type);

View File

@@ -1750,7 +1750,11 @@ UK 13A sockets at the moment.
---
<a name="Microswitches"></a>
## Microswitches
Used for limit switches.
Used for limit switches. Currently only the button type is supported as the lever and roller types are less accurate.
The switch is drawn with the button at the nominal operation point. This can be plus or minus `microswitch_op_tol(type)`.
When the button is released it comes out by a maximum of `microswitch_fp_max(type)` from the nominal operating point.
[vitamins/microswitches.scad](vitamins/microswitches.scad) Object definitions.
@@ -1763,14 +1767,16 @@ Used for limit switches.
|:--- |:--- |
| `microswitch_body_clr(type)` | Body colour |
| `microswitch_button_clr(type)` | Button colour |
| `microswitch_button_pos(type)` | Button position |
| `microswitch_button_pos(type)` | Button position at operating point |
| `microswitch_button_t(type)` | Button thickness |
| `microswitch_button_w(type)` | Button width |
| `microswitch_fp_max(type)` | Free position maximum |
| `microswitch_hole_d(type)` | Screw hole diameter |
| `microswitch_holes(type)` | Hole positions |
| `microswitch_leg(type)` | Leg types |
| `microswitch_legs(type)` | Leg positions |
| `microswitch_length(type)` | Body length |
| `microswitch_op_tol(type)` | Operating position +/- tolerance |
| `microswitch_radius(type)` | Body corner radius |
| `microswitch_thickness(type)` | Body thickness |
| `microswitch_width(type)` | Body width |
@@ -2305,10 +2311,12 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| ---:|:--- |:---|
| 1 | `pcb(ArduinoLeonardo)` | Arduino Leonardo |
| 1 | `pcb(ArduinoUno3)` | Arduino Uno R3 |
| 1 | `pcb(BTT_SKR_MINI_E3_V2_0)` | BigTreeTech SKR Mini E3 v2.0 |
| 1 | `pcb(BTT_SKR_V1_4_TURBO)` | BigTreeTech SKR v1.4 Turbo |
| 1 | | Cat 5 patch cable 300mm |
| 1 | `d_plug(DCONN15, pcb = true)` | D-type 15 way PCB mount plug |
| 1 | `pcb(DuetE)` | Duet 2 Ethernet electronics |
| 1 | `pcb(Duex2)` | Duex2 expansion board |
| 1 | `pcb(Duex2)` | Duex2 expansion board - not shown |
| 1 | `pcb(Duex5)` | Duex5 expansion board |
| 1 | `pcb(ESP-01)` | ESP-01 |
| 1 | `pcb(EnviroPlus)` | Enviro+ |
@@ -2316,15 +2324,17 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 1 | `pcb(Keyes5p1)` | Keyes5.1 Arduino Uno expansion board |
| 1 | `pcb(MP1584EN)` | MP1584EN 3A buck converter |
| 1 | `pcb(MT3608)` | MT3608 boost converter module |
| 1 | `pcb(Melzi)` | Melzi electronics - not shown |
| 4 | | Micro SD card |
| 1 | | Micro SD card - not shown |
| 1 | `molex_254(2)` | Molex KK header 2 way |
| 1 | `molex_254(3)` | Molex KK header 3 way |
| 16 | `nut(M2_nut, nyloc = true)` | Nut M2 x 1.6mm nyloc |
| 34 | `nut(M2p5_nut, nyloc = true)` | Nut M2.5 x 2.2mm nyloc |
| 12 | `nut(M3_nut, nyloc = true)` | Nut M3 x 2.4mm nyloc |
| 12 | `nut(M4_nut, nyloc = true)` | Nut M4 x 3.2mm nyloc |
| 17 | `nut(M3_nut, nyloc = true)` | Nut M3 x 2.4mm nyloc |
| 8 | `nut(M4_nut, nyloc = true)` | Nut M4 x 3.2mm nyloc |
| 1 | `pcb(PI_IO)` | PI_IO V2 |
| 1 | `pcb(PSU12V1A)` | PSU 12V 1A |
| 1 | `pcb(PSU12V1A)` | PSU 12V 1A - not shown |
| 1 | `pcb(PERF60x40)` | Perfboard 60 x 40mm |
| 1 | `pcb(PERF70x30)` | Perfboard 70 x 30mm |
| 1 | `pcb(PERF70x50)` | Perfboard 70 x 50mm |
@@ -2343,16 +2353,18 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 12 | `screw(M2p5_pan_screw, 25)` | Screw M2.5 pan x 25mm |
| 4 | `screw(M2p5_pan_screw, 30)` | Screw M2.5 pan x 30mm |
| 4 | `screw(M3_cap_screw, 16)` | Screw M3 cap x 16mm |
| 8 | `screw(M3_cap_screw, 30)` | Screw M3 cap x 30mm |
| 12 | `screw(M4_cap_screw, 35)` | Screw M4 cap x 35mm |
| 4 | `screw(M3_cap_screw, 30)` | Screw M3 cap x 30mm |
| 9 | `screw(M3_cap_screw, 35)` | Screw M3 cap x 35mm |
| 8 | `screw(M4_cap_screw, 35)` | Screw M4 cap x 35mm |
| 1 | `pcb(TP4056)` | TP4056 Li-lon Battery charger module |
| 3 | `terminal_35(2)` | Terminal block 2 way 3.5mm |
| 2 | `green_terminal(gt_2p54, 4)` | Terminal block 4 way 0.1" |
| 1 | | USB A to Mini B lead - not shown |
| 1 | `pcb(WD2002SJ)` | WD2002SJ Buck Boost DC-DC converter |
| 16 | `washer(M2_washer)` | Washer M2 x 5mm x 0.3mm |
| 34 | `washer(M2p5_washer)` | Washer M2.5 x 5.9mm x 0.5mm |
| 12 | `washer(M3_washer)` | Washer M3 x 7mm x 0.5mm |
| 12 | `washer(M4_washer)` | Washer M4 x 9mm x 0.8mm |
| 17 | `washer(M3_washer)` | Washer M3 x 7mm x 0.5mm |
| 8 | `washer(M4_washer)` | Washer M4 x 9mm x 0.8mm |
| 1 | `pcb(ZC_A0591)` | ZC-A0591 ULN2003 driver PCB |
### Printed
@@ -2368,13 +2380,13 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 4 | pcb_spacer25150_2.stl |
| 4 | pcb_spacer25160_2.stl |
| 4 | pcb_spacer25170_2.stl |
| 4 | pcb_spacer25190.stl |
| 4 | pcb_spacer25200.stl |
| 4 | pcb_spacer25210.stl |
| 2 | pcb_spacer2590.stl |
| 2 | pcb_spacer2580.stl |
| 4 | pcb_spacer30180.stl |
| 4 | pcb_spacer30190.stl |
| 5 | pcb_spacer30210.stl |
| 4 | pcb_spacer30220.stl |
| 4 | pcb_spacer3050.stl |
| 4 | pcb_spacer40220.stl |
| 4 | pcb_spacer40230.stl |
| 4 | pcb_spacer40240.stl |
@@ -2606,8 +2618,8 @@ Timing belt pulleys, both toothed and plain with internal bearings for idlers.
### Modules
| Module | Description |
|:--- |:--- |
| `pulley(type)` | Draw a pulley |
| `pulley_assembly(type)` | Draw a pulley with its grub screws in place |
| `pulley(type, colour = silver)` | Draw a pulley |
| `pulley_assembly(type, colour = silver)` | Draw a pulley with its grub screws in place |
![pulleys](tests/png/pulleys.png)
@@ -2942,6 +2954,7 @@ For an explanation of `screw_polysink()` see <https://hydraraptor.blogspot.com/2
| 1 | `screw(M4_pan_screw, 30)` | Screw M4 pan x 30mm |
| 1 | `screw(M5_cap_screw, 30)` | Screw M5 cap x 30mm |
| 1 | `screw(M5_cs_cap_screw, 30)` | Screw M5 cs cap x 30mm |
| 1 | `screw(M5_dome_screw, 30)` | Screw M5 dome x 30mm |
| 1 | `screw(M5_hex_screw, 30)` | Screw M5 hex x 30mm |
| 1 | `screw(M5_pan_screw, 30)` | Screw M5 pan x 30mm |
| 1 | `screw(M6_cap_screw, 30)` | Screw M6 cap x 30mm |
@@ -3796,7 +3809,7 @@ Veroboard with mounting holes, track breaks, removed tracks, solder points and c
| `vero_mounting_hole_positions(type)` | Positions children at the mounting holes |
| `vero_mounting_holes(type, h = 100)` | Drill mounting holes in a panel |
| `veroboard(type)` | Draw specified veroboard with missing tracks and track breaks |
| `veroboard_assembly(type, height, thickness, flip = false)` | Draw the assembly with components and fasteners in place |
| `veroboard_assembly(type, height, thickness, flip = false, ngb = false)` | Draw the assembly with components and fasteners in place |
![veroboard](tests/png/veroboard.png)
@@ -5970,6 +5983,7 @@ Simple tube or ring
### Modules
| Module | Description |
|:--- |:--- |
| `rectangular_tube(size, center = true, thickness = 1, fillet = 0.5)` | Create a retangular tube with filleted corners |
| `ring(or, ir)` | Create a ring with specified external and internal radii |
| `tube(or, ir, h, center = true)` | Create a tube with specified external and internal radii and height `h` |
| `woven_tube(or, ir, h, center= true, colour = grey(30)` | Create a woven tube with specified external and internal radii, height `h`, colours, warp and weft |
@@ -5989,6 +6003,9 @@ Assembly views shown in the instructions can be large or small and this is deduc
parts are used.
This heuristic isn't always correct, so the default can be overridden by setting the `big` parameter of `assembly` to `true` or `false`.
Setting the `ngb` parameter of `assembly` to `true` removes its column from the global BOM and merges it parts into its parent assembly column of the global BOM.
This is to prevent the global BOM page becoming too wide in large projects by having it include just the major assemblies.
The example below shows how to define a vitamin and incorporate it into an assembly with sub-assemblies and make an exploded view.
The resulting flat BOM is shown but heirachical BOMs are also generated for real projects.
@@ -6008,7 +6025,7 @@ The resulting flat BOM is shown but heirachical BOMs are also generated for real
### Modules
| Module | Description |
|:--- |:--- |
| `assembly(name, big = undef)` | Name an assembly that will appear on the BOM, there needs to a module named `<name>_assembly` to make it. `big` can force big or small assembly diagrams. |
| `assembly(name, big = undef, ngb = false)` | Name an assembly that will appear on the BOM, there needs to a module named `<name>_assembly` to make it. `big` can force big or small assembly diagrams. |
| `dxf(name)` | Name a dxf that will appear on the BOM, there needs to a module named `<name>_dxf` to make it |
| `explode(d, explode_children = false, offset = [0,0,0])` | Explode children by specified Z distance or vector `d`, option to explode grand children |
| `hidden()` | Make item invisible, except on the BOM |

View File

@@ -60,6 +60,7 @@ class BOM:
def __init__(self, name):
self.name = name
self.big = None
self.ngb = False
self.count = 1
self.vitamins = {}
self.printed = {}
@@ -73,6 +74,7 @@ class BOM:
return {
"name" : self.name,
"big" : self.big,
"ngb" : self.ngb,
"count" : self.count,
"assemblies" : assemblies,
"vitamins" : {v : self.vitamins[v].data() for v in self.vitamins},

View File

@@ -50,6 +50,9 @@ def do_cmd(cmd, output = sys.stdout):
return subprocess.call(cmd, stdout = output, stderr = output)
def compare_images(a, b, c):
if not os.path.isfile(b):
print(Fore.MAGENTA + "Failed to generate %s while making %s" % (b, a), Fore.WHITE)
sys.exit(1)
if not os.path.isfile(a):
return -1
log_name = 'magick.log'
@@ -126,14 +129,13 @@ def tests(tests):
#
# List of individual part files
#
scads = [i for i in sorted(os.listdir(scad_dir), key = lambda s: s.lower()) if i[-5:] == ".scad"]
types = []
for scad in scads:
base_name = scad[:-5]
if not tests or base_name in tests:
done.append(base_name)
print('\n'+base_name)
print(base_name)
cap_name = base_name[0].capitalize() + base_name[1:]
base_name = base_name.lower()
scad_name = scad_dir + '/' + scad
@@ -240,6 +242,7 @@ def tests(tests):
BOM = bom.parse_bom()
with open(bom_name, 'wt') as outfile:
json.dump(BOM.flat_data(), outfile, indent = 4)
print()
with open(bom_name, "rt") as bom_file:
BOM = json.load(bom_file)

View File

@@ -36,6 +36,7 @@ import blurb
import bom
import shutil
import re
import copy
from colorama import Fore
def is_assembly(s):
@@ -74,19 +75,17 @@ def bom_to_assemblies(bom_dir, bounds_map):
# Remove the main assembly if it is a shell
#
if flat_bom:
ass = flat_bom[-1]
ass = flat_bom[-1]
if len(ass["assemblies"]) < 2 and not ass["vitamins"] and not ass["printed"] and not ass["routed"]:
flat_bom = flat_bom[:-1]
return [assembly["name"] for assembly in flat_bom]
def eop(print_mode, doc_file, last = False, first = False):
if print_mode:
print('\n<div style="page-break-after: always;"></div>', file = doc_file)
else:
if not first:
print('[Top](#TOP)', file = doc_file)
if not last:
print("\n---", file = doc_file)
def eop(doc_file, last = False, first = False):
print('<span></span>', file = doc_file) # An invisable marker for page breaks because markdown takes much longer if the document contains a div
if not first:
print('[Top](#TOP)', file = doc_file)
if not last:
print("\n---", file = doc_file)
def pad(s, before, after = 0):
return '&nbsp;' * before + str(s) + '&nbsp;' * after
@@ -103,6 +102,27 @@ def usage():
print("\nusage:\n\t views [target_config] [<name1>_assembly] ... [<nameN>_assembly] - Create assembly images and readme.")
sys.exit(1)
types = ["vitamins", "printed", "routed"]
def merged(bom):
bom = copy.deepcopy(bom)
for aname in bom["assemblies"]:
count = bom["assemblies"][aname]
for ass in flat_bom:
if ass['name'] == aname and ass['ngb']:
merged_assembly = merged(ass)
total = ass['count']
for t in types:
for thing in merged_assembly[t]:
items = merged_assembly[t][thing]['count'] * count // total
if thing in bom[t]:
bom[t][thing]['count'] += items
else:
bom[t][thing] = merged_assembly[t][thing]
bom[t][thing]['count'] = items
break
return bom
def views(target, do_assemblies = None):
done_assemblies = []
#
@@ -202,193 +222,217 @@ def views(target, do_assemblies = None):
if module == 'main_assembly':
main_blurb = blurb.scrape_module_blurb(lines[:line_no])
line_no += 1
times.print_times()
#
# Build the document
#
for print_mode in [True, False]:
doc_name = top_dir + "readme.md"
with open(doc_name, "wt") as doc_file:
#
# Title, description and picture
#
project = ' '.join(word[0].upper() + word[1:] for word in os.path.basename(os.getcwd()).split('_'))
print('<a name="TOP"></a>\n# %s' % project, file = doc_file)
main_file = bom.find_scad_file('main_assembly')
if not main_file:
raise Exception("can't find source for main_assembly")
text = blurb.scrape_blurb(source_dir + '/' + main_file)
blurbs = blurb.split_blurb(text)
if len(text):
print(blurbs[0], file = doc_file)
else:
if print_mode:
print(Fore.MAGENTA + "Missing project description" + Fore.WHITE)
#
# Only add the image if the first blurb section doesn't contain one.
#
if not re.search(r'\!\[.*\]\(.*\)', blurbs[0], re.MULTILINE):
print('![Main Assembly](assemblies/%s.png)\n' % flat_bom[-1]["name"].replace('_assembly', '_assembled'), file = doc_file)
eop(print_mode, doc_file, first = True)
#
# Build TOC
#
print('## Table of Contents', file = doc_file)
print('1. [Parts list](#Parts_list)', file = doc_file)
for ass in flat_bom:
name = ass["name"]
cap_name = titalise(name)
print('1. [%s](#%s)' % (cap_name, name), file = doc_file)
print(file = doc_file)
if len(blurbs) > 1:
print(blurbs[1], file = doc_file)
eop(print_mode, doc_file)
#
# Global BOM
#
print('<a name="Parts_list"></a>\n## Parts list', file = doc_file)
types = ["vitamins", "printed", "routed"]
headings = {"vitamins" : "vitamins", "printed" : "3D printed parts", "routed" : "CNC routed parts"}
things = {}
doc_name = top_dir + "readme.md"
with open(doc_name, "wt") as doc_file:
#
# Title, description and picture
#
project = ' '.join(word[0].upper() + word[1:] for word in os.path.basename(os.getcwd()).split('_'))
print('<a name="TOP"></a>', file = doc_file)
print('# %s' % project, file = doc_file)
main_file = bom.find_scad_file('main_assembly')
if not main_file:
raise Exception("can't find source for main_assembly")
text = blurb.scrape_blurb(source_dir + '/' + main_file)
blurbs = blurb.split_blurb(text)
if len(text):
print(blurbs[0], file = doc_file)
else:
print(Fore.MAGENTA + "Missing project description" + Fore.WHITE)
#
# Only add the image if the first blurb section doesn't contain one.
#
if not re.search(r'\!\[.*\]\(.*\)', blurbs[0], re.MULTILINE):
print('![Main Assembly](assemblies/%s.png)\n' % flat_bom[-1]["name"].replace('_assembly', '_assembled'), file = doc_file)
eop(doc_file, first = True)
#
# Build TOC
#
print('## Table of Contents', file = doc_file)
print('1. [Parts list](#Parts_list)', file = doc_file)
for ass in flat_bom:
name = ass["name"]
cap_name = titalise(name)
print('1. [%s](#%s)' % (cap_name, name), file = doc_file)
print(file = doc_file)
if len(blurbs) > 1:
print(blurbs[1], file = doc_file)
eop(doc_file)
#
# Global BOM
#
global_bom = [merged(ass) for ass in flat_bom if not ass['ngb']]
print('<a name="Parts_list"></a>\n## Parts list', file = doc_file)
headings = {"vitamins" : "vitamins", "printed" : "3D printed parts", "routed" : "CNC routed parts"}
things = {}
for t in types:
things[t] = {}
for ass in flat_bom:
for t in types:
things[t] = {}
for ass in flat_bom:
for t in types:
for thing in ass[t]:
if thing in things[t]:
things[t][thing] += ass[t][thing]["count"]
else:
things[t][thing] = ass[t][thing]["count"]
for ass in flat_bom:
name = titalise(ass["name"][:-9]).replace(' ','&nbsp;')
print('| <span style="writing-mode: vertical-rl; text-orientation: mixed;">%s</span> ' % name, file = doc_file, end = '')
print('| <span style="writing-mode: vertical-rl; text-orientation: mixed;">TOTALS</span> | |', file = doc_file)
for thing in ass[t]:
if thing in things[t]:
things[t][thing] += ass[t][thing]["count"]
else:
things[t][thing] = ass[t][thing]["count"]
for ass in global_bom:
name = titalise(ass["name"][:-9]).replace(' ','&nbsp;')
if ass["count"] > 1:
name = "%d x %s" % (ass["count"], name)
print('| <span style="writing-mode: vertical-rl; text-orientation: mixed;">%s</span> ' % name, file = doc_file, end = '')
print('| <span style="writing-mode: vertical-rl; text-orientation: mixed;">TOTALS</span> | |', file = doc_file)
print(('|---:' * len(global_bom) + '|---:|:---|'), file = doc_file)
print(('|---:' * len(flat_bom) + '|---:|:---|'), file = doc_file)
for t in types:
if things[t]:
totals = {}
heading = headings[t][0:1].upper() + headings[t][1:]
print(('| ' * len(flat_bom) + '| | **%s** |') % heading, file = doc_file)
for thing in sorted(things[t], key = lambda s: s.split(":")[-1]):
for ass in flat_bom:
count = ass[t][thing]["count"] if thing in ass[t] else 0
print('| %s ' % pad(count if count else '.', 2, 1), file = doc_file, end = '')
name = ass["name"]
if name in totals:
totals[name] += count
else:
totals[name] = count
print('| %s | %s |' % (pad(things[t][thing], 2, 1), pad(thing.split(":")[-1], 2)), file = doc_file)
grand_total = 0
for ass in flat_bom:
for t in types:
if things[t]:
totals = {}
grand_total2 = 0
heading = headings[t][0].upper() + headings[t][1:]
print(('| ' * len(global_bom) + '| | **%s** |') % heading, file = doc_file)
for thing in sorted(things[t], key = lambda s: s.split(":")[-1]):
for ass in global_bom:
count = ass[t][thing]["count"] if thing in ass[t] else 0
print('| %s ' % pad(count if count else '.', 2, 1), file = doc_file, end = '')
name = ass["name"]
total = totals[name] if name in totals else 0
print('| %s ' % pad(total if total else '.', 2, 1), file = doc_file, end = '')
grand_total += total
print("| %s | %s |" % (pad(grand_total, 2, 1), pad('Total %s count' % headings[t], 2)), file = doc_file)
if name in totals:
totals[name] += count
else:
totals[name] = count
grand_total2 += count
print('| %s | %s |' % (pad(things[t][thing], 2, 1), pad(thing.split(":")[-1], 2)), file = doc_file)
print(file = doc_file)
if len(blurbs) > 2:
print(blurbs[2], file = doc_file)
eop(print_mode, doc_file)
#
# Assembly instructions
#
for ass in flat_bom:
name = ass["name"]
cap_name = titalise(name)
if ass["count"] > 1:
print('<a name="%s"></a>\n## %d x %s' % (name, ass["count"], cap_name), file = doc_file)
else:
print('<a name="%s"></a>\n## %s' % (name, cap_name), file = doc_file)
vitamins = ass["vitamins"]
if vitamins:
print("### Vitamins", file = doc_file)
print("|Qty|Description|", file = doc_file)
print("|---:|:----------|", file = doc_file)
for v in sorted(vitamins, key = lambda s: s.split(":")[-1]):
print("|%d|%s|" % (vitamins[v]["count"], v.split(":")[1]), file = doc_file)
print("\n", file = doc_file)
printed = ass["printed"]
if printed:
print('### 3D Printed parts', file = doc_file)
keys = sorted(list(printed.keys()))
for i, p in enumerate(keys):
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', printed[p]["count"], p), file = doc_file, end = '')
if (i % 3) == 2 or i == len(printed) - 1:
n = (i % 3) + 1
print('\n|%s' % ('---|' * n), file = doc_file)
for j in range(n):
part = keys[i - n + j + 1]
print('| ![%s](stls/%s) %s' % (part, part.replace('.stl','.png'), '|\n' if j == j - 1 else ''), end = '', file = doc_file)
print('\n', file = doc_file)
print('\n', file = doc_file)
routed = ass["routed"]
if routed:
print("### CNC Routed parts", file = doc_file)
keys = sorted(list(routed.keys()))
for i, r in enumerate(keys):
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', routed[r]["count"], r), file = doc_file, end = '')
if (i % 3) == 2 or i == len(routed) - 1:
n = (i % 3) + 1
print('\n|%s' % ('---|' * n), file = doc_file)
for j in range(n):
part = keys[i - n + j + 1]
print('| ![%s](dxfs/%s) %s' % (part, part.replace('.dxf','.png'), '|\n' if j == j - 1 else ''), end = '', file = doc_file)
print('\n', file = doc_file)
print('\n', file = doc_file)
sub_assemblies = ass["assemblies"]
if sub_assemblies:
print("### Sub-assemblies", file = doc_file)
keys = sorted(list(sub_assemblies.keys()))
for i, a in enumerate(keys):
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', sub_assemblies[a], a), file = doc_file, end = '')
if (i % 3) == 2 or i == len(keys) - 1:
n = (i % 3) + 1
print('\n|%s' % ('---|' * n), file = doc_file)
for j in range(n):
a = keys[i - n + j + 1].replace('_assembly', '_assembled')
print('| ![%s](assemblies/%s) %s' % (a, a + '_tn.png', '|\n' if j == j - 1 else ''), end = '', file = doc_file)
print('\n', file = doc_file)
print('\n', file = doc_file)
small = not ass["big"]
suffix = '_tn.png' if small else '.png'
print('### Assembly instructions', file = doc_file)
print('![%s](assemblies/%s)\n' % (name, name + suffix), file = doc_file)
if "blurb" in ass and ass["blurb"]:
print(ass["blurb"], file = doc_file)
else:
if print_mode:
print(Fore.MAGENTA + "Missing instructions for %s" % name, Fore.WHITE)
name = name.replace('_assembly', '_assembled')
print('![%s](assemblies/%s)\n' % (name, name + suffix), file = doc_file)
eop(print_mode, doc_file, last = ass == flat_bom[-1] and not main_blurb)
#
# If main module is suppressed print any blurb here
#
if main_blurb:
print(main_blurb, file = doc_file)
eop(print_mode, doc_file, last = True)
grand_total = 0
for ass in global_bom:
name = ass["name"]
total = totals[name] if name in totals else 0
print('| %s ' % pad(total if total else '.', 2, 1), file = doc_file, end = '')
grand_total += total
print("| %s | %s |" % (pad(grand_total, 2, 1), pad('Total %s count' % headings[t], 2)), file = doc_file)
assert grand_total == grand_total2
print(file = doc_file)
if len(blurbs) > 2:
print(blurbs[2], file = doc_file)
eop(doc_file)
#
# Convert to HTML
# Assembly instructions
#
html_name = "printme.html" if print_mode else "readme.html"
with open(top_dir + html_name, "wt") as html_file:
do_cmd(("python -m markdown -x tables -x sane_lists " + doc_name).split(), html_file)
for ass in flat_bom:
name = ass["name"]
cap_name = titalise(name)
print('<a name="%s"></a>' % name, file = doc_file)
if ass["count"] > 1:
print('## %d x %s' % (ass["count"], cap_name), file = doc_file)
else:
print('## %s' % cap_name, file = doc_file)
vitamins = ass["vitamins"]
if vitamins:
print("### Vitamins", file = doc_file)
print("|Qty|Description|", file = doc_file)
print("|---:|:----------|", file = doc_file)
for v in sorted(vitamins, key = lambda s: s.split(":")[-1]):
print("|%d|%s|" % (vitamins[v]["count"], v.split(":")[1]), file = doc_file)
print("\n", file = doc_file)
printed = ass["printed"]
if printed:
print('### 3D Printed parts', file = doc_file)
keys = sorted(list(printed.keys()))
for i, p in enumerate(keys):
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', printed[p]["count"], p), file = doc_file, end = '')
if (i % 3) == 2 or i == len(printed) - 1:
n = (i % 3) + 1
print('\n|%s' % ('---|' * n), file = doc_file)
for j in range(n):
part = keys[i - n + j + 1]
print('| ![%s](stls/%s) %s' % (part, part.replace('.stl','.png'), '|\n' if j == j - 1 else ''), end = '', file = doc_file)
print('\n', file = doc_file)
print('\n', file = doc_file)
routed = ass["routed"]
if routed:
print("### CNC Routed parts", file = doc_file)
keys = sorted(list(routed.keys()))
for i, r in enumerate(keys):
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', routed[r]["count"], r), file = doc_file, end = '')
if (i % 3) == 2 or i == len(routed) - 1:
n = (i % 3) + 1
print('\n|%s' % ('---|' * n), file = doc_file)
for j in range(n):
part = keys[i - n + j + 1]
print('| ![%s](dxfs/%s) %s' % (part, part.replace('.dxf','.png'), '|\n' if j == j - 1 else ''), end = '', file = doc_file)
print('\n', file = doc_file)
print('\n', file = doc_file)
sub_assemblies = ass["assemblies"]
if sub_assemblies:
print("### Sub-assemblies", file = doc_file)
keys = sorted(list(sub_assemblies.keys()))
for i, a in enumerate(keys):
print('%s %d x %s |' % ('\n|' if not (i % 3) else '', sub_assemblies[a], a), file = doc_file, end = '')
if (i % 3) == 2 or i == len(keys) - 1:
n = (i % 3) + 1
print('\n|%s' % ('---|' * n), file = doc_file)
for j in range(n):
a = keys[i - n + j + 1].replace('_assembly', '_assembled')
print('| ![%s](assemblies/%s) %s' % (a, a + '_tn.png', '|\n' if j == j - 1 else ''), end = '', file = doc_file)
print('\n', file = doc_file)
print('\n', file = doc_file)
small = not ass["big"]
suffix = '_tn.png' if small else '.png'
print('### Assembly instructions', file = doc_file)
print('![%s](assemblies/%s)\n' % (name, name + suffix), file = doc_file)
if "blurb" in ass and ass["blurb"]:
print(ass["blurb"], file = doc_file)
else:
print(Fore.MAGENTA + "Missing instructions for %s" % name, Fore.WHITE)
name = name.replace('_assembly', '_assembled')
print('![%s](assemblies/%s)\n' % (name, name + suffix), file = doc_file)
eop(doc_file, last = ass == flat_bom[-1] and not main_blurb)
#
# If main module is suppressed print any blurb here
#
if main_blurb:
print(main_blurb, file = doc_file)
eop(doc_file, last = True)
#
# Convert to HTML
#
html_name = 'readme.html'
t = time.time()
with open(top_dir + html_name, "wt") as html_file:
do_cmd(("python -m markdown -x tables -x sane_lists " + doc_name).split(), html_file)
times.add_time(top_dir + html_name, t)
times.print_times()
#
# Make the printme.html by replacing empty spans that invisbly mark the page breaks by page break divs.
#
with open(top_dir + 'readme.html', 'rt') as src:
lines = src.readlines()
i = 0
with open(top_dir + 'printme.html', 'wt') as dst:
while i < len(lines):
line = lines[i]
if line.startswith('<p><span></span>'): # Empty span used to mark page breaks
i += 1
if lines[i].startswith('<a href="#TOP">Top</a>'): # The first page break won't have one
i += 1
if i < len(lines) and lines[i] == '<hr />\n': # The last page break doesn't have one
dst.write('<div style="page-break-after: always;"></div>\n')
i += 1
else:
dst.write(line)
i += 1
#
# Spell check
#
do_cmd('codespell -L od readme.md'.split())
do_cmd(('codespell -L od ' + top_dir + 'readme.md').split())
#
# List the ones we didn't find
#

View File

@@ -21,8 +21,10 @@ include <../vitamins/pcbs.scad>
use <../utils/layout.scad>
function spacing(p) = let(w = pcb_width(p)) w < 22 ? w + 3 : w + 10;
module pcbs() {
layout([for(p = pcbs) pcb_width(p)], 10)
layout([for(p = pcbs) spacing(p)], 0)
translate([0, pcb_length(pcbs[$i]) / 2])
rotate(90)
pcb_assembly(pcbs[$i], 5 + $i, 3);
@@ -31,6 +33,10 @@ module pcbs() {
layout([for(p = perfboards) pcb_length(p)], 10)
translate([0, -pcb_width(perfboards[$i]) / 2])
pcb_assembly(perfboards[$i], 5 + $i, 3);
for(p = pcbs_not_shown)
hidden()
pcb(p);
}
if($preview)
pcbs();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

@@ -27,6 +27,9 @@ module tubes() {
translate([50, 10])
tube(10, 8, 30);
translate([100, 10])
rectangular_tube([10, 20, 30]);
}
tubes();

View File

@@ -25,6 +25,9 @@
//! parts are used.
//! This heuristic isn't always correct, so the default can be overridden by setting the `big` parameter of `assembly` to `true` or `false`.
//!
//! Setting the `ngb` parameter of `assembly` to `true` removes its column from the global BOM and merges it parts into its parent assembly column of the global BOM.
//! This is to prevent the global BOM page becoming too wide in large projects by having it include just the major assemblies.
//!
//! The example below shows how to define a vitamin and incorporate it into an assembly with sub-assemblies and make an exploded view.
//! The resulting flat BOM is shown but heirachical BOMs are also generated for real projects.
//
@@ -84,9 +87,9 @@ module pose_vflip(exploded = undef) //! Pose an STL or assembly for render
children();
module assembly(name, big = undef) { //! Name an assembly that will appear on the BOM, there needs to a module named `<name>_assembly` to make it. `big` can force big or small assembly diagrams.
module assembly(name, big = undef, ngb = false) { //! Name an assembly that will appear on the BOM, there needs to a module named `<name>_assembly` to make it. `big` can force big or small assembly diagrams.
if(bom_mode()) {
args = is_undef(big) ? "" : str("(big=", big, ")");
args = is_undef(big) && !ngb ? "" : str("(big=", big, ", ngb=", ngb, ")");
echo(str("~", name, "_assembly", args, "{"));
}
no_pose()

View File

@@ -21,7 +21,7 @@
//! Draw a 3D right triangle with rounded edges. Intended to be embedded in other parts. Can be optionally offset by the filleted amount.
//
include <../utils/core/core.scad>
include <NopSCADlib/utils/core/rounded_rectangle.scad>
include <..//utils/core/rounded_rectangle.scad>
module rounded_right_triangle(x, y, z, fillet, center = true, offset = false) { //! Draw a 3D right triangle with rounded edges.
fillet = max(fillet, eps);
@@ -43,4 +43,3 @@ module rounded_right_triangle(x, y, z, fillet, center = true, offset = false) {
rounded_rectangle([size.z, 2 * fillet, eps], fillet - eps, center = false, xy_center = false);
}
}

View File

@@ -68,3 +68,11 @@ module woven_tube(or, ir, h, center= true, colour = grey(30), colour2, warp = 2,
}
}
}
module rectangular_tube(size, center = true, thickness = 1, fillet = 0.5) { //! Create a retangular tube with filleted corners
extrude_if(size.z, center = center)
difference() {
rounded_square([size.x, size.y], fillet);
rounded_square([size.x - 2 * thickness, size.y - 2 * thickness], fillet);
}
}

View File

@@ -18,7 +18,11 @@
//
//
//! Used for limit switches.
//! Used for limit switches. Currently only the button type is supported as the lever and roller types are less accurate.
//!
//! The switch is drawn with the button at the nominal operation point. This can be plus or minus `microswitch_op_tol(type)`.
//!
//! When the button is released it comes out by a maximum of `microswitch_fp_max(type)` from the nominal operating point.
//
include <../utils/core/core.scad>
@@ -32,11 +36,13 @@ function microswitch_hole_d(type) = type[6]; //! Screw hole diameter
function microswitch_holes(type) = type[7]; //! Hole positions
function microswitch_button_w(type) = type[8]; //! Button width
function microswitch_button_t(type) = type[9]; //! Button thickness
function microswitch_button_pos(type)= type[10]; //! Button position
function microswitch_legs(type) = type[11]; //! Leg positions
function microswitch_leg(type) = type[12]; //! Leg types
function microswitch_body_clr(type) = type[13]; //! Body colour
function microswitch_button_clr(type)= type[14]; //! Button colour
function microswitch_button_pos(type)= type[10]; //! Button position at operating point
function microswitch_op_tol(type) = type[11]; //! Operating position +/- tolerance
function microswitch_fp_max(type) = type[12]; //! Free position maximum
function microswitch_legs(type) = type[13]; //! Leg positions
function microswitch_leg(type) = type[14]; //! Leg types
function microswitch_body_clr(type) = type[15]; //! Body colour
function microswitch_button_clr(type)= type[16]; //! Button colour
function microswitch_lower_extent(type) = let(leg = microswitch_leg(type)) min([for(pos = microswitch_legs(type)) pos.y - leg.y / 2]); //! How far legs extend downwards
function microswitch_right_extent(type) = let(leg = microswitch_leg(type)) max([microswitch_length(type) / 2, for(pos = microswitch_legs(type)) pos.x + leg.x / 2]); //! How far legs extend right

View File

@@ -23,10 +23,19 @@
small_leg = [0.9, 3.3, 0.4, 0];
medium_leg = [0.5, 3.9, 3.2, 1.6, [0, -0.5]];
large_leg = [11.4, 0.8, 6.3, 1.8, [1.7, 0]];
small_microswitch = ["small_microswitch", "DM1-00P-110-3", 5.8, 6.5, 12.8, 0, 2, [[-3.25, -1.65], [3.25, -1.65]], 2.9, 1.2, [-1.95, 3.75], [[-5.08, -4.95], [0, -4.9], [5.08, -4.9] ], small_leg, grey(20), "white" ];
medium_microswitch = ["medium_microswitch","SS-01 or SS-5GL", 6.4, 10.2, 19.8, 1, 2.35, [[-4.8, -2.6 ], [4.7, -2.6 ]], 3.2, 2, [-2.8, 5.8 ], [[-8.05, -7.05], [0.75, -7.05], [8.05, -7.05] ], medium_leg, grey(20), "burlywood" ];
large_microswitch = ["large_microswitch", "Saia G3 low force", 10.4, 15.9, 28.0, 2, 3.1, [[-11.1, -5.15], [11.2, 5.15]], 4, 2.75,[-9.1, 9.55], [[19.7, 2.19], [19.7, -3.45], [8.3, -10.45] ], large_leg, "ivory", "white" ];
// t w l r h h b b b o f l l b b
// h i e a o o u u u p p e e o u
// i d n d l l t t t g g d t
// c t g i e e t t t t m y t
// k h t u o o o o a p t o
// n h s d p n n n l x o y c n
// e i o s p l
// s a s w t p n e r c
// n n o s l
// s s r
small_microswitch = ["small_microswitch", "DM1-00P-110-3", 5.8, 6.5, 12.8, 0, 2, [[-3.25, -1.65], [3.25, -1.65]], 2.9, 1.2, [-1.95, 3.75], 0.2, 0.55, [[-5.08, -4.95], [0, -4.9], [5.08, -4.9] ], small_leg, grey(20), "white" ];
medium_microswitch = ["medium_microswitch","SS-01 or SS-5GL", 6.4, 10.2, 19.8, 1, 2.35, [[-4.8, -2.6 ], [4.7, -2.6 ]], 3.2, 2, [-2.8, 5.8 ], 0.5, 1.00, [[-8.05, -7.05], [0.75, -7.05], [8.05, -7.05] ], medium_leg, grey(20), "burlywood" ];
large_microswitch = ["large_microswitch", "Saia G3 low force", 10.4, 15.9, 28.0, 2, 3.1, [[-11.1, -5.15], [11.2, 5.15]], 4, 2.75,[-9.1, 9.55], 0.3, 1.2, [[19.7, 2.19], [19.7, -3.45], [8.3, -10.45] ], large_leg, "ivory", "white" ]; //G3M1T1PUL
microswitches = [small_microswitch, medium_microswitch, large_microswitch];

View File

@@ -21,6 +21,7 @@ include <d_connectors.scad>
include <leds.scad>
include <axials.scad>
include <smds.scad>
include <green_terminals.scad>
//
// l w t r h l c b h
@@ -195,6 +196,222 @@ Duex5 = ["Duex5", "Duex5 expansion board",
]),
[]];
BTT_SKR_MINI_E3_V2_0 = [
"BTT_SKR_MINI_E3_V2_0", "BigTreeTech SKR Mini E3 v2.0",
100.75, 70.25, 1.6, // size
1, // corner radius
3, // mounting hole diameter
5, // pad around mounting hole
grey(30), // color
false, // true if parts should be separate BOM items
[ // hole positions
[ 19.3, -2.89 ],
[ 19.3 + 62.15, -2.89 ],
[ 2.535, -2.89 - 34.98 ],
[ 2.535 + 31.80, -2.89 - 37.63 ],
[ 2.535 + 95.68, -2.89 - 64.47 ]
],
[ // components
// cpu
[ 55, 33, 0, "chip", 10, 10, 1, grey(15) ],
// hotend and heated bed
[ 26, 16, 0, "chip", 9.5, 8.5, 4, grey(15) ],
[ 37, 14, 0, "chip", 6, 6, 2.5, grey(15) ],
// driver chips
[ 10.5,-17.5, 0, "chip", 5, 5, 1, grey(15) ],
[ 30.5,-17.5, 0, "chip", 5, 5, 1, grey(15) ],
[ 50.5,-17.5, 0, "chip", 5, 5, 1, grey(15) ],
[ 70.5,-17.5, 0, "chip", 5, 5, 1, grey(15) ],
// heat dissipation under board
[ 43, -17.5, 0, "-block", 85, 8, 0.1, gold ],
[ 40, 16, 0, "-block", 10, 8, 0.1, gold ],
[ 27, 19, 0, "-block", 13,14, 0.1, gold ],
[ 12, 28.5, 0, "-block", 11, 7, 0.1, gold ],
// mock up heat sinks over the chips
[ 10.5, -17.5, 0, "chip", 9, 8.5, 2, "DeepSkyBlue" ],
for(x = [10.5], y = [-4,-2,0,2,4]) [ x, -17.5 + y, 0, "chip", 9, 0.75, 11, "DeepSkyBlue" ],
[ 30.5, -17.5, 0, "chip", 9, 8.5, 2, "DeepSkyBlue" ],
for(x = [30.5], y = [-4,-2,0,2,4]) [ x, -17.5 + y, 0, "chip", 9, 0.75, 11, "DeepSkyBlue" ],
[ 50.5, -17.5, 0, "chip", 9, 8.5, 2, "DeepSkyBlue" ],
for(x = [50.5], y = [-4,-2,0,2,4]) [ x, -17.5 + y, 0, "chip", 9, 0.75, 11, "DeepSkyBlue" ],
[ 70.5, -17.5, 0, "chip", 9, 8.5, 2, "DeepSkyBlue" ],
for(x = [70.5], y = [-4,-2,0,2,4]) [ x, -17.5 + y, 0, "chip", 9, 0.75, 11, "DeepSkyBlue" ],
// terminals
[ 5.25, 5.3, 180, "gterm", gt_5x17, 2, undef, grey(20) ],
[ 18.1, 5.1, -90, "gterm", gt_5x17, 2, undef, grey(20) ],
[ 29.3, 5.1, -90, "gterm", gt_5x17, 2, undef, grey(20) ],
[ 40.5, 5.1, -90, "gterm", gt_5x11, 2, undef, grey(20) ],
// SD and USB
[ -3, -(22.27 + 29.92)/2, 0, "usb_uA" ],
[ -8, -( 2.13 + 17.17)/2, 0, "uSD", [17.17 - 2.13, 16, 2] ],
// EXP
[ -4.5, 17, -90, "2p54boxhdr", 5, 2 ],
// TFT
[ 66.1, 21.7, 0, "2p54header", 5, 1 ],
// FAN0
[ 50.25, 3.8, 0, "jst_xh", 2, false, grey(20) ],
// FAN1
[ 49.9, 16.1, 0, "jst_xh", 2, false, grey(20) ],
// PS-ON
[ 58.1, 16.1, 0, "jst_xh", 2, false, grey(20) ],
// PWR-DET
[ 67.5, 16.0, 0, "jst_xh", 3, false, grey(20) ],
// E0-STOP
[ 78.2, 16.0, 0, "jst_xh", 3, false, grey(20) ],
// Z-PROBE
[ 87.2, 20.5, -90,"jst_xh", 5, false, grey(20) ],
// NEO Pixel
[ 78.2, 27.1, 0, "jst_xh", 3, false, grey(20) ],
// end stops
[ 58.60, 3.8, 0, "jst_xh", 2, false, grey(20) ],
[ 66.70, 3.8, 0, "jst_xh", 2, false, grey(20) ],
[ 74.90, 3.8, 0, "jst_xh", 2, false, grey(20) ],
// thermistors
[ 83.00, 3.8, 0, "jst_xh", 2, false, grey(20) ],
[ 91.10, 3.8, 0, "jst_xh", 2, false, grey(20) ],
// motor connections
[ 10.15, -4.2, 0, "jst_xh", 4, false, grey(20) ],
[ 30.35, -4.2, 0, "jst_xh", 4, false, grey(20) ],
[ 43.90, -4.2, 0, "jst_xh", 4, false, grey(20) ],
[ 57.25, -4.2, 0, "jst_xh", 4, false, grey(20) ],
[ 70.75, -4.2, 0, "jst_xh", 4, false, grey(20) ],
// motor jumpers
[ 20.6, 44.1, 0, "2p54header", 2, 1 ],
[ 39.6, 44.2, 0, "2p54header", 2, 1 ],
[ 60.1, 44.1, 0, "2p54header", 2, 1 ],
[ 80.3, 44.1, 0, "2p54header", 2, 1 ],
// SWD
[ 43.9, 39.2, 0, "2p54header", 1, 5 ],
// SPI
[ -3.1, 31.9, 0, "2p54header", 2, 3 ],
// PWR-1
[ -12.8, 30.3, 0, "2p54header", 3, 1 ],
// VOUT
[ -14.0, 34.4, 0, "2p54header", 2, 2 ],
// VIN
[ 17.3, 19.6, 0, "2p54header", 2, 2 ],
],
[] // accessories
];
TMC2130 = [
"TMC2130", "TMC2130",
20, 14, 1.6, // size
0, 0, 0, // corner radius, mounting hole diameter, pad around mounting hole
grey(95), // colour
false, // true if parts should be separate BOM items
[], // hole positions
[
[ 10, 1, 0, "-2p54header", 8, 1 ],
[ 10, 13, 0, "-2p54header", 8, 1 ],
[ 12, 7, 0, "-chip", 6, 4, 1, grey(20) ],
// mock up a heat sink
[ 10, 7, 0, "block", 9, 8.5, 2, "DeepSkyBlue" ],
for (y = [-4,-2,0,2,4]) [ 10, 7 + y, 0, "block", 9, 0.75, 11, "DeepSkyBlue" ],
],
[]
];
BTT_SKR_V1_4_TURBO = [
"BTT_SKR_V1_4_TURBO", "BigTreeTech SKR v1.4 Turbo",
110, 85, 1.6, // size
1, // corner radius
3, // mounting hole diameter
4, // pad around mounting hole
grey(30), // colour
false, // true if parts should be separate BOM items
[ // hole positions
[-4, 4], [-4, -4], [4, -4], [4, 4]
],
[ // components
[ (29.15+31.5)/2, 8, -90, "usb_B" ],
[ (46.9+51.55)/2, 7, -90, "uSD", [14, 14, 2] ],
[ 105, 13, 0, "button_6mm" ],
[ 58, 43, 0, "chip", 15, 15, 1, grey(20) ],
// ESP-01 socket
[ 69.8, 4, 0, "2p54socket", 4, 2 ],
// terminals
[ 5.3, 13.2, 180, "gterm", gt_5x17, 2, undef, grey(20)],
[ 5.3, 25.8, 180, "gterm", gt_5x17, 2, undef, grey(20)],
[ 5.3, 37.2, 180, "gterm", gt_5x11, 2, undef, grey(20)],
[ 5.3, 47.2, 180, "gterm", gt_5x11, 2, undef, grey(20)],
[ 2.8, 56.7, -90, "jst_xh", 2, false, grey(20) ],
[ 10.9, 56.7, 90, "jst_xh", 2, false, grey(20) ],
[ 82, 4, 0, "jst_xh", 2, false, grey(20) ],
[ 90, 4, 0, "jst_xh", 2, false, grey(20) ],
[ 98, 4, 0, "jst_xh", 2, false, grey(20) ],
[ 87.7, 29.0, -90, "jst_xh", 3, false, grey(20) ],
[ 87.7, 39.5, -90, "jst_xh", 3, false, grey(20) ],
[ 87.7, 50.1, -90, "jst_xh", 3, false, grey(20) ],
[ 95.3, 29.0, -90, "jst_xh", 3, false, grey(20) ],
[ 95.3, 39.5, -90, "jst_xh", 3, false, grey(20) ],
[ 95.3, 50.1, -90, "jst_xh", 3, false, grey(20) ],
[ 85.7, 18.2, 180, "jst_xh", 3, false, grey(20) ],
[ 94.9, 18.2, 180, "jst_xh", 2, false, grey(20) ],
[ 77.2, 19.6, -90, "jst_xh", 3, false, grey(20) ],
[ 69.8, 11.0, 0, "jst_xh", 5, false, grey(20) ],
[ 69.0, 19.2, 0, "2p54header", 4, 1 ],
[ 57.8, 18.0, 0, "2p54header", 3, 2 ],
[ 28.0, 19.7, 0, "2p54header", 2, 2 ],
[ 37.6, 28.8, 0, "2p54header", 1, 3, undef, "red" ],
[ 77.8, 27.5, 0, "2p54header", 2, 2 ],
[ 81.8, 26.4, 0, "2p54header", 1, 3, undef, "red" ],
[ 43.8, 42.8, 0, "2p54header", 1, 5 ],
// EXP1 & EXP2
[ -6.6, 29.4, 90, "2p54boxhdr", 5, 2 ],
[ -6.6, 50.4, 90, "2p54boxhdr", 5, 2 ],
// motor axes connections
[ 11.2, -3.75, 180, "jst_xh", 2, false, grey(20) ],
[ 21.8, -3.75, 180, "jst_xh", 4, false, grey(20) ],
[ 35.0, -3.75, 180, "jst_xh", 4, false, grey(20) ],
[ 48.2, -3.75, 180, "jst_xh", 4, false, grey(20) ],
[ 61.4, -3.75, 180, "jst_xh", 4, false, grey(20) ],
[ 74.7, -3.75, 180, "jst_xh", 4, false, grey(20) ],
[ 87.9, -3.75, 180, "jst_xh", 4, false, grey(20) ],
[ 98.5, -3.75, 180, "jst_xh", 2, false, grey(20) ],
// stepper drivers
[ 11.5, 62.5, 0, "2p54socket", 8, 1, undef, undef, undef, "red" ],
[ 11.5, 75.2, 0, "2p54socket", 8, 1 ],
[ 2.6, 66.3, 90, "2p54socket", 2, 1, undef, undef, undef, "red" ],
[ 11.5, 68.85, 0, "pcb", 11, TMC2130 ],
[ 33.1, 62.5, 0, "2p54socket", 8, 1, undef, undef, undef, "red" ],
[ 33.1, 75.2, 0, "2p54socket", 8, 1 ],
[ 24.2, 66.3, 90, "2p54socket", 2, 1, undef, undef, undef, "red" ],
[ 33.1, 68.85, 0, "pcb", 11, TMC2130 ],
[ 54.8, 62.5, 0, "2p54socket", 8, 1, undef, undef, undef, "red" ],
[ 54.8, 75.2, 0, "2p54socket", 8, 1 ],
[ 45.9, 66.3, 90, "2p54socket", 2, 1, undef, undef, undef, "red" ],
[ 54.8, 68.85, 0, "pcb", 11, TMC2130 ],
[ 76.4, 62.5, 0, "2p54socket", 8, 1, undef, undef, undef, "red" ],
[ 76.4, 75.2, 0, "2p54socket", 8, 1 ],
[ 67.5, 66.3, 90, "2p54socket", 2, 1, undef, undef, undef, "red" ],
[ 76.4, 68.85, 0, "pcb", 11, TMC2130 ],
[ 98.1, 62.5, 0, "2p54socket", 8, 1, undef, undef, undef, "red" ],
[ 98.1, 75.2, 0, "2p54socket", 8, 1 ],
[ 89.2, 66.3, 90, "2p54socket", 2, 1, undef, undef, undef, "red" ],
// closed loop pins
[ 24.4, 57.5, 0, "2p54header", 6, 1 ],
[ 40.6, 57.5, 0, "2p54header", 6, 1 ],
[ 56.7, 57.5, 0, "2p54header", 6, 1 ],
[ 72.9, 57.5, 0, "2p54header", 6, 1 ],
[ 89.1, 57.5, 0, "2p54header", 6, 1 ],
],
[] // accessories
];
Melzi = ["Melzi", "Melzi electronics", 203.2, 49.53, 1.6, 3.81, 3.1, 6, "green", false, [[3.81, 3.81], [-3.81, 3.81], [-3.81, -3.81], [3.81, -3.81]],
[],
@@ -440,7 +657,9 @@ ESP_01 = [
[] // accessories
];
pcbs = [MP1584EN, TP4056, ESP_01, MT3608, RAMPSEndstop, ExtruderPCB, PI_IO, ZC_A0591, RPI0, EnviroPlus, ArduinoUno3, ArduinoLeonardo, Keyes5p1, PSU12V1A, WD2002SJ, RPI3, RPI4, DuetE, Duex2, Duex5];
pcbs = [MP1584EN, TP4056, ESP_01, RAMPSEndstop, MT3608, PI_IO, ExtruderPCB, ZC_A0591, RPI0, EnviroPlus, ArduinoUno3, ArduinoLeonardo, Keyes5p1, WD2002SJ, RPI3, RPI4, BTT_SKR_MINI_E3_V2_0, BTT_SKR_V1_4_TURBO, DuetE, Duex5];
pcbs_not_shown = [Melzi, Duex2, PSU12V1A];
perfboards = [PERF74x51, PERF70x50, PERF60x40, PERF70x30, PERF80x20];

View File

@@ -53,7 +53,7 @@ function pulley_extent(type) = max(pulley_flange_dia(type), pulley_hub_dia(type)
T_angle = 40;
GT_r = 0.555;
module pulley(type) { //! Draw a pulley
module pulley(type, colour = silver) { //! Draw a pulley
teeth = pulley_teeth(type);
od = pulley_od(type);
@@ -117,7 +117,7 @@ module pulley(type) { //! Draw a pulley
rotate([-90, 0, i * -90])
cylinder(r = screw_radius(pulley_screw(type)), h = 100);
color(silver) {
color(colour) {
if(screw_z && screw_z < hl)
render()
difference() {
@@ -140,9 +140,9 @@ module pulley(type) { //! Draw a pulley
}
}
module pulley_assembly(type) { //! Draw a pulley with its grub screws in place
module pulley_assembly(type, colour = silver) { //! Draw a pulley with its grub screws in place
translate_z(pulley_offset(type)) {
pulley(type);
pulley(type, colour);
if(pulley_screws(type))
translate_z(pulley_screw_z(type))

View File

@@ -83,6 +83,7 @@ M5_cs_cap_screw = ["M5_cs_cap","M5 cs cap", hs_cs_cap,5,10.0, 0, 3.00,3.0
M2_dome_screw = ["M2_dome", "M2 dome", hs_dome, 2, 3.5, 1.3, 0.6, 1.3, 16, M2_washer, M2_nut, M2_tap_radius, M2_clearance_radius];
M3_dome_screw = ["M3_dome", "M3 dome", hs_dome, 3, 5.7, 1.65, 1.04,2.0, 18, M3_washer, M3_nut, M3_tap_radius, M3_clearance_radius];
M4_dome_screw = ["M4_dome", "M4 dome", hs_dome, 4, 7.6, 2.2, 1.3, 2.5, 20, M4_washer, M4_nut, M4_tap_radius, M4_clearance_radius];
M5_dome_screw = ["M5_dome", "M5 dome", hs_dome, 5, 9.5, 2.75, 1.56,3.0, 22, M5_washer, M5_nut, M5_tap_radius, M5_clearance_radius];
M2p5_pan_screw = ["M2p5_pan", "M2.5 pan", hs_pan, 2.5, 4.7, 1.7, 0, 0, 0, M2p5_washer, M2p5_nut, M2p5_tap_radius, M2p5_clearance_radius];
M3_pan_screw = ["M3_pan", "M3 pan", hs_pan, 3, 5.4, 2.0, 0, 0, 0, M3_washer, M3_nut, M3_tap_radius, M3_clearance_radius];
@@ -111,7 +112,7 @@ screw_lists = [
[ M2_cap_screw, M2p5_cap_screw, M3_cap_screw, M4_cap_screw, M5_cap_screw, M6_cap_screw, M8_cap_screw],
[ 0, 0, M3_low_cap_screw],
[ M2_cs_cap_screw, 0, M3_cs_cap_screw, M4_cs_cap_screw, M5_cs_cap_screw],
[ M2_dome_screw, 0, M3_dome_screw, M4_dome_screw],
[ M2_dome_screw, 0, M3_dome_screw, M4_dome_screw, M5_dome_screw],
[ 0, 0, M3_hex_screw, M4_hex_screw, M5_hex_screw, M6_hex_screw, M8_hex_screw],
[ 0, M2p5_pan_screw, M3_pan_screw, M4_pan_screw, M5_pan_screw, M6_pan_screw, No632_pan_screw],
[ No2_screw, 0, No4_screw, No6_screw, No6_cs_screw],

View File

@@ -143,8 +143,8 @@ module vero_components(type, cutouts = false, angle = undef)
module vero_cutouts(type, angle = undef) vero_components(type, true, angle); //! Make cutouts to clear components
module veroboard_assembly(type, height, thickness, flip = false) //! Draw the assembly with components and fasteners in place
assembly(vero_assembly(type)) {
module veroboard_assembly(type, height, thickness, flip = false, ngb = false) //! Draw the assembly with components and fasteners in place
assembly(vero_assembly(type), ngb = ngb) {
screw = vero_screw(type);
nut = screw_nut(screw);
screw_length = screw_length(screw, height + thickness + vero_thickness(type), 2, nyloc = true);