mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-09-25 16:59:03 +02:00
assorted doc fixes
This commit is contained in:
@@ -681,54 +681,6 @@ prismoid(150,60,100)
|
||||
show_anchors(s=45);
|
||||
```
|
||||
|
||||
Is is also possible to attach to edges and corners of the parent
|
||||
object. The anchors for edges spin the child so its BACK direction is
|
||||
aligned with the edge. If the edge belongs to a top or bottom
|
||||
horizontal face, then the BACK directions will point clockwise around
|
||||
the face, as seen from outside the shape. (This is the same direction
|
||||
required for construction of valid faces in OpenSCAD.) Otherwise, the
|
||||
BACK direction will point upwards.
|
||||
|
||||
Examine the red flags below, where only edge anchors appear on a
|
||||
prismoid. The top face shows the red flags pointing clockwise.
|
||||
The sloped side edges point along the edges, generally upward, and
|
||||
the bottom ones appear to point counter-clockwise, but if we viewed
|
||||
the shape from the bottom they would also appear clockwise.
|
||||
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
prismoid([100,175],[55,88], h=55)
|
||||
for(i=[-1:1], j=[-1:1], k=[-1:1])
|
||||
let(anchor=[i,j,k])
|
||||
if (sum(v_abs(anchor))==2)
|
||||
attach(anchor,BOT)anchor_arrow(40);
|
||||
```
|
||||
|
||||
In this example cylinders sink half-way into the top edges of the
|
||||
prismoid:
|
||||
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
$fn=16;
|
||||
r=6;
|
||||
prismoid([100,175],[55,88], h=55){
|
||||
attach([TOP+RIGHT,TOP+LEFT],LEFT,overlap=r/2) cyl(r=r,l=88+2*r,rounding=r);
|
||||
attach([TOP+FWD,TOP+BACK],LEFT,overlap=r/2) cyl(r=r,l=55+2*r, rounding=r);
|
||||
}
|
||||
```
|
||||
|
||||
This type of edge attachment is useful for attaching 3d edge masks to
|
||||
edges:
|
||||
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
$fn=32;
|
||||
diff()
|
||||
cuboid(75)
|
||||
attach([FRONT+LEFT, FRONT+RIGHT, BACK+LEFT, BACK+RIGHT],
|
||||
FWD+LEFT,inside=true)
|
||||
rounding_edge_mask(l=76, r1=8,r2=28);
|
||||
```
|
||||
|
||||
## Parent-Child Anchor Attachment (Double Argument Attachment)
|
||||
|
||||
@@ -1098,6 +1050,55 @@ cylinder(d1=30,d2=15,h=25)
|
||||
cylinder(d1=30,d2=15,h=25);
|
||||
```
|
||||
|
||||
Is is also possible to attach to edges and corners of the parent
|
||||
object. The anchors for edges spin the child so its BACK direction is
|
||||
aligned with the edge. If the edge belongs to a top or bottom
|
||||
horizontal face, then the BACK directions will point clockwise around
|
||||
the face, as seen from outside the shape. (This is the same direction
|
||||
required for construction of valid faces in OpenSCAD.) Otherwise, the
|
||||
BACK direction will point upwards.
|
||||
|
||||
Examine the red flags below, where only edge anchors appear on a
|
||||
prismoid. The top face shows the red flags pointing clockwise.
|
||||
The sloped side edges point along the edges, generally upward, and
|
||||
the bottom ones appear to point counter-clockwise, but if we viewed
|
||||
the shape from the bottom they would also appear clockwise.
|
||||
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
prismoid([100,175],[55,88], h=55)
|
||||
for(i=[-1:1], j=[-1:1], k=[-1:1])
|
||||
let(anchor=[i,j,k])
|
||||
if (sum(v_abs(anchor))==2)
|
||||
attach(anchor,BOT)anchor_arrow(40);
|
||||
```
|
||||
|
||||
In this example cylinders sink half-way into the top edges of the
|
||||
prismoid:
|
||||
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
$fn=16;
|
||||
r=6;
|
||||
prismoid([100,175],[55,88], h=55){
|
||||
attach([TOP+RIGHT,TOP+LEFT],LEFT,overlap=r/2) cyl(r=r,l=88+2*r,rounding=r);
|
||||
attach([TOP+FWD,TOP+BACK],LEFT,overlap=r/2) cyl(r=r,l=55+2*r, rounding=r);
|
||||
}
|
||||
```
|
||||
|
||||
This type of edge attachment is useful for attaching 3d edge masks to
|
||||
edges:
|
||||
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
$fn=32;
|
||||
diff()
|
||||
cuboid(75)
|
||||
attach([FRONT+LEFT, FRONT+RIGHT, BACK+LEFT, BACK+RIGHT],
|
||||
FWD+LEFT,inside=true)
|
||||
rounding_edge_mask(l=76, r1=8,r2=28);
|
||||
```
|
||||
|
||||
## Parent Anchor Attachment (Single Argument Attachment)
|
||||
|
||||
The second form of attachment is parent anchor attachment, which just
|
||||
@@ -1278,7 +1279,7 @@ cube(100, center=true)
|
||||
}
|
||||
```
|
||||
|
||||
Remember that tags are inherited by children. In this case, we need to explicitly
|
||||
Remember that tags applied with `tag()` are inherited by children. In this case, we need to explicitly
|
||||
untag the first cylinder (or change its tag to something else), or it
|
||||
will inherit the "keep" tag and get kept.
|
||||
|
||||
@@ -1292,6 +1293,16 @@ tag("keep")cube(100, center=true)
|
||||
}
|
||||
```
|
||||
|
||||
You can apply a tag that is not propagated to the children using
|
||||
`tag_this()`. The above example could then be redone:
|
||||
|
||||
diff("hole", "keep")
|
||||
tag_this("keep")cube(100, center=true)
|
||||
attach([RIGHT,TOP]) {
|
||||
cylinder(d=95, h=5);
|
||||
tag("hole") cylinder(d=50, h=11, anchor=CTR);
|
||||
}
|
||||
|
||||
|
||||
You can of course apply `tag()` to several children.
|
||||
|
||||
@@ -1361,7 +1372,8 @@ intersection is computed between the union of the `intersect` tagged objects and
|
||||
the objects that don't match any listed tags. Finally the objects listed in `keep` are union
|
||||
ed with the result.
|
||||
|
||||
In this example the parent is intersected with a conical bounding shape.
|
||||
In this example the parent (untagged) is intersected with a conical
|
||||
bounding shape, which is tagged with the intersect tag.
|
||||
|
||||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
@@ -1659,7 +1671,7 @@ arguments of `attachable()`.
|
||||
In the most basic form, where the shape is fully cuboid, with top and bottom of the same size,
|
||||
and directly over one another, you can just use `size=`.
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
module cubic_barbell(s=100, anchor=CENTER, spin=0, orient=UP) {
|
||||
attachable(anchor,spin,orient, size=[s*3,s,s]) {
|
||||
@@ -1677,7 +1689,7 @@ When the shape is prismoidal, where the top is a different size from the bottom,
|
||||
the `size2=` argument as well. While `size=` takes all three axes sizes, the `size2=` argument
|
||||
only takes the [X,Y] sizes of the top of the shape.
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
module prismoidal(size=[100,100,100], scale=0.5, anchor=CENTER, spin=0, orient=UP) {
|
||||
attachable(anchor,spin,orient, size=size, size2=[size.x, size.y]*scale) {
|
||||
@@ -1699,7 +1711,7 @@ When the top of the prismoid can be shifted away from directly above the bottom,
|
||||
the `shift=` argument. The `shift=` argument takes an [X,Y] vector of the offset of the center
|
||||
of the top from the XY center of the bottom of the shape.
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
module prismoidal(size=[100,100,100], scale=0.5, shift=[0,0], anchor=CENTER, spin=0, orient=UP) {
|
||||
attachable(anchor,spin,orient, size=size, size2=[size.x, size.y]*scale, shift=shift) {
|
||||
@@ -1721,7 +1733,7 @@ In the case that the prismoid is not oriented vertically, (ie, where the `shift=
|
||||
arguments should refer to a plane other than XY) you can use the `axis=` argument. This lets
|
||||
you make prismoids naturally oriented forwards/backwards or sideways.
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
module yprismoidal(
|
||||
size=[100,100,100], scale=0.5, shift=[0,0],
|
||||
@@ -1750,7 +1762,7 @@ yprismoidal([100,60,30], scale=1.5, shift=[20,20]) show_anchors(20);
|
||||
### Cylindrical Attachables
|
||||
To make a cylindrical shape attachable, you use the `l`, and `r`/`d`, args of `attachable()`.
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
module twistar(l,r,d, anchor=CENTER, spin=0, orient=UP) {
|
||||
r = get_radius(r=r,d=d,dflt=1);
|
||||
@@ -1799,7 +1811,7 @@ ytwistar(l=100, r=40) show_anchors(20);
|
||||
To make a conical shape attachable, you use the `l`, `r1`/`d1`, and `r2`/`d2`, args of
|
||||
`attachable()`.
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
module twistar(l, r,r1,r2, d,d1,d2, anchor=CENTER, spin=0, orient=UP) {
|
||||
r1 = get_radius(r1=r1,r=r,d1=d1,d=d,dflt=1);
|
||||
@@ -1816,7 +1828,7 @@ twistar(l=100, r1=40, r2=20) show_anchors(20);
|
||||
If the cone is ellipsoidal in shape, you can pass the unequal X/Y sizes as a 2-item vectors
|
||||
to the `r1=`/`r2=` or `d1=`/`d2=` arguments.
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
module ovalish(l,rx1,ry1,rx2,ry2, anchor=CENTER, spin=0, orient=UP) {
|
||||
attachable(anchor,spin,orient, r1=[rx1,ry1], r2=[rx2,ry2], l=l) {
|
||||
@@ -1837,7 +1849,7 @@ 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 to indicate the
|
||||
direction of the primary shape axis:
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
module ytwistar(l, r,r1,r2, d,d1,d2, anchor=CENTER, spin=0, orient=UP) {
|
||||
r1 = get_radius(r1=r1,r=r,d1=d1,d=d,dflt=1);
|
||||
@@ -1855,7 +1867,7 @@ ytwistar(l=100, r1=40, r2=20) show_anchors(20);
|
||||
### Spherical Attachables
|
||||
To make a spherical shape attachable, you use the `r`/`d` args of `attachable()`.
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include <BOSL2/std.scad>
|
||||
module spikeball(r, d, anchor=CENTER, spin=0, orient=UP) {
|
||||
r = get_radius(r=r,d=d,dflt=1);
|
||||
@@ -2059,7 +2071,7 @@ override the position. If you omit the other list items then the
|
||||
value drived from the standard anchor will be used. Below we override
|
||||
position of the FWD anchor:
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include<BOSL2/std.scad>
|
||||
module cubic_barbell(s=100, anchor=CENTER, spin=0, orient=UP) {
|
||||
override = [
|
||||
@@ -2080,7 +2092,7 @@ Note how the FWD anchor is now rooted on the cylindrical portion. If
|
||||
you wanted to also change its direction and spin you could do it like
|
||||
this:
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include<BOSL2/std.scad>
|
||||
module cubic_barbell(s=100, anchor=CENTER, spin=0, orient=UP) {
|
||||
override = [
|
||||
@@ -2105,7 +2117,7 @@ position of the red flag on the arrow. If you want to override all of
|
||||
the x=0 anchors to be on the cylinder, with their standard directions,
|
||||
you can do that by supplying a list:
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include<BOSL2/std.scad>
|
||||
module cubic_barbell(s=100, anchor=CENTER, spin=0, orient=UP) {
|
||||
override = [
|
||||
@@ -2130,7 +2142,7 @@ the default, or a `[position, direction, spin]` triple to override the
|
||||
default. As before, you can omit values to keep their default.
|
||||
Here is the same example using a function literal for the override:
|
||||
|
||||
```openscad-3D
|
||||
```openscad-3D;Big
|
||||
include<BOSL2/std.scad>
|
||||
module cubic_barbell(s=100, anchor=CENTER, spin=0, orient=UP) {
|
||||
override = function (anchor)
|
||||
|
Reference in New Issue
Block a user