1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-09-07 21:50:45 +02:00

Compare commits

..

5 Commits

Author SHA1 Message Date
Chris Palmer
0e2778e13d Cables can now have a list of wire colours.
Added a constructor for cables.
2022-02-15 21:51:09 +00:00
Chris Palmer
50e23e5f81 Added silkscreen text to PCBs. 2022-02-15 21:49:25 +00:00
Chris Palmer
59eeb2c5d4 Trimmed the ribbon clamp tape. 2022-02-15 10:52:38 +00:00
Chris Palmer
7ea4dbe6cb Fixed double application of r2sides() in rounded_path().
Added check for radius too big for corner in rounded_path().
Spiral paths can now have 0 twists.
2022-02-15 10:44:13 +00:00
Chris Palmer
0d062c24fa Updated changelog. 2022-02-11 09:11:05 +00:00
13 changed files with 23 additions and 5 deletions

View File

@@ -3,6 +3,13 @@
This changelog is generated by `changelog.py` using manually added semantic version tags to classify commits as breaking changes, additions or fixes.
### [v19.9.0](https://github.com/nophead/NopSCADlib/releases/tag/v19.9.0 "show release") Additions [...](https://github.com/nophead/NopSCADlib/compare/v19.8.1...v19.9.0 "diff with v19.8.1")
* 2022-02-11 [`95b6771`](https://github.com/nophead/NopSCADlib/commit/95b6771811fd48af46b5c2d426c42c04cd8e5af3 "show commit") [C.P.](# "Chris Palmer") Added printed cable clips.
* 2022-02-11 [`ed46cbb`](https://github.com/nophead/NopSCADlib/commit/ed46cbb1470587d4fa3ee4e0e8e0513c82693b1b "show commit") [C.P.](# "Chris Palmer") Fixed `cable_bundle()` bugs and added test.
Added `cable_bundle_positions()`.
Can now mark cables as ribbon to force a flat layout.
#### [v19.8.1](https://github.com/nophead/NopSCADlib/releases/tag/v19.8.1 "show release") Fixes [...](https://github.com/nophead/NopSCADlib/compare/v19.8.0...v19.8.1 "diff with v19.8.0")
* 2022-02-09 [`2a2b7d8`](https://github.com/nophead/NopSCADlib/commit/2a2b7d8bd60f0ea8ad2c428593e7aea1dfa06e9c "show commit") [C.P.](# "Chris Palmer") Added a second example project.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 KiB

After

Width:  |  Height:  |  Size: 982 KiB

View File

@@ -105,7 +105,7 @@ assembly(let(screw_d = screw_radius(screw) * 2)str("ribbon_clamp_", str_ways(way
module ribbon_clamp_fastened_assembly(ways, thickness, screw = screw) { //! Clamp with fasteners in place
tape_l = floor(ribbon_clamp_slot(ways));
tape_width = 25;
tape_width = ribbon_clamp_width(screw) + 2;
tape_thickness = 0.5;
vitamin(str(": Tape self amalgamating silicone ",tape_l," x 25mm"));

View File

@@ -4391,12 +4391,14 @@ Just a BOM entry at the moment and cable bundle size functions for holes, plus c
### Functions
| Function | Description |
|:--- |:--- |
| `cable(wires, size, colours, ribbon = false)` | Cable constructor |
| `cable_bundle(cable)` | Arrangement of a bundle in a flat cable clip |
| `cable_bundle_positions(cable)` | Positions of wires in a bundle to go through a cable strip |
| `cable_height(cable)` | Height in flat clip |
| `cable_is_ribbon(cable)` | Is a ribbon cable? |
| `cable_radius(cable)` | Radius of a bundle of wires, see <http://mathworld.wolfram.com/CirclePacking.html>. |
| `cable_width(cable)` | Width in flat clip |
| `cable_wire_colours(cable)` | Individual wire colours |
| `cable_wire_size(cable)` | Size of each wire in a bundle |
| `cable_wires(cable)` | Number of wires in a bundle |
| `wire_hole_radius(cable)` | Radius of a hole to accept a bundle of wires, rounded up to standard metric drill size |

View File

@@ -89,6 +89,7 @@ test_pcb = ["test_pcb", "Test PCB",
[ 8, 155, 180, "usb_B"],
[ 25, 200, 0, "buzzer", 4.5, 8.5],
[ 25, 218, 0, "buzzer"],
[ 38, 190, -90, "text", 25, 4, "Silkscreen", "Liberation Sans:style=Bold"],
[ 8, 190, 180, "jack"],
[ 6, 200, 180, "barrel_jack"],
[ 5, 218, 180, "hdmi"],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 129 KiB

View File

@@ -215,12 +215,16 @@ function rounded_path(path) = //! Convert a rounded_path, consisting of a start
p0 - p1, // Calculate vectors between vertices
v2 = p2 - p1,
a = angle_between(v1, -v2), // Angle turned through
arc_start = p1 + unit(v1) * r * tan(a / 2), // Calc the start position
d = r * tan(a / 2), // Distance from vertex to tangents
room = min(norm(v1), norm(v2)), // Maximum distance
arc_start = assert(d <= room,
str("Can't fit radius ", r, " into corner at vertex path[", i, "] = ", p1, " only room for radius ", room / tan(a / 2)))
p1 + unit(v1) * d, // Calc the start position
z_axis = unit(cross(v1, v2)), // z_axis is perpendicular to both vectors
centre = arc_start + unit(cross(z_axis, v1)) * r, // Arc center is a radius away, and perpendicular to v1 and the z_axis.
x_axis = arc_start - centre, // Make the x_axis along the radius to the start point, includes radius a scale factor
y_axis = cross(x_axis, z_axis), // y_axis perpendicular to the other two
sides = r2sides(ceil(r2sides(r) * a / 360)) // Sides needed to make the arc
sides = ceil(r2sides(r) * a / 360) // Sides needed to make the arc
)
for(j = [0 : sides], t = a * j / sides) // For each vertex in the arc
cos(t) * x_axis + sin(t) * y_axis + centre, // Circular arc in the tiled xy plane.
@@ -240,7 +244,7 @@ function segmented_path(path, min_segment) = [ //! Add points to a path to enfo
];
function spiral_paths(path, n, r, twists, start_angle) = let( //! Create a new paths which sprial around the given path. Use for making twisted cables
segment = path_length(path) / twists / r2sides(2 * r),
segment = twists ? path_length(path) / twists / r2sides(2 * r) : inf,
transforms = sweep_transforms(segmented_path(path, segment), twist = 360 * twists),
initial = [r, 0, 0, 1] * rotate(start_angle)
) [for(i = [0 : n - 1]) let(initial = [r, 0, 0, 1] * rotate(start_angle + i * 360 / n)) [for(t = transforms) initial * t]];

View File

@@ -1091,6 +1091,8 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
if(show(comp, "smd_sot")) smd_sot(comp[4], comp[5]);
if(show(comp, "vero_pin")) vero_pin(param(4, false));
if(show(comp, "terminal")) terminal_block(comp[5], comp[4]);
if(show(comp, "text")) color("white") linear_extrude(eps) resize([comp[4], comp[5]]) text(comp[6], font = param(7, "Liberation Mono"), valign = "center", halign = "center");
}
}
}

View File

@@ -153,7 +153,7 @@ module smd_sot(type, value) { //! Draw an SMD transistor
ls = smd_sot_lead_size(type);
r = ls.z;
gullwing = rounded_path([[0, 0, ls.z / 2], [0, ls.y - ls.z, ls.z / 2], r, [0, ls.y -ls.z + z1 - ls.z, z1 - ls.z / 2], r, [0, span / 2, z1 - ls.z / 2]]);
gullwing = rounded_path([[0, 0, ls.z / 2], [0, ls.y - ls.z, ls.z / 2], r, [0, ls.y -ls.z + z1 - ls.z, z1 - ls.z / 2], r, [0, span / 2, z1 - ls.z / 2]], $fn = 32);
color(grey(20))
hull()

View File

@@ -35,6 +35,8 @@ module ribbon_cable(ways, length) //! Add ribbon cable to the
function cable_wires(cable) = cable[0]; //! Number of wires in a bundle
function cable_wire_size(cable) = cable[1]; //! Size of each wire in a bundle
function cable_is_ribbon(cable) = len(cable) > 2 && cable[2]; //! Is a ribbon cable?
function cable_wire_colours(cable) = assert(len(cable[3]) == cable_wires(cable)) cable[3]; //! Individual wire colours
function cable(wires, size, colours, ribbon = false) = [wires, size, ribbon, colours]; //! Cable constructor
// numbers from http://mathworld.wolfram.com/CirclePacking.html
function cable_radius(cable) = [0, 1, 2, 2.15, 2.41, 2.7, 3, 3, 3.3][cable_wires(cable)] * cable_wire_size(cable) / 2; //! Radius of a bundle of wires, see <http://mathworld.wolfram.com/CirclePacking.html>.