1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-09-06 21:30:38 +02:00

Compare commits

...

21 Commits

Author SHA1 Message Date
Chris Palmer
330c09f4d4 Merge branch 'schiele-corexy_fix' 2025-04-15 11:41:21 +01:00
Chris Palmer
c2a56367eb Merge branch 'corexy_fix' of https://github.com/schiele/NopSCADlib into schiele-corexy_fix 2025-04-15 11:35:27 +01:00
Chris Palmer
f16dc84792 Updated changelog. 2025-04-15 11:34:43 +01:00
Chris Palmer
c065855b90 Merge branch 'pcremades-master' 2025-04-15 11:32:22 +01:00
Chris Palmer
edc7e17437 Included pcbs.scad in displays.scad.
Moved I2C_LCD_Backpack from tiny_pcbs to pcbs to prevent connector clash.
Updated images and readme.
2025-04-15 11:31:46 +01:00
Robert Schiele
7546203b03 positional parameters should not follow named parameters
Some versions of OpenSCAD (like the latest official release 2021.01 get
confused if positional parameters follow named parameters. So let's use
named parameters after the first named one was used.
2025-04-15 07:00:19 +02:00
pcremades
a9b501a2d2 Added a 1602 LCD with I2C module 2025-04-11 11:54:48 -03:00
pcremades
126343d5af Added a I2C TWI SPI Serial Interface for 1602 LCD 2025-04-11 11:39:59 -03:00
pcremades
1692fcc811 Added 1/4" square trimpot to pcb.scad 2025-04-11 11:27:14 -03:00
Chris Palmer
5c4fe8bfb9 Updated changelog. 2025-04-09 23:31:10 +01:00
Chris Palmer
33ac3820b0 Added pose_stl() module because pose() only works for assembly views. 2025-04-09 23:29:00 +01:00
Chris Palmer
6a58d37f77 Updated changelog. 2025-04-01 09:57:15 +01:00
Chris Palmer
029abc0cf8 Merge branch 'trnila-barrel_jack_cutout' 2025-04-01 09:45:06 +01:00
Chris Palmer
4b018eb9ad Merge branch 'barrel_jack_cutout' of https://github.com/trnila/NopSCADlib into trnila-barrel_jack_cutout 2025-04-01 09:33:43 +01:00
Chris Palmer
3715585002 Made pose() work on STL renders to match the documentation. 2025-04-01 09:32:00 +01:00
Daniel Trnka
5d0eda87e4 barrel_jack: added cutout 2025-03-30 23:19:42 +02:00
Chris Palmer
ad963afb8d Updated changelog. 2025-03-27 12:25:55 +00:00
Chris Palmer
dbf8e6c7ae Merge branch 'jeroenrnl-VariableNamesWithDigitsDeprecated' 2025-03-27 12:24:15 +00:00
Chris Palmer
7d281cbcdd Merge branch 'VariableNamesWithDigitsDeprecated' of https://github.com/jeroenrnl/NopSCADlib into jeroenrnl-VariableNamesWithDigitsDeprecated 2025-03-27 12:01:05 +00:00
Chris Palmer
f1a651a2d2 Updated changelog. 2025-03-27 02:00:24 +00:00
Jeroen Roos
fdbe0c7a9e Change variable names that start with a digit
Change names of variables from `2a` and `2c` to `ax2` (a times 2) and
`cx2`, because variable names starting with a digit are deprecated in
OpenSCAD.
2025-03-23 10:45:33 +01:00
15 changed files with 175 additions and 33 deletions

View File

@@ -3,6 +3,36 @@
This changelog is generated by `changelog.py` using manually added semantic version tags to classify commits as breaking changes, additions or fixes.
### [v21.37.0](https://github.com/nophead/NopSCADlib/releases/tag/v21.37.0 "show release") Additions [...](https://github.com/nophead/NopSCADlib/compare/v21.36.0...v21.37.0 "diff with v21.36.0")
* 2025-04-15 [`edc7e17`](https://github.com/nophead/NopSCADlib/commit/edc7e174370ac8dcd6d4a78b31640347ab266f60 "show commit") [C.P.](# "Chris Palmer") Included `pcbs.scad` in `displays.scad`.
Moved `I2C_LCD_Backpack` from `tiny_pcbs` to pcbs to prevent connector clash.
Updated images and readme.
* 2025-04-11 [`a9b501a`](https://github.com/nophead/NopSCADlib/commit/a9b501a2d2ce242c181c2cd5f5d1f86ba7150eec "show commit") [P.](# "pcremades") Added a 1602 LCD with I2C module
* 2025-04-11 [`126343d`](https://github.com/nophead/NopSCADlib/commit/126343d5af75a2aa458db112305a62b953e23694 "show commit") [P.](# "pcremades") Added a I2C TWI SPI Serial Interface for 1602 LCD
* 2025-04-11 [`1692fcc`](https://github.com/nophead/NopSCADlib/commit/1692fcc8116c9a0926231a95d0207a0085c814c5 "show commit") [P.](# "pcremades") Added `1/4"` square trimpot to `pcb.scad`
### [v21.36.0](https://github.com/nophead/NopSCADlib/releases/tag/v21.36.0 "show release") Additions [...](https://github.com/nophead/NopSCADlib/compare/v21.35.6...v21.36.0 "diff with v21.35.6")
* 2025-04-09 [`33ac382`](https://github.com/nophead/NopSCADlib/commit/33ac3820b0df87df05d7c2dbb3d553e2aafa6828 "show commit") [C.P.](# "Chris Palmer") Added `pose_stl()` module because `pose()` only works for assembly views.
#### [v21.35.6](https://github.com/nophead/NopSCADlib/releases/tag/v21.35.6 "show release") Fixes [...](https://github.com/nophead/NopSCADlib/compare/v21.35.5...v21.35.6 "diff with v21.35.5")
* 2025-03-30 [`5d0eda8`](https://github.com/nophead/NopSCADlib/commit/5d0eda87e44a70fdbed51407a43555a637e064f9 "show commit") [D.T.](# "Daniel Trnka") `barrel_jack:` added cutout
#### [v21.35.5](https://github.com/nophead/NopSCADlib/releases/tag/v21.35.5 "show release") Fixes [...](https://github.com/nophead/NopSCADlib/compare/v21.35.4...v21.35.5 "diff with v21.35.4")
* 2025-04-01 [`3715585`](https://github.com/nophead/NopSCADlib/commit/3715585002ba56681103103faddd043b1553d095 "show commit") [C.P.](# "Chris Palmer") Made `pose()` work on STL renders to match the documentation.
#### [v21.35.4](https://github.com/nophead/NopSCADlib/releases/tag/v21.35.4 "show release") Fixes [...](https://github.com/nophead/NopSCADlib/compare/v21.35.3...v21.35.4 "diff with v21.35.3")
* 2025-03-23 [`fdbe0c7`](https://github.com/nophead/NopSCADlib/commit/fdbe0c7a9eba96823683b8e1161bc160bd63231e "show commit") [J.R.](# "Jeroen Roos") Change variable names that start with a digit
* Change names of variables from `2a` and `2c` to `ax2` (a times 2) and
`cx2`, because variable names starting with a digit are deprecated in
OpenSCAD.
#### [v21.35.3](https://github.com/nophead/NopSCADlib/releases/tag/v21.35.3 "show release") Fixes [...](https://github.com/nophead/NopSCADlib/compare/v21.35.2...v21.35.3 "diff with v21.35.2")
* 2025-03-27 [`9f9aa67`](https://github.com/nophead/NopSCADlib/commit/9f9aa6723eff9b7439e17758406e9f8e409828ee "show commit") [C.P.](# "Chris Palmer") Third attempt to fix dimension image.
#### [v21.35.2](https://github.com/nophead/NopSCADlib/releases/tag/v21.35.2 "show release") Fixes [...](https://github.com/nophead/NopSCADlib/compare/v21.35.1...v21.35.2 "diff with v21.35.1")
* 2025-03-27 [`6b6704b`](https://github.com/nophead/NopSCADlib/commit/6b6704b823291119697bf4993eddb3f2e6873875 "show commit") [C.P.](# "Chris Palmer") Second attempt to fix dimension image.

View File

@@ -23,7 +23,7 @@
include <core.scad>
include <vitamins/psus.scad>
include <vitamins/pcbs.scad>
include <vitamins/displays.scad> // Includes pcbs.scad
include <vitamins/antennas.scad>
include <vitamins/batteries.scad>
@@ -34,7 +34,6 @@ include <vitamins/box_sections.scad>
include <vitamins/bulldogs.scad>
include <vitamins/cameras.scad>
include <vitamins/components.scad>
include <vitamins/displays.scad>
include <vitamins/extrusions.scad>
include <vitamins/extrusion_brackets.scad>
include <vitamins/fastons.scad>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1018 KiB

After

Width:  |  Height:  |  Size: 1022 KiB

View File

@@ -1106,7 +1106,7 @@ LCD displays.
| 1 | `display(BigTreeTech_TFT35v3_0)` | BigTreeTech TFT35 v3.0 |
| 1 | `display(HDMI5)` | HDMI display 5" |
| 1 | `display(TFT128x160)` | LCD TFT ST7735 display 128x160 |
| 1 | `display(LCD1602A)` | LCD display 1602A |
| 2 | `display(LCD1602A)` | LCD display 1602A |
| 1 | `display(LCD2004A)` | LCD display 2004A |
| 1 | `display(LCDS7282B)` | LCD display S-7282B |
| 1 | `display(SSD1963_4p3)` | LCD display SSD1963 4.3" |
@@ -3000,6 +3000,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 1 | `pcb(EnviroPlus)` | Enviro+ |
| 1 | `pcb(ExtruderPCB)` | Extruder connection PCB - not shown |
| 1 | `pcb(HW803_1WAY_RELAY)` | HW-803 5V 1 way relay module |
| 1 | `pcb(I2C_LCD_Backpack)` | I2C / SPI character LCD backpack |
| 1 | `pcb(KY_040)` | KY-040 rotart encoder breakout |
| 1 | `pcb(Keyes5p1)` | Keyes5.1 Arduino Uno expansion board - not shown |
| 1 | `pcb(L9110S)` | L9110S 2-Channel motor driver module |
@@ -3038,11 +3039,12 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 4 | `screw(M2_cap_screw, 25)` | Screw M2 cap x 25mm |
| 2 | `screw(M2p5_cap_screw, 20)` | Screw M2.5 cap x 20mm |
| 8 | `screw(M2p5_cap_screw, 30)` | Screw M2.5 cap x 30mm |
| 8 | `screw(M2p5_cap_screw, 35)` | Screw M2.5 cap x 35mm |
| 4 | `screw(M2p5_cap_screw, 40)` | Screw M2.5 cap x 40mm |
| 4 | `screw(M2p5_cap_screw, 35)` | Screw M2.5 cap x 35mm |
| 8 | `screw(M2p5_cap_screw, 40)` | Screw M2.5 cap x 40mm |
| 4 | `screw(M2p5_dome_screw, 25)` | Screw M2.5 dome x 25mm |
| 4 | `screw(M2p5_pan_screw, 20)` | Screw M2.5 pan x 20mm |
| 8 | `screw(M2p5_pan_screw, 30)` | Screw M2.5 pan x 30mm |
| 4 | `screw(M2p5_pan_screw, 30)` | Screw M2.5 pan x 30mm |
| 4 | `screw(M2p5_pan_screw, 35)` | Screw M2.5 pan x 35mm |
| 19 | `screw(M3_cap_screw, 16)` | Screw M3 cap x 16mm |
| 13 | `screw(M3_cap_screw, 20)` | Screw M3 cap x 20mm |
| 5 | `screw(M3_cap_screw, 25)` | Screw M3 cap x 25mm |
@@ -3067,24 +3069,25 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| Qty | Filename |
| ---:|:--- |
| 4 | pcb_spacer20100.stl |
| 4 | pcb_spacer20150.stl |
| 4 | pcb_spacer20160.stl |
| 4 | pcb_spacer2070.stl |
| 4 | pcb_spacer2080.stl |
| 4 | pcb_spacer2090.stl |
| 2 | pcb_spacer25110.stl |
| 4 | pcb_spacer25140.stl |
| 4 | pcb_spacer25180.stl |
| 4 | pcb_spacer25150.stl |
| 4 | pcb_spacer25190.stl |
| 4 | pcb_spacer25200_2.stl |
| 4 | pcb_spacer25200.stl |
| 4 | pcb_spacer25210_2.stl |
| 4 | pcb_spacer25250.stl |
| 4 | pcb_spacer25220_2.stl |
| 4 | pcb_spacer25260.stl |
| 4 | pcb_spacer25270.stl |
| 4 | pcb_spacer25280.stl |
| 4 | pcb_spacer2580.stl |
| 5 | pcb_spacer30130.stl |
| 4 | pcb_spacer30220.stl |
| 1 | pcb_spacer30130.stl |
| 4 | pcb_spacer30140.stl |
| 4 | pcb_spacer30230.stl |
| 3 | pcb_spacer30240.stl |
| 4 | pcb_spacer30240.stl |
| 3 | pcb_spacer30250.stl |
| 10 | pcb_spacer3050.stl |
| 9 | pcb_spacer3060.stl |
| 9 | pcb_spacer3070.stl |
@@ -7847,6 +7850,8 @@ The `pose()` module allows assembly views in the readme to be posed differently
* To get the parameter values make the GUI window square, pose the view with the mouse and then copy the viewport parameters from the Edit menu and paste them into the pose invocation.
* Two `pose()` modules can be chained to allow different poses for exploded and assembled views.
The `pose_stl()` module allows an STL child to be posed for its rendered image used in the readme for the project.
[utils/core/bom.scad](utils/core/bom.scad) Implementation.
[tests/BOM.scad](tests/BOM.scad) Code for this example.
@@ -7870,8 +7875,9 @@ The `pose()` module allows assembly views in the readme to be posed differently
| `no_explode()` | Prevent children being exploded |
| `no_pose()` | Force children not to be posed even if parent is |
| `not_on_bom(on = false)` | Specify the following child parts are not on the BOM, for example when they are on a PCB that comes assembled |
| `pose(a = [55, 0, 25], t = [0, 0, 0], exploded = undef, d = undef)` | Pose an STL or assembly for rendering to png by specifying rotation `a`, translation `t` and optionally `d`, `exploded = true for` just the exploded view or `false` for unexploded only. |
| `pose(a = [55, 0, 25], t = [0, 0, 0], exploded = undef, d = undef)` | Pose an assembly for rendering to png by specifying rotation `a`, translation `t` and optionally `d`, `exploded = true for` just the exploded view or `false` for unexploded only. |
| `pose_hflip(exploded = undef)` | Pose an STL or assembly for rendering to png by flipping around the Y axis, `exploded = true for` just the exploded view or `false` for unexploded only. |
| `pose_stl(a = [70, 0, 315], t = [0, 0, 0], d = 500)` | Pose an STL for its render, `a`, `t`, & `d` are camera parameters. |
| `pose_vflip(exploded = undef)` | Pose an STL or assembly for rendering to png by flipping around the X axis, `exploded = true for` just the exploded view or `false` for unexploded only. |
| `stl(name)` | Name an stl that will appear on the BOM, there needs to a module named `<name>_stl` to make it |
| `stl_colour(colour = pp1_colour, alpha = 1)` | Colour an stl where it is placed in an assembly. `alpha` can be used to make it appear transparent. |

View File

@@ -69,7 +69,10 @@ class Part:
self.count = 1
for arg in args:
arg = arg.replace('true', 'True').replace('false', 'False').replace('undef', 'None')
exec('self.' + arg)
try:
exec('self.' + arg)
except:
print(arg)
def data(self):
return self.__dict__
@@ -107,7 +110,7 @@ class BOM:
match = re.match(r'^(.*?\.stl|.*?\.dxf|.*?\.svg)\((.*)\)$', s) #look for name.stl(...), name.dxf(...) or name.svg(...)
if match:
s = match.group(1)
args = [match.group(2)]
args = match.group(2).split('|')
if s[-4:] == ".stl":
parts = self.printed
else:

View File

@@ -61,11 +61,14 @@ def render(target, type):
things = { 'stl' : 'printed', 'dxf' : 'routed', 'svg' : 'routed' }[type]
colours = {}
cameras = {}
for ass in flat_bom:
for part in ass[things]:
obj = ass[things][part]
if "colour" in obj:
colours[part] = obj["colour"]
if "camera" in obj:
cameras[part] = obj["camera"]
#
# Remove unused png files
#
@@ -87,13 +90,16 @@ def render(target, type):
png_maker_name = tmp_dir + "/png.scad"
pp1 = [0, 146/255, 0]
colour = pp1
camera = "0,0,0,70,0,315,500"
if part in cameras:
camera = cameras[part]
if part in colours:
colour = colours[part]
if not '[' in colour:
colour = '"' + colour + '"'
with open(png_maker_name, "w") as f:
f.write('color(%s) import("%s");\n' % (colour, reltmp(part_file, target)))
cam = "--camera=0,0,0,70,0,315,500" if type == 'stl' else "--camera=0,0,0,0,0,0,500"
cam = "--camera=" + camera if type == 'stl' else "--camera=0,0,0,0,0,0,500"
render = "--preview" if type == 'stl' or colour != pp1 else "--render"
tmp_name = tmp_dir + '/' + part[:-4] + '.png'
dummy_deps_name = tmp_dir + '/tmp.deps' # work around for OpenSCAD issue #3879

View File

@@ -161,7 +161,7 @@ module coreXY_motor_in_back_test2() {
lower_drive_pulley_offset = [20, 5];
coreXY(coreXY_GT2_20_16, size, pos, separation, x_gap = 0, plain_idler_offset = [20, 0], upper_drive_pulley_offset, lower_drive_pulley_offset, show_pulleys = true, left_lower = false, motor_back = true);
coreXY(coreXY_GT2_20_16, size, pos, separation, x_gap = 0, plain_idler_offset = [20, 0], upper_drive_pulley_offset = upper_drive_pulley_offset, lower_drive_pulley_offset = lower_drive_pulley_offset, show_pulleys = true, left_lower = false, motor_back = true);
translate (
[ size.x - separation.x/2 - lower_drive_pulley_offset.x

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 KiB

After

Width:  |  Height:  |  Size: 234 KiB

View File

@@ -41,6 +41,8 @@
//! * If the `d` parameter is set to specify the camera distance then the normal `viewall` and `autocenter` options are suppressed allowing a small section to be zoomed in to fill the view.
//! * To get the parameter values make the GUI window square, pose the view with the mouse and then copy the viewport parameters from the Edit menu and paste them into the pose invocation.
//! * Two `pose()` modules can be chained to allow different poses for exploded and assembled views.
//!
//! The `pose_stl()` module allows an STL child to be posed for its rendered image used in the readme for the project.
//
function bom_mode(n = 1) = (is_undef($bom) ? 0 : $bom) >= n && (is_undef($on_bom) || $on_bom); //! Current BOM mode, 0 = none, 1 = printed and routed parts and assemblies, 2 includes vitamins as well
function exploded() = is_undef($exploded_parent) ? is_undef($explode) ? 0 : $explode : 0; //! Returns the value of `$explode` if it is defined, else `0`
@@ -73,7 +75,7 @@ module explode(d, explode_children = false, offset = [0,0,0], show_line = true)
module no_pose() //! Force children not to be posed even if parent is
let($posed = true, $zoomed = undef) children();
module pose(a = [55, 0, 25], t = [0, 0, 0], exploded = undef, d = undef) //! Pose an STL or assembly for rendering to png by specifying rotation `a`, translation `t` and optionally `d`, `exploded = true for` just the exploded view or `false` for unexploded only.
module pose(a = [55, 0, 25], t = [0, 0, 0], exploded = undef, d = undef) //! Pose an assembly for rendering to png by specifying rotation `a`, translation `t` and optionally `d`, `exploded = true for` just the exploded view or `false` for unexploded only.
let($zoomed = is_undef(d)
? is_undef($zoomed)
? undef
@@ -136,10 +138,15 @@ module stl_colour(colour = pp1_colour, alpha = 1) { //! Colour an stl where it i
children();
}
module pose_stl(a = [70, 0, 315], t = [0, 0, 0], d = 500) //! Pose an STL for its render, `a`, `t`, & `d` are camera parameters.
let($stl_camera = str(t.x, ",", t.y, ",", t.z, ",", a.x, ",", a.y, ",", a.z, ",", d))
children();
module stl(name) { //! Name an stl that will appear on the BOM, there needs to a module named `<name>_stl` to make it
if(bom_mode() && is_undef($in_stl)) {
colour = is_undef($stl_colour) ? pp1_colour : $stl_colour;
echo(str("~", name, ".stl(colour='", colour, "')"));
camera = is_undef($stl_camera) ? "0,0,0,70,0,315,500" : $stl_camera;
echo(str("~", name, ".stl(colour='", colour, "'| camera='", camera, "')" ));
}
if($children)
if(is_undef($pose))

View File

@@ -272,13 +272,13 @@ module coreXY(type, size, pos, separation, x_gap = 0, plain_idler_offset = [0, 0
// lower belt
hflip(!left_lower)
explode(25)
coreXY_half(type, size, [size.x - pos.x - separation.x/2 - (left_lower ? x_gap : 0), pos.y], separation.y, x_gap, plain_idler_offset, [-lower_drive_pulley_offset.x, lower_drive_pulley_offset.y], show_pulleys, lower_belt = true, hflip = true, motor_back);
coreXY_half(type, size, [size.x - pos.x - separation.x/2 - (left_lower ? x_gap : 0), pos.y], separation.y, x_gap, plain_idler_offset, [-lower_drive_pulley_offset.x, lower_drive_pulley_offset.y], show_pulleys, lower_belt = true, hflip = true, motor_back = motor_back);
// upper belt
translate([separation.x, 0, separation.z])
hflip(left_lower)
explode(25)
coreXY_half(type, size, [pos.x + separation.x/2 + (left_lower ? x_gap : 0), pos.y], separation.y, x_gap, plain_idler_offset, upper_drive_pulley_offset, show_pulleys, lower_belt = false, hflip = false, motor_back);
coreXY_half(type, size, [pos.x + separation.x/2 + (left_lower ? x_gap : 0), pos.y], separation.y, x_gap, plain_idler_offset, upper_drive_pulley_offset, show_pulleys, lower_belt = false, hflip = false, motor_back = motor_back);
}
}

View File

@@ -164,13 +164,13 @@ function xor(a,b) = (a && !b) || (!a && b); //! Logical exclusive OR
function cuberoot(x)= sign(x)*abs(x)^(1/3);
function quadratic_real_roots(a, b, c) = //! Returns real roots of a quadratic equation, biggest first. Returns empty list if no real roots
let(2a = 2 * a,
2c = 2 * c,
det = b^2 - 2a * 2c
let(ax2 = 2 * a,
cx2 = 2 * c,
det = b^2 - ax2 * cx2
) det < 0 ? [] :
let(r = sqrt(det),
x1 = b < 0 ? 2c / (-b + r) : (-b - r) / 2a,
x2 = b < 0 ? (-b + r) / 2a : 2c / (-b - r)
x1 = b < 0 ? cx2 / (-b + r) : (-b - r) / ax2,
x2 = b < 0 ? (-b + r) / ax2 : cx2 / (-b - r)
) [x2, x1];
function cubic_real_roots(a, b, c, d) = //! Returns real roots of cubic equation

View File

@@ -17,6 +17,8 @@
// If not, see <https://www.gnu.org/licenses/>.
//
include <pcbs.scad>
HDMI5PCB = pcb("", "", [121.11, 77.93, 1.65], hole_d = 2.2, colour = "mediumblue",
holes = [[4.6, 4.9], [4.6, -3.73], [97.69, -3.73], [97.69, 4.9]],
components = [
@@ -46,6 +48,17 @@ LCD1602APCB = pcb("", "", [80, 36, 1.65], hole_d = 2.9, land_d = 5, colour = "gr
]
);
LCD1602APCBI2C = pcb("", "", [80, 36, 1.65], hole_d = 2.9, land_d = 5, colour = "green",
holes = [[-2.5, -2.5], [-2.5, 2.5], [2.5, 2.5], [2.5, -2.5]],
components = [
[-27.05, - 2.5, 0, "2p54header", 16, 1],
[ -27.05, -10.0, 0, "pcb", 3, I2C_LCD_Backpack],
],
grid = [
52.95 - inch(0.75), 36 - 2.5, 16, 1, silver, inch(0.1), inch(0.1),
]
);
LCD1602A = ["LCD1602A", "LCD display 1602A", 71.3, 24.3, 7.0, LCD1602APCB,
[0, 0, 0], // pcb offst
[[-64.5 / 2, -14.5 / 2], [64.5 / 2, 14.5 / 2, 0.6]], // aperture
@@ -54,6 +67,14 @@ LCD1602A = ["LCD1602A", "LCD display 1602A", 71.3, 24.3, 7.0, LCD1602APCB,
[], // clearance need for the ts ribbon
];
LCD1602AI2C = ["LCD1602A", "LCD display 1602A", 71.3, 24.3, 7.0, LCD1602APCBI2C,
[0, 0, 0], // pcb offst
[[-64.5 / 2, -14.5 / 2], [64.5 / 2, 14.5 / 2, 0.6]], // aperture
[], // touch screen
0, // thread length
[], // clearance need for the ts ribbon
];
LCD2004APCB = pcb("", "", [98, 60, 1.65], hole_d = 2.9, land_d = 5, colour = "green",
holes = [[-2.5, -2.5], [-2.5, 2.5], [2.5, 2.5], [2.5, -2.5]],
components = [
@@ -167,6 +188,6 @@ BigTreeTech_TFT35v3_0 = ["BigTreeTech_TFT35v3_0", "BigTreeTech TFT35 v3.0",
];
displays = [HDMI5, SSD1963_4p3, LCD2004A, BigTreeTech_TFT35v3_0, LCD1602A, LCDS7282B, TFT128x160];
displays = [HDMI5, SSD1963_4p3, LCD2004A, BigTreeTech_TFT35v3_0, LCD1602A, LCD1602AI2C, LCDS7282B, TFT128x160];
use <display.scad>

View File

@@ -650,9 +650,11 @@ module barrel_jack(cutout = false) { //! Draw barrel power jack
contact_d = 2;
contact_w = 4;
inset = 1;
if(cutout)
;
else {
if(cutout) {
rotate([0, 90, 0])
translate([-bore_h, 0])
cylinder(d = bore_d + panel_clearance, h = 100);
} else {
color(grey(20)) rotate([0, 90, 0]) {
linear_extrude(l, center = true) {
difference() {
@@ -1095,6 +1097,56 @@ module trimpot10(vertical, cutout = false) { //! Draw a ten turn trimpot
}
}
//! Draw a 1/4" square trimpot (https://ar.mouser.com/datasheet/2/54/3362-776956.pdf)
module trimpot3362() {
l = 6.60;
w = 6.99;
h = 4.88;
foot_w = 0.38;
foot_h = 0.38;
screw_h = 0;
screw_d = 2.25;
slot_w = 0.6;
slot_h = 0.8;
module adjust(){
d = 2.77;
width = 0.64;
deep = 0.89;
color("white"){
difference(){
cylinder(d=d, h=2*deep, center=true);
translate([0, 0, deep-deep/2+0.01])
cube([d, width, deep], center=true);
translate([0, 0, deep-deep/2+0.01]) rotate([0, 0, 90])
cube([d, width, deep], center=true);
}
}
}
color("#2CA1FD") {
difference(){
translate([0, 0, foot_h / 2 + h / 2])
cube([w, l, h - foot_h], center = true);
translate_z(h-0.88) hull() adjust();
//Grub
for(ang=[-30:30:210])
rotate([0, 0, ang])
translate([2.77/2+0.46, 0, h]) cube([1, 0.3, 0.3], center=true);
}
for(x = [-1, 1], y = [1, -1])
translate([x * (w - foot_w) / 2, y * (l - foot_w) / 2, h / 2])
cube([foot_w, foot_w, h], center = true);
for(x = [-1, 1])
translate([x*(w/2-1), -l/2, h/2+foot_h/2])
cube([0.7, 0.7, h-foot_h], center=true);
}
translate([0, 0, h-0.89]) adjust();
}
module block(size, colour, makes_cutout, cutouts, r = 0, rtop = 0) //! Draw a coloured cube to represent a random PCB component
if(cutouts) {
if(makes_cutout)
@@ -1179,6 +1231,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
if(show(comp, "jst_ph")) jst_xh_header(jst_ph_header, comp[4], param(5, false), param(6, false), param(7, undef));
if(show(comp, "jst_zh")) jst_xh_header(jst_zh_header, comp[4], param(5, false), param(6, false), param(7, undef));
if(show(comp, "potentiometer")) let(pot = param(4, BTT_encoder)) translate_z(pot_size(pot).z) vflip() potentiometer(pot, shaft_length = param(5, undef));
if(show(comp, "trimpot3362")) trimpot3362();
if(show(comp, "buzzer")) buzzer(param(4, 9), param(5, 12), param(6, grey(20)));
if(show(comp, "smd_250V_fuse")) smd_250V_fuse(comp[4], comp[5]);
if(show(comp, "smd_res")) smd_resistor(comp[4], comp[5]);

View File

@@ -1296,11 +1296,28 @@ tiny_buck = pcb("tiny_buck", "Ultra Small 3A buck regulator", [20, 11, 1.6],
grid = [inch(0.05), 11 / 2 - inch(0.15), 1, 4, "silver", 0, inch(0.1)]
);
I2C_LCD_Backpack = let(size=[42, 19, 1.2])
pcb("I2C_LCD_Backpack", "I2C / SPI character LCD backpack",
size = size, //size
colour = "black",
components = [[size[0]-2, -size[1]/2, 90, "2p54header", 4, 1, false, undef, true],
[2, size[1]-8.5, 270, "2p54header", 2, 1, false, false, true],
[size[0]/2, size[1]/2, 90, "smd_soic", SOIC16, "PCF8574"],
[size[0]*3/4, 11, 0, "trimpot3362"],
// Silkscreen
[size[0]*3/4+6, size[1]-5.8, 0, "text", 3, 1, "GND", "Liberation Sans:style=Bold"],
[size[0]*3/4+6, size[1]-5.8-2.54, 0, "text", 3, 1, "VCC", "Liberation Sans:style=Bold"],
[size[0]*3/4+6, size[1]-5.8-2.54*2, 0, "text", 3, 1, "SDA", "Liberation Sans:style=Bold"],
[size[0]*3/4+6, size[1]-5.8-2.54*3, 0, "text", 3, 1, "SCL", "Liberation Sans:style=Bold"]
],
grid = [2, size[1]-2, 16, 1, silver, inch(0.1), inch(0.9)]
);
tiny_pcbs = [ESP_201, ESP_01M, XIAO, ESP_12F, MP1584EN, ESP_01,tiny_buck, LIPO_fuel_gauge, 9DOF_stick];
big_pcbs = [BTT_RELAY_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_E3_TURBO, BTT_SKR_V1_4_TURBO, DuetE, Duex5];
pcbs = [KY_040, TP4056, L9110S, ZC_A0591, RCWL0516, MT3608,RAMPSEndstop, ArduinoNano, HW803_1WAY_RELAY, Feather405, RPI_Pico,
pcbs = [KY_040, TP4056, L9110S, ZC_A0591, RCWL0516, MT3608,RAMPSEndstop, ArduinoNano, I2C_LCD_Backpack, HW803_1WAY_RELAY, Feather405, RPI_Pico,
ESP32_DOIT_V1, BlackPill, RPI0, EnviroPlus, ArduinoUno3, ArduinoLeonardo, WD2002SJ, OPZ2, PanelDue_v3, RPI3A, RPI3, RPI4];
pcbs_not_shown = [Melzi, Duex2, PSU12V1A, Keyes5p1, PI_IO, ExtruderPCB];