mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
commit
c4b83ee3b8
2 changed files with 26 additions and 26 deletions
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
@ -404,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
|
||||
|
@ -424,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
|
||||
|
@ -444,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.
|
||||
|
@ -470,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);
|
||||
```
|
||||
|
||||
|
||||
|
@ -486,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
|
||||
|
@ -501,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.
|
||||
|
@ -509,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
|
||||
|
@ -533,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
|
||||
|
@ -545,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.
|
||||
|
@ -571,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
|
||||
|
@ -588,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=`.
|
||||
|
@ -604,19 +601,19 @@ 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
|
||||
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.
|
||||
|
||||
```openscad-FlatSpin
|
||||
```openscad-FlatSpin,VPD=500
|
||||
module stellate_cube(s=100, anchor=CENTER, spin=0, orient=UP) {
|
||||
s2 = 3 * s;
|
||||
verts = [
|
||||
|
@ -648,12 +645,12 @@ 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.
|
||||
|
||||
```openscad
|
||||
```openscad-VPD=1250
|
||||
module stellate_cube(s=100, anchor=CENTER, spin=0, orient=UP) {
|
||||
s2 = 3 * s;
|
||||
verts = [
|
||||
|
@ -672,7 +669,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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue