1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-09-04 12:45:30 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Chris Palmer
04e94a859a Added earth_rot parameter to NEMA_screws(). 2022-02-01 23:25:04 +00:00
Chris Palmer
e696dc4718 Fixed stupid bug in euler(). 2022-02-01 23:24:14 +00:00
Chris Palmer
30955eb350 Updated changelog. 2022-01-29 14:42:31 +00:00
4 changed files with 14 additions and 6 deletions

View File

@@ -3,6 +3,14 @@
This changelog is generated by `changelog.py` using manually added semantic version tags to classify commits as breaking changes, additions or fixes.
### [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.
* 2022-01-29 [`5223415`](https://github.com/nophead/NopSCADlib/commit/52234154294011d4cc312f9ff98716f484d20a41 "show commit") [C.P.](# "Chris Palmer") Ball bearing test now two rows.
* 2022-01-28 [`f87f3f5`](https://github.com/nophead/NopSCADlib/commit/f87f3f51ee778ef7ca30319d1d6ff3f4013e8258 "show commit") [M.B.](# "Martin Budden") Added support for flanged bearings.
Also added some new cartridge bearings.
### [v19.3.0](https://github.com/nophead/NopSCADlib/releases/tag/v19.3.0 "show release") Additions [...](https://github.com/nophead/NopSCADlib/compare/v19.2.0...v19.3.0 "diff with v19.2.0")
* 2022-01-29 [`1ee80f4`](https://github.com/nophead/NopSCADlib/commit/1ee80f4a908ff9939d06186f3b22f54f726fc4d2 "show commit") [C.P.](# "Chris Palmer") Ribbon clamps can now be made to hold multiple ribbons.

View File

@@ -3876,7 +3876,7 @@ NEMA stepper motor model.
| `NEMA(type, shaft_angle = 0, jst_connector = false)` | Draw specified NEMA stepper motor |
| `NEMA_outline(type)` | 2D outline |
| `NEMA_screw_positions(type, n = 4)` | Positions children at the screw holes |
| `NEMA_screws(type, screw, n = 4, screw_length = 8, earth = undef)` | Place screws and optional earth tag |
| `NEMA_screws(type, screw, n = 4, screw_length = 8, earth = undef, earth_rot = undef)` | Place screws and optional earth tag |
![stepper_motors](tests/png/stepper_motors.png)

View File

@@ -103,11 +103,11 @@ function reverse(v) = let(n = len(v) - 1) n < 0 ? [] : [for(i = [0 : n]) v[n - i
function angle_between(v1, v2) = acos(v1 * v2 / (norm(v1) * norm(v2))); //! Return the angle between two vectors
// https://www.gregslabaugh.net/publications/euler.pdf
// http://eecs.qmul.ac.uk/~gslabaugh/publications/euler.pdf
function euler(R) = let(ay = asin(-R[2][0]), cy = cos(ay)) //! Convert a rotation matrix to a Euler rotation vector.
cy ? [ atan2(R[2][1] / cy, R[2][2] / cy), ay, atan2(R[1][0] / cy, R[0][0] / cy) ]
: R[2][0] < 0 ? [atan2( R[0][1], R[0][2]), 180, 0]
: [atan2(-R[0][1], -R[0][2]), -180, 0];
: R[2][0] < 0 ? [atan2( R[0][1], R[0][2]), 90, 0]
: [atan2(-R[0][1], -R[0][2]), -90, 0];
module position_children(list, t) //! Position children if they are on the Z = 0 plane when transformed by t
for(p = list)

View File

@@ -205,12 +205,12 @@ module NEMA_screw_positions(type, n = 4) { //! Positions children at the screw h
children();
}
module NEMA_screws(type, screw, n = 4, screw_length = 8, earth = undef) //! Place screws and optional earth tag
module NEMA_screws(type, screw, n = 4, screw_length = 8, earth = undef, earth_rot = undef) //! Place screws and optional earth tag
NEMA_screw_positions(type, n)
if($i != earth)
screw_and_washer(screw, screw_length, true);
else
rotate($i > 1 ? 180 : 0)
rotate(is_undef(earth_rot) ? $i > 1 ? 180 : 0 : earth_rot)
ring_terminal(M3_ringterm)
star_washer(screw_washer(screw))
screw(screw, screw_length);