mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-09-17 18:52:10 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
225ea9b451 | ||
|
d341ce499e | ||
|
e7376e28c4 | ||
|
e238eaa473 | ||
|
28d8cba98c |
@@ -3,6 +3,12 @@
|
||||
This changelog is generated by `changelog.py` using manually added semantic version tags to classify commits as breaking changes, additions or fixes.
|
||||
|
||||
|
||||
### [v19.5.0](https://github.com/nophead/NopSCADlib/releases/tag/v19.5.0 "show release") Additions [...](https://github.com/nophead/NopSCADlib/compare/v19.4.1...v19.5.0 "diff with v19.4.1")
|
||||
* 2022-02-01 [`04e94a8`](https://github.com/nophead/NopSCADlib/commit/04e94a859aa0d21f840c992b487a901f096790a4 "show commit") [C.P.](# "Chris Palmer") Added `earth_rot` parameter to `NEMA_screws()`.
|
||||
|
||||
#### [v19.4.1](https://github.com/nophead/NopSCADlib/releases/tag/v19.4.1 "show release") Fixes [...](https://github.com/nophead/NopSCADlib/compare/v19.4.0...v19.4.1 "diff with v19.4.0")
|
||||
* 2022-02-01 [`e696dc4`](https://github.com/nophead/NopSCADlib/commit/e696dc471845550eb94e1b648d8b109cc11a9bf1 "show commit") [C.P.](# "Chris Palmer") Fixed stupid bug in `euler()`.
|
||||
|
||||
### [v19.4.0](https://github.com/nophead/NopSCADlib/releases/tag/v19.4.0 "show release") Additions [...](https://github.com/nophead/NopSCADlib/compare/v19.3.0...v19.4.0 "diff with v19.3.0")
|
||||
* 2022-01-29 [`f33a067`](https://github.com/nophead/NopSCADlib/commit/f33a0675f5b9f6a5ebe1c4b9755e894d1e2b7994 "show commit") [C.P.](# "Chris Palmer") Updated images and readme.
|
||||
|
||||
|
@@ -86,7 +86,6 @@ function box_screw_length(type, top) =
|
||||
let(s = top ? box_top_sheet(type) : box_base_sheet(type))
|
||||
screw_length(box_screw(type), sheet_thickness(s) + box_corner_gap(type) + box_profile_overlap(type) - 1, washers = 2, insert = true, longer = true);
|
||||
|
||||
function box_wall_clearance(type) = box_sheet_slot(type) / 2 - sheet_thickness(box_sheets(type)) / 2;
|
||||
function box_margin(type) = box_profile_overlap(type) + box_corner_gap(type); //! How much the bezel intrudes on the specified height
|
||||
function box_intrusion(type) = box_hole_inset(type) + box_boss_r(type); //! Corner profile intrusion
|
||||
function sheet_reduction(type) = 2 * box_corner_gap(type) + sheet_end_clearance;
|
||||
|
@@ -121,7 +121,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)), ngb = true) {
|
||||
assembly(name ? name : str("corner_block_M", 20 * screw_radius(screw)), ngb = true) {
|
||||
insert = screw_insert(screw);
|
||||
|
||||
stl_colour(name ? pp2_colour : pp1_colour)
|
||||
@@ -256,7 +256,7 @@ module 2screw_block(screw = def_screw, name = false) { //! Generate the STL for
|
||||
}
|
||||
|
||||
module 2screw_block_assembly(screw = def_screw, name = false) //! The printed block with inserts
|
||||
assembly(str("2screw_block_M", 20 * screw_radius(screw)), ngb = true) {
|
||||
assembly(name ? name : str("2screw_block_M", 20 * screw_radius(screw)), ngb = true) {
|
||||
insert = screw_insert(screw);
|
||||
|
||||
stl_colour(name ? pp2_colour : pp1_colour)
|
||||
|
@@ -137,7 +137,7 @@ module pocket_handle_assembly(type) { //! Assembly with fasteners in place
|
||||
|
||||
translate_z(f.z + t / 2) hflip() {
|
||||
stl_colour(pp1_colour)
|
||||
pocket_handle(type);
|
||||
render() pocket_handle(type);
|
||||
|
||||
pocket_handle_hole_positions(type) {
|
||||
translate_z(f.z + t)
|
||||
|
@@ -6565,6 +6565,10 @@ Subsequent rotations use the minimum rotation method.
|
||||
The path can be open or closed. If closed sweep ensures that the start and end have the same rotation to line up.
|
||||
An additional twist around the path can be specified. If the path is closed this should be a multiple of 360.
|
||||
|
||||
`rounded_path()` can be used to generate a path of lines connected by arcs, useful for wire runs, etc.
|
||||
The vertices specify where the the path would be without any rounding.
|
||||
Each vertex, apart from the first and the last, has an associated radius and the path shortcuts the vertex with an arc specified by the radius.
|
||||
|
||||
[utils/sweep.scad](utils/sweep.scad) Implementation.
|
||||
|
||||
[tests/sweep.scad](tests/sweep.scad) Code for this example.
|
||||
@@ -6580,6 +6584,7 @@ An additional twist around the path can be specified. If the path is closed this
|
||||
| `helical_twist_per_segment(r, pitch, sides)` | Calculate the twist around Z that rotate_from_to() introduces |
|
||||
| `path_length(path, i = 0, length = 0)` | Calculated the length along a path |
|
||||
| `rectangle_points(w, h)` | Generate the points of a rectangle |
|
||||
| `rounded_path(path)` | Convert a rounded_path, consisting of a start coordinate, vertex / radius pairs and then an end coordinate, to a path of points for sweep. |
|
||||
| `skin_faces(points, npoints, facets, loop, offset = 0)` | Create the mesh for the swept volume without end caps |
|
||||
| `sweep(path, profile, loop = false, twist = 0)` | Generate the point list and face list of the swept volume |
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
Binary file not shown.
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 124 KiB |
@@ -32,22 +32,25 @@ loop_y = transform_points(loop, rotate([0, -90, $t * 360]));
|
||||
|
||||
loop_z = transform_points(loop, rotate([$t * 360, 0, 0]));
|
||||
|
||||
sweep(loop_z, L_points, loop = true);
|
||||
color("yellow") {
|
||||
sweep(loop_z, L_points, loop = true);
|
||||
|
||||
sweep(loop_x, L_points, loop = true);
|
||||
|
||||
sweep(loop_y, L_points, loop = true);
|
||||
sweep(loop_x, L_points, loop = true);
|
||||
|
||||
sweep(loop_y, L_points, loop = true);
|
||||
}
|
||||
|
||||
knot = [ for(i=[0:.2:359])
|
||||
[ (19*cos(3*i) + 40)*cos(2*i),
|
||||
(19*cos(3*i) + 40)*sin(2*i),
|
||||
19*sin(3*i) ] ];
|
||||
|
||||
sweep(knot, L_points, loop = true);
|
||||
color("red") sweep(knot, L_points, loop = true);
|
||||
|
||||
p = transform_points([[0,0,0], [20,0,5], [10,30,4], [0,0,0], [0,0,20]], scale(10));
|
||||
n = 100;
|
||||
path = bezier_path(p, n);
|
||||
|
||||
rotate(45) sweep(path, circle_points(5, $fn = 64));
|
||||
color("blue") rotate(45) sweep(path, circle_points(5, $fn = 64));
|
||||
|
||||
color("green") sweep(rounded_path([[-170, 0, 0], [-170, 170, 0], 10, [-170, 170, 30], 20, [-50, 170, 30], 10, [-130, 100, 40]]), circle_points(3, $fn = 64));
|
||||
|
@@ -25,6 +25,10 @@
|
||||
//!
|
||||
//! The path can be open or closed. If closed sweep ensures that the start and end have the same rotation to line up.
|
||||
//! An additional twist around the path can be specified. If the path is closed this should be a multiple of 360.
|
||||
//!
|
||||
//! `rounded_path()` can be used to generate a path of lines connected by arcs, useful for wire runs, etc.
|
||||
//! The vertices specify where the the path would be without any rounding.
|
||||
//! Each vertex, apart from the first and the last, has an associated radius and the path shortcuts the vertex with an arc specified by the radius.
|
||||
//
|
||||
include <../utils/core/core.scad>
|
||||
|
||||
@@ -179,3 +183,31 @@ function before(path1, path2) = //! Translate `path1` so its end meets the star
|
||||
function after(path1, path2) = //! Translate `path2` so its start meets the end of `path1` and then concatenate
|
||||
let(end1 = len(path1) - 1, end2 = len(path2) - 1, offset = path1[end1] - path2[0])
|
||||
concat(path1, [for(i = [1 : end2]) path2[i] + offset]);
|
||||
|
||||
function rounded_path(path) = //! Convert a rounded_path, consisting of a start coordinate, vertex / radius pairs and then an end coordinate, to a path of points for sweep.
|
||||
let(len = len(path)) assert(len > 3 && len % 2 == 0) [
|
||||
path[0], // First point has no radius
|
||||
for(i = [1 : 2 : len - 3]) let( // Step through the vertices with radii, i.e. not the first or last
|
||||
prev = max(i - 2, 0), // Index of previous point, might be the first point, which is a special case
|
||||
p0 = path[prev], // Point before the vertex
|
||||
p1 = path[i], // Vertex
|
||||
r = path[i + 1], // Radius of shortcut curve
|
||||
p2 = path[i + 2], // Point after the vertex
|
||||
v1 = assert(Len(p0) == 3, str("expected path[", prev, "] to be a vertex coordinate, got ", p0))
|
||||
assert(Len(p1) == 3, str("expected path[", i, "] to be a vertex coordinate, got ", p1))
|
||||
assert(Len(p2) == 3, str("expected path[", i + 2, "] to be a vertex coordinate, got ", p2))
|
||||
assert(is_num(r), str("expected path[", i + 1, "] to be a radius, got ", r))
|
||||
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
|
||||
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
|
||||
)
|
||||
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.
|
||||
path[len - 1], // Last point has no radius
|
||||
];
|
||||
|
Reference in New Issue
Block a user