Compare commits

...

19 commits

Author SHA1 Message Date
adrianVmariano
a555e423f0
Merge fdda08e071 into 38f9a9b40c 2024-09-29 16:38:37 +00:00
Adrian Mariano
fdda08e071 remove euler angle from Shapes3d tutorial, cubetruss needs DOWN axis
so permit negative axis directions
2024-09-29 12:37:57 -04:00
Adrian Mariano
7b56835903 fixing the fix 2024-09-29 11:21:36 -04:00
Revar Desmera
38f9a9b40c
Merge pull request #1478 from adrianVmariano/master
attachments update
2024-09-29 01:25:07 -07:00
Revar Desmera
d8214cc0e1
Merge pull request #1477 from adrianVmariano/master
rounded_prism fixes & attachment updates
2024-09-26 18:01:06 -07:00
Revar Desmera
456fcd8d8a
Merge pull request #1475 from adrianVmariano/master
Fox default font
2024-09-22 20:09:39 -07:00
Revar Desmera
8a930d5495
Merge pull request #1472 from adrianVmariano/master
offset() default fix & planetary gears docfix
2024-09-19 23:29:30 -07:00
Revar Desmera
eda0cd75b5
Merge pull request #1469 from adrianVmariano/master
regular_prism(), prismoid and wedge anchors
2024-09-07 22:25:56 -07:00
Revar Desmera
53af9121e7
Merge pull request #1464 from adrianVmariano/master
doc fix & screws fix
2024-08-11 22:48:27 -07:00
Revar Desmera
736fad321b
Merge pull request #1459 from adrianVmariano/master 2024-07-27 14:01:30 -07:00
Revar Desmera
cc08eb3323
Merge pull request #1458 from adrianVmariano/master
Fix new examples
2024-07-27 02:21:31 -07:00
Revar Desmera
78ea8e4770
Merge pull request #1457 from adrianVmariano/master
vnf_sheet & bezier_sheet
2024-07-25 23:01:31 -07:00
Revar Desmera
8383d360cc
Merge pull request #1454 from adrianVmariano/master
various fixes
2024-07-19 21:35:00 -07:00
Revar Desmera
9145c0961f
Merge pull request #1450 from BelfrySCAD/revarbat_dev
Remove redundant collinear points from bezpath_curve() output.
2024-07-07 00:34:15 -07:00
Revar Desmera
ebb98b47d2 Remove redundant collinear points from bezpath_curve() output. 2024-07-07 00:11:23 -07:00
Revar Desmera
8ea8ebf341
Merge pull request #1447 from adrianVmariano/master
su/product optimization
2024-06-29 15:41:11 -07:00
Revar Desmera
17e307fdb4
Merge pull request #1446 from adrianVmariano/master
projection doc fix
2024-06-22 20:58:13 -07:00
Revar Desmera
67f0004773
Merge pull request #1445 from adrianVmariano/master
add projection()
2024-06-22 18:10:12 -07:00
Revar Desmera
76d09271c1
Merge pull request #1441 from adrianVmariano/master
spiral sweep bugfix
2024-06-12 22:57:08 -07:00
3 changed files with 30 additions and 28 deletions

View file

@ -2960,7 +2960,7 @@ module corner_profile(corners=CORNERS_ALL, except=[], r, d, convexity=10) {
// recolor("blue") cyl(d=5,h=5);
module attachable(
anchor=CENTER, spin=0, orient,
anchor, spin, orient,
size, size2, shift,
r,r1,r2, d,d1,d2, l,h,
vnf, path, region,
@ -2975,10 +2975,12 @@ module attachable(
) {
dummy1 =
assert($children==2, "attachable() expects exactly two children; the shape to manage, and the union of all attachment candidates.")
assert(is_vector(anchor) || is_string(anchor), str("Invalid anchor: ",anchor))
assert(is_finite(spin), str("Invalid spin: ",spin))
assert(is_undef(anchor) || is_vector(anchor) || is_string(anchor), str("Invalid anchor: ",anchor))
assert(is_undef(spin) || is_finite(spin), str("Invalid spin: ",spin))
assert(is_undef(orient) || is_vector(orient,3), str("Invalid orient: ",orient));
assert(in_list(axis,[UP,RIGHT,BACK]), "axis must be a positive coordinate direction, either UP, BACK or RIGHT");
assert(in_list(v_abs(axis),[UP,RIGHT,BACK]), "axis must be a coordinate direction");
anchor = default(anchor,CENTER);
spin = default(spin,0);
orient = is_def($anchor_override)? UP : default(orient, UP);
region = !is_undef(region)? region :
!is_undef(path)? [path] :
@ -3120,7 +3122,7 @@ module attachable(
// axis = The vector pointing along the axis of a geometry. Default: UP
// p = The VNF, path, or point to transform.
function reorient(
anchor=CENTER, spin=0, orient=UP,
anchor, spin, orient,
size, size2, shift,
r,r1,r2, d,d1,d2, l,h,
vnf, path, region,
@ -3133,10 +3135,13 @@ function reorient(
geom,
p=undef
) =
assert(is_vector(anchor) || is_string(anchor), str("Invalid anchor: ",anchor))
assert(is_finite(spin), str("Invalid spin: ",spin))
assert(is_vector(orient,3), str("Invalid orient: ",orient))
assert(is_undef(anchor) || is_vector(anchor) || is_string(anchor), str("Invalid anchor: ",anchor))
assert(is_undef(spin) || is_finite(spin), str("Invalid spin: ",spin))
assert(is_undef(orient) || is_vector(orient,3), str("Invalid orient: ",orient))
let(
anchor = default(anchor, CENTER),
spin = default(spin, 0),
orient = default(orient, UP),
region = !is_undef(region)? region :
!is_undef(path)? [path] :
undef,
@ -3613,11 +3618,14 @@ function _attach_geom_edge_path(geom, edge) =
/// geom = The geometry description of the shape.
/// p = If given as a VNF, path, or point, applies the affine3d transformation matrix to it and returns the result.
function _attach_transform(anchor=CENTER, spin=0, orient=UP, geom, p) =
assert(is_vector(anchor) || is_string(anchor), str("Invalid anchor: ",anchor))
assert(is_finite(spin), str("Invalid spin: ",spin))
assert(is_vector(orient,3), str("Invalid orient: ",orient))
function _attach_transform(anchor, spin, orient, geom, p) =
assert(is_undef(anchor) || is_vector(anchor) || is_string(anchor), str("Invalid anchor: ",anchor))
assert(is_undef(spin) || is_finite(spin), str("Invalid spin: ",spin))
assert(is_undef(orient) || is_vector(orient,3), str("Invalid orient: ",orient))
let(
anchor=default(anchor,CENTER),
spin=default(spin,0),
orient=default(orient,UP),
two_d = _attach_geom_2d(geom),
m = ($attach_to != undef) ? // $attach_to is the attachment point on this object
( // which will attach to the parent

View file

@ -466,12 +466,15 @@ function bezpath_curve(bezpath, splinesteps=16, N=3, endpoint=true) =
assert(len(bezpath)%N == 1, str("A degree ",N," bezier path should have a multiple of ",N," points in it, plus 1."))
let(
segs = (len(bezpath)-1) / N,
step = 1 / splinesteps
) [
step = 1 / splinesteps,
path = [
for (seg = [0:1:segs-1])
each bezier_points(select(bezpath, seg*N, (seg+1)*N), [0:step:1-step/2]),
if (endpoint) last(bezpath)
];
],
is_closed = approx(path[0], last(path)),
out = path_merge_collinear(path, closed=is_closed)
) out;
// Function: bezpath_closest_point()

View file

@ -47,22 +47,13 @@ include <BOSL2/std.scad>
cube([50,40,20], anchor=TOP+FRONT+LEFT);
```
You can use `spin=` to rotate around the Z axis:
You can use `spin=` to rotate around the Z axis **after** anchoring:
```openscad-3D
include <BOSL2/std.scad>
cube([50,40,20], anchor=FRONT, spin=30);
```
3D objects also gain the ability to use an extra trick with `spin=`;
if you pass a list of `[X,Y,Z]` rotation angles to `spin=`, it will
rotate by the three given axis angles, similar to using `rotate()`:
```openscad-3D
include <BOSL2/std.scad>
cube([50,40,20], anchor=FRONT, spin=[15,0,30]);
```
3D objects also can be given an `orient=` argument as a vector, pointing
to where the top of the shape should be rotated towards.