From 165a454ff978d670f326a10127446569fe21216d Mon Sep 17 00:00:00 2001 From: Garth Minette Date: Mon, 26 Apr 2021 15:52:23 -0700 Subject: [PATCH 1/3] Attachments tutorial bugfixes. --- scripts/tutorial_gen.py | 5 ++++- tutorials/Attachments.md | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/tutorial_gen.py b/scripts/tutorial_gen.py index 24d4a28..6e6d62c 100755 --- a/scripts/tutorial_gen.py +++ b/scripts/tutorial_gen.py @@ -73,7 +73,10 @@ def processFile(infile, outfile=None, imgroot=""): elif in_script: if line == "```": in_script = False - imgfile = os.path.join(imgroot, "{}_{}.png".format(fileroot, imgnum)) + fext = "png" + if any(x in extyp for x in ("Anim", "Spin")): + fext = "gif" + imgfile = os.path.join(imgroot, "{}_{}.{}".format(fileroot, imgnum, fext)) imgmgr.new_request( fileroot+".md", linenum, imgfile, script, extyp, diff --git a/tutorials/Attachments.md b/tutorials/Attachments.md index 3879f47..7c4eb1f 100644 --- a/tutorials/Attachments.md +++ b/tutorials/Attachments.md @@ -611,7 +611,7 @@ spikeball(r=50, scale=[0.75,1,1.5]); If the shape just doesn't fit into any of the above categories, and you constructed it as a [VNF](vnf.scad), you can use the VNF itself to describe the geometry with the `vnf=` argument. -There are two variations to how anchoring can work for VNFs. When `extents=true`, (the default) +There are two variations to how anchoring can work for VNFs. When `extent=true`, (the default) then a plane is projected out from the origin, perpendicularly in the direction of the anchor, to the furthest distance that intersects with the VNF shape. The anchorpoint is then the center of the points that still intersect that plane. @@ -648,7 +648,7 @@ stellate_cube(25) { } ``` -When `extents=false`, then the anchorpoint will be the furthest intersection of the VNF with +When `extent=false`, then the anchorpoint will be the furthest intersection of the VNF with the anchor ray from the origin. The orientation of the anchorpoint will be the normal of the face at the intersection. If the intersection is at an edge or corner, then the orientation will bisect the angles between the faces. @@ -672,7 +672,7 @@ module stellate_cube(s=100, anchor=CENTER, spin=0, orient=UP) { [9,10,13], [10,11,13], [11,12,13], [12,9,13] ]; vnf = [verts, faces]; - attachable(anchor,spin,orient, vnf=vnf, extents=false) { + attachable(anchor,spin,orient, vnf=vnf, extent=false) { vnf_polyhedron(vnf); children(); } From d70ebb2dceeff3dd4f0101dbd881de925154f949 Mon Sep 17 00:00:00 2001 From: Garth Minette Date: Mon, 26 Apr 2021 18:37:57 -0700 Subject: [PATCH 2/3] Fixed formatting issue in Attachments tutorial. --- tutorials/Attachments.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tutorials/Attachments.md b/tutorials/Attachments.md index 7c4eb1f..b7c62ce 100644 --- a/tutorials/Attachments.md +++ b/tutorials/Attachments.md @@ -227,7 +227,7 @@ cube(40, center=true) anchor_arrow(); ``` -For large objects, you chan change the size of the arrow with the `s=` argument. +For large objects, you can change the size of the arrow with the `s=` argument. ```openscad sphere(d=100) @@ -252,14 +252,13 @@ sphere(d=40) show_anchors(); ``` -For large objects, you chan again change the size of the arrows with the `s=` argument. +For large objects, you can again change the size of the arrows with the `s=` argument. ```openscad cylinder(h=100, d=100, center=true) show_anchors(s=30); ``` -```openscad ## Tagged Operations BOSL2 introduces the concept of tags. Tags are names that can be given to attachables, so that you can refer to them when performing `diff()`, `intersect()`, and `hulling()` operations. From 5de7b465193a2f9639606511d8acb189df5ce9d3 Mon Sep 17 00:00:00 2001 From: Garth Minette Date: Mon, 26 Apr 2021 19:53:14 -0700 Subject: [PATCH 3/3] Added show_anchors() to a lot of attachables tutorial. --- tutorials/Attachments.md | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/tutorials/Attachments.md b/tutorials/Attachments.md index b7c62ce..5be59a8 100644 --- a/tutorials/Attachments.md +++ b/tutorials/Attachments.md @@ -403,7 +403,7 @@ module cubic_barbell(s=100, anchor=CENTER, spin=0, orient=UP) { children(); } } -cubic_barbell(100); +cubic_barbell(100) show_anchors(30); ``` When the shape is prismoidal, where the top is a different size from the bottom, you can use @@ -423,7 +423,7 @@ module prismoidal(size=[100,100,100], scale=0.5, anchor=CENTER, spin=0, orient=U children(); } } -prismoidal([100,60,30], scale=0.5); +prismoidal([100,60,30], scale=0.5) show_anchors(20); ``` When the top of the prismoid can be shifted away from directly above the bottom, you can use @@ -443,7 +443,7 @@ module prismoidal(size=[100,100,100], scale=0.5, shift=[0,0], anchor=CENTER, spi children(); } } -prismoidal([100,60,30], scale=0.5, shift=[-30,20]); +prismoidal([100,60,30], scale=0.5, shift=[-30,20]) show_anchors(20); ``` In the case that the prismoid is not oriented vertically, you can use the `axis=` argument. @@ -469,7 +469,7 @@ module yprismoidal( children(); } } -yprismoidal([100,60,30], scale=1.5, shift=[20,20]); +yprismoidal([100,60,30], scale=1.5, shift=[20,20]) show_anchors(20); ``` @@ -485,7 +485,7 @@ module twistar(l,r,d, anchor=CENTER, spin=0, orient=UP) { children(); } } -twistar(l=100, r=40); +twistar(l=100, r=40) show_anchors(20); ``` If the cylinder is elipsoidal in shape, you can pass the inequal X/Y sizes as a 2-item vector @@ -500,7 +500,7 @@ module ovalstar(l,rx,ry, anchor=CENTER, spin=0, orient=UP) { children(); } } -ovalstar(l=100, rx=50, ry=30); +ovalstar(l=100, rx=50, ry=30) show_anchors(20); ``` For cylindrical shapes that arent oriented vertically, use the `axis=` argument. @@ -508,14 +508,14 @@ For cylindrical shapes that arent oriented vertically, use the `axis=` argument. ```openscad module ytwistar(l,r,d, anchor=CENTER, spin=0, orient=UP) { r = get_radius(r=r,d=d,dflt=1); - attachable(anchor,spin,orient, r=r, l=l) { + attachable(anchor,spin,orient, r=r, l=l, axis=BACK) { xrot(-90) linear_extrude(height=l, twist=90, slices=20, center=true, convexity=4) star(n=20, r=r, ir=r*0.9); children(); } } -ytwistar(l=100, r=40); +ytwistar(l=100, r=40) show_anchors(20); ``` ### Conical Attachables @@ -532,7 +532,7 @@ module twistar(l, r,r1,r2, d,d1,d2, anchor=CENTER, spin=0, orient=UP) { children(); } } -twistar(l=100, r1=40, r2=20); +twistar(l=100, r1=40, r2=20) show_anchors(20); ``` If the cone is elipsoidal in shape, you can pass the inequal X/Y sizes as a 2-item vectors @@ -544,17 +544,15 @@ module ovalish(l,rx1,ry1,rx2,ry2, anchor=CENTER, spin=0, orient=UP) { hull() { up(l/2-0.005) linear_extrude(height=0.01, center=true) - scale([1,ry2/rx2,1]) - oval([rx2,ry2]); + oval([rx2,ry2]); down(l/2-0.005) linear_extrude(height=0.01, center=true) - scale([1,ry1/rx1,1]) - oval([rx1,ry1]); + oval([rx1,ry1]); } children(); } } -ovalish(l=100, rx1=40, ry1=30, rx2=30, ry2=40); +ovalish(l=100, rx1=50, ry1=30, rx2=30, ry2=50) show_anchors(20); ``` For conical shapes that are not oriented vertically, use the `axis=` argument. @@ -570,7 +568,7 @@ module ytwistar(l, r,r1,r2, d,d1,d2, anchor=CENTER, spin=0, orient=UP) { children(); } } -ytwistar(l=100, r1=40, r2=20); +ytwistar(l=100, r1=40, r2=20) show_anchors(20); ``` ### Spherical Attachables @@ -587,7 +585,7 @@ module spikeball(r, d, anchor=CENTER, spin=0, orient=UP) { children(); } } -spikeball(r=50); +spikeball(r=50) show_anchors(20); ``` If the shape is more of an ovoid, you can pass a 3-item vector of sizes to `r=` or `d=`. @@ -603,7 +601,7 @@ module spikeball(r, d, scale, anchor=CENTER, spin=0, orient=UP) { children(); } } -spikeball(r=50, scale=[0.75,1,1.5]); +spikeball(r=50, scale=[0.75,1,1.5]) show_anchors(20); ``` ### VNF Attachables @@ -615,7 +613,7 @@ then a plane is projected out from the origin, perpendicularly in the direction to the furthest distance that intersects with the VNF shape. The anchorpoint is then the center of the points that still intersect that plane. -```openscad-FlatSpin +```openscad-FlatSpin,VPD=500 module stellate_cube(s=100, anchor=CENTER, spin=0, orient=UP) { s2 = 3 * s; verts = [ @@ -652,7 +650,7 @@ the anchor ray from the origin. The orientation of the anchorpoint will be the n face at the intersection. If the intersection is at an edge or corner, then the orientation will bisect the angles between the faces. -```openscad +```openscad-VPD=1250 module stellate_cube(s=100, anchor=CENTER, spin=0, orient=UP) { s2 = 3 * s; verts = [