mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-28 15:59:45 +00:00
doc fixes
This commit is contained in:
parent
8bd08bd4c1
commit
554d197976
9 changed files with 44 additions and 47 deletions
|
@ -1196,8 +1196,8 @@ module tag_conv_hull(tag,keep="keep")
|
|||
// Example: Hides part of the model.
|
||||
// hide("A")
|
||||
// tag("main") cube(50, anchor=CENTER, $tag="Main") {
|
||||
// tag("A")attach(LEFT, BOTTOM) cylinder(d=30, l=30);
|
||||
// tag("B")attach(RIGHT, BOTTOM) cylinder(d=30, l=30);
|
||||
// tag("A")attach(LEFT, BOTTOM) cylinder(d=30, h=30);
|
||||
// tag("B")attach(RIGHT, BOTTOM) cylinder(d=30, h=30);
|
||||
// }
|
||||
// Example: Use an invisible parent to position children. Note that children must be retagged because they inherit the parent tag.
|
||||
// $fn=16;
|
||||
|
@ -1231,8 +1231,8 @@ module hide(tags)
|
|||
// show_only("visible")
|
||||
// cube(50, anchor=CENTER)
|
||||
// tag("visible"){
|
||||
// attach(LEFT, BOTTOM) cylinder(d=30, l=30);
|
||||
// attach(RIGHT, BOTTOM) cylinder(d=30, l=30);
|
||||
// attach(LEFT, BOTTOM) cylinder(d=30, h=30);
|
||||
// attach(RIGHT, BOTTOM) cylinder(d=30, h=30);
|
||||
// }
|
||||
module show_only(tags)
|
||||
{
|
||||
|
|
|
@ -1127,7 +1127,7 @@ module sp_neck(diam,type,wall,id,style="L",bead=false, anchor, spin, orient)
|
|||
difference(){
|
||||
union(){
|
||||
thread_helix(d=T-.01, profile=profile, pitch = INCH/tpi, turns=twist/360, taper=taperlen, anchor=TOP);
|
||||
cylinder(d=T-depth*2,l=H,anchor=TOP);
|
||||
cylinder(d=T-depth*2,h=H,anchor=TOP);
|
||||
if (bead)
|
||||
down(bead_shift)
|
||||
rotate_extrude()
|
||||
|
|
|
@ -266,7 +266,7 @@ module rounding_corner_mask(r, d, style="octa", excess=0.1, anchor=CENTER, spin=
|
|||
translate(-excess*[1,1,1])
|
||||
cube(size=r+excess, center=false);
|
||||
translate([r,r,r])
|
||||
sphere(r=r, style=style);
|
||||
spheroid(r=r, style=style);
|
||||
}
|
||||
children();
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ _hose_waist = [1.7698, 1.8251, 3.95998];
|
|||
// right(25)modular_hose(1/2,"segment");
|
||||
// right(60)modular_hose(3/4,"segment");
|
||||
// Example: A mount point for modular hose
|
||||
// cylinder(l=10, r=20)
|
||||
// cylinder(h=10, r=20)
|
||||
// attach(TOP) modular_hose(1/2, "ball", waist_len=15);
|
||||
// Example: Mounting plate for something at the end of the hose
|
||||
// cuboid([50,50,5])
|
||||
|
|
|
@ -2924,7 +2924,7 @@ Access to the derivative smoothing parameter?
|
|||
// ellipse = ellipse([17,10],$fn=164);
|
||||
// join_prism(ellipse,base="sphere",base_r=30, length=18,
|
||||
// fillet=18, n=25, overlap=1);
|
||||
// sphere(r=30,circum=true, $fn=96);
|
||||
// spheroid(r=30,circum=true, $fn=96);
|
||||
// Example(3D,NoScales): This example shows a failed rounding attempt where the result is self-intersecting. Using the `debug=true` option makes it possible to view the result to understand what went wrong. Note that the concave corners have a crease where the fillet crosses itself. The error message will advise you to decrease the size of the fillet. You can also fix the problem by making your concave curves shallower.
|
||||
// flower = [for(theta=lerpn(0,360,180,endpoint=false))
|
||||
// (15+2.5*sin(6*theta))*[cos(theta),sin(theta)]];
|
||||
|
@ -2934,19 +2934,19 @@ Access to the derivative smoothing parameter?
|
|||
// sq = rect(15);
|
||||
// join_prism(sq, base="sphere", base_r=25,
|
||||
// length=18, fillet=4, n=12);
|
||||
// sphere(r=25, circum=true, $fn=96);
|
||||
// spheroid(r=25, circum=true, $fn=96);
|
||||
// Example(3D,NoScales): To fix the problem, you must subdivide the polygon that defines the prism. But note that the join_prism method works poorly at sharp corners.
|
||||
// sq = subdivide_path(rect(15),n=64);
|
||||
// join_prism(sq, base="sphere", base_r=25,
|
||||
// length=18, fillet=4, n=12);
|
||||
// sphere(r=25, circum=true,$fn=96);
|
||||
// spheroid(r=25, circum=true,$fn=96);
|
||||
// Example(3D,NoScales): In the previous example, a small rounding of the prism corners produces a nicer result.
|
||||
// sq = subdivide_path(
|
||||
// round_corners(rect(15),cut=.5,$fn=32),
|
||||
// n=128);
|
||||
// join_prism(sq, base="sphere", base_r=25,
|
||||
// length=18, fillet=4, n=12);
|
||||
// sphere(r=25, circum=true,$fn=96);
|
||||
// spheroid(r=25, circum=true,$fn=96);
|
||||
// Example(3D,NoScales): The final option for specifying the base is to use an arbitrary prism, specified by a polygon. Note that the base prism is oriented to the RIGHT, so the attached prism remains Z oriented.
|
||||
// ellipse = ellipse([17,10],$fn=164);
|
||||
// join_prism(zrot(90,ellipse), base=2*ellipse, length=19,
|
||||
|
@ -3032,7 +3032,7 @@ Access to the derivative smoothing parameter?
|
|||
// base_T = xrot(5)*yrot(-12);
|
||||
// join_prism(flower,base="cylinder",base_r=25, fillet=4, n=12,
|
||||
// aux="sphere",aux_r=35,base_T=base_T, aux_T=aux_T);
|
||||
// multmatrix(aux_T)sphere(35,circum=true);
|
||||
// multmatrix(aux_T)spheroid(35,circum=true);
|
||||
// multmatrix(base_T)xcyl(l=75,r=25,circum=true);
|
||||
// Example(3D,NoScales,VPR=[84,0,21],VPT=[13.6,-1,46.8],VPD=446): Here we translate the sphere to the right and the prism goes with it
|
||||
// flower = [for(theta=lerpn(0,360,180,endpoint=false))
|
||||
|
@ -3040,7 +3040,7 @@ Access to the derivative smoothing parameter?
|
|||
// aux_T = right(40)*up(85);
|
||||
// join_prism(flower,base="cylinder",base_r=25, n=12,
|
||||
// aux="sphere",aux_r=35, aux_T=aux_T, fillet=4);
|
||||
// multmatrix(aux_T)sphere(35,circum=true);
|
||||
// multmatrix(aux_T)spheroid(35,circum=true);
|
||||
// xcyl(l=75,r=25,circum=true);
|
||||
// Example(3D,NoScales,VPR=[84,0,21],VPT=[13.6,-1,46.8],VPD=446): This is the previous example with the prism_end_T transformation used to shift the far end of the prism away from the sphere center. Note that prism_end_T can be any transformation, but it just acts on the location of the prism endpoint to shift the direction the prism points.
|
||||
// flower = [for(theta=lerpn(0,360,180,endpoint=false))
|
||||
|
@ -3049,7 +3049,7 @@ Access to the derivative smoothing parameter?
|
|||
// join_prism(flower,base="cylinder",base_r=25,
|
||||
// prism_end_T=left(4), fillet=3, n=12,
|
||||
// aux="sphere",aux_r=35, aux_T=aux_T);
|
||||
// multmatrix(aux_T)sphere(35,circum=true);
|
||||
// multmatrix(aux_T)spheroid(35,circum=true);
|
||||
// xcyl(l=75,r=25,circum=true);
|
||||
// Example(3D,NoScales,VPR=[96.9,0,157.5],VPT=[-7.77616,-2.272,37.9424],VPD=366.527): Here the base is a cylinder but the auxilary object is a generic prism, and the joiner prism has a scale factor.
|
||||
// flower = [for(theta=lerpn(0,360,180,endpoint=false))
|
||||
|
|
|
@ -2007,9 +2007,6 @@ function pie_slice(
|
|||
// sphere(d=100, anchor=FRONT, spin=45, orient=FWD);
|
||||
// Example: Standard Connectors
|
||||
// sphere(d=50) show_anchors();
|
||||
// Example: Called as Function
|
||||
// vnf = sphere(d=100, style="icosa");
|
||||
// vnf_polyhedron(vnf);
|
||||
|
||||
module sphere(r, d, anchor=CENTER, spin=0, orient=UP) {
|
||||
r = get_radius(r=r, d=d, dflt=1);
|
||||
|
@ -2964,7 +2961,7 @@ function _cut_interp(pathcut, path, data) =
|
|||
// Example(3D,NoScales): The kern parameter lets you adjust the letter spacing either with a uniform value for each letter, or with an array to make adjustments throughout the text. Here we show a case where adding some extra space gives a better look in a tight circle. When textmetrics are off, `lettersize` can do this job, but with textmetrics, you'll need to use `kern` to make adjustments relative to the text metric sizes.
|
||||
// path = path3d(arc(100, r=12, angle=[150, 450]));
|
||||
// color("red")stroke(path, width=.3);
|
||||
// kern = [1,1.2,1,1,.3,-.2,1,0,.8,1,1.1,1];
|
||||
// kern = [1,1.2,1,1,.3,-.2,1,0,.8,1,1.1];
|
||||
// path_text(path, "Example text", font="Courier", size=5, lettersize = 5/1.2, kern=kern, normal=UP);
|
||||
|
||||
module path_text(path, text, font, size, thickness, lettersize, offset=0, reverse=false, normal, top, center=false, textmetrics=false, kern=0, height,h, valign="baseline")
|
||||
|
|
|
@ -1609,8 +1609,8 @@ module spiral_sweep(poly, h, r, turns=1, taper, center, r1, r2, d, d1, d2, taper
|
|||
// curve = [for(theta=[0:4:359])
|
||||
// [r*cos(theta), r*sin(theta), 10+sin(6*theta)]];
|
||||
// difference(){
|
||||
// cylinder(r=r, l=len);
|
||||
// down(.5)cylinder(r=r-thickness, l=len+1);
|
||||
// cylinder(r=r, h=len);
|
||||
// down(.5)cylinder(r=r-thickness, h=len+1);
|
||||
// path_sweep(left(.05,square([1.1,1])), curve, closed=true,
|
||||
// method="manual", normal=UP);
|
||||
// }
|
||||
|
|
|
@ -686,7 +686,7 @@ module npt_threaded_rod(
|
|||
internal=internal,
|
||||
higbee=true
|
||||
);
|
||||
if (hollow) cylinder(l=l+1, d=size*INCH, center=true);
|
||||
if (hollow) cylinder(h=l+1, d=size*INCH, center=true);
|
||||
}
|
||||
children();
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ but the cylinder's bottom is placed at the center of the cube.
|
|||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50)
|
||||
cylinder(d=25,l=75);
|
||||
cylinder(d=25,h=75);
|
||||
```
|
||||
|
||||
If you explicitly anchor the child object then the anchor you choose will be aligned
|
||||
|
@ -331,7 +331,7 @@ side of the cylinder is aligned with the center of the cube.
|
|||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50,anchor=FRONT)
|
||||
cylinder(d=25,l=95,anchor=RIGHT);
|
||||
cylinder(d=25,h=95,anchor=RIGHT);
|
||||
```
|
||||
|
||||
The `position()` module enables you to specify where on the parent to
|
||||
|
@ -343,7 +343,7 @@ RIGHT anchor of the cube.
|
|||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50,anchor=FRONT)
|
||||
position(RIGHT) cylinder(d=25,l=75,anchor=LEFT);
|
||||
position(RIGHT) cylinder(d=25,h=75,anchor=LEFT);
|
||||
```
|
||||
|
||||
Using this mechanism you can position objects relative to other
|
||||
|
@ -355,7 +355,7 @@ include <BOSL2/std.scad>
|
|||
cube([50,50,30],center=true)
|
||||
position(TOP+RIGHT) cube([25,40,10], anchor=RIGHT+BOT)
|
||||
position(LEFT+FRONT+TOP) cube([12,12,8], anchor=LEFT+FRONT+BOT)
|
||||
cylinder(l=10,r=3);
|
||||
cylinder(h=10,r=3);
|
||||
```
|
||||
|
||||
The positioning mechanism is not magical: it simply applies a
|
||||
|
@ -483,14 +483,14 @@ point on the sphere.
|
|||
```openscad-3D
|
||||
include<BOSL2/std.scad>
|
||||
sphere(40)
|
||||
position(RIGHT+TOP) cylinder(r=8,l=20);
|
||||
position(RIGHT+TOP) cylinder(r=8,h=20);
|
||||
```
|
||||
|
||||
|
||||
```openscad-3D
|
||||
include<BOSL2/std.scad>
|
||||
sphere(40)
|
||||
attach(RIGHT+TOP) cylinder(r=8,l=20);
|
||||
attach(RIGHT+TOP) cylinder(r=8,h=20);
|
||||
```
|
||||
|
||||
In the example above, the cylinder's center point is attached to the
|
||||
|
@ -593,7 +593,7 @@ think that it moves the object first, and then it gets attached.
|
|||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50,center=true)
|
||||
attach(RIGHT)cylinder(d1=30,d2=15,l=25,anchor=FRONT);
|
||||
attach(RIGHT)cylinder(d1=30,d2=15,h=25,anchor=FRONT);
|
||||
```
|
||||
|
||||
In the above example we anchor the child to its FRONT and then attach
|
||||
|
@ -624,14 +624,14 @@ when doing differences.
|
|||
include <BOSL2/std.scad>
|
||||
cube(50,center=true)
|
||||
attach(TOP,overlap=10)
|
||||
cylinder(d=20,l=20);
|
||||
cylinder(d=20,h=20);
|
||||
```
|
||||
|
||||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50,center=true)
|
||||
attach(TOP,overlap=-20)
|
||||
cylinder(d=20,l=20);
|
||||
cylinder(d=20,h=20);
|
||||
```
|
||||
|
||||
As with `position()`, you can still apply your own translations and
|
||||
|
@ -645,7 +645,7 @@ include <BOSL2/std.scad>
|
|||
cube(50,center=true)
|
||||
up(13)
|
||||
attach(RIGHT)
|
||||
cylinder(d1=30,d2=15,l=25);
|
||||
cylinder(d1=30,d2=15,h=25);
|
||||
```
|
||||
|
||||
On the other hand, if you put the translation between the attach and
|
||||
|
@ -657,7 +657,7 @@ include <BOSL2/std.scad>
|
|||
cube(50,center=true)
|
||||
attach(RIGHT)
|
||||
up(13)
|
||||
cylinder(d1=30,d2=15,l=25);
|
||||
cylinder(d1=30,d2=15,h=25);
|
||||
```
|
||||
|
||||
|
||||
|
@ -676,25 +676,25 @@ attaching with those anchors.
|
|||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50,anchor=BOT) attach(TOP) anchor_arrow(30);
|
||||
right(60)cylinder(d1=30,d2=15,l=25) attach(TOP) anchor_arrow(30);
|
||||
right(60)cylinder(d1=30,d2=15,h=25) attach(TOP) anchor_arrow(30);
|
||||
```
|
||||
|
||||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50,anchor=BOT)
|
||||
attach(TOP,TOP) cylinder(d1=30,d2=15,l=25);
|
||||
attach(TOP,TOP) cylinder(d1=30,d2=15,h=25);
|
||||
```
|
||||
|
||||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50,center=true) attach(RIGHT) anchor_arrow(30);
|
||||
right(80)cylinder(d1=30,d2=15,l=25) attach(LEFT) anchor_arrow(30);
|
||||
right(80)cylinder(d1=30,d2=15,h=25) attach(LEFT) anchor_arrow(30);
|
||||
```
|
||||
|
||||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50,center=true)
|
||||
attach(RIGHT,LEFT) cylinder(d1=30,d2=15,l=25);
|
||||
attach(RIGHT,LEFT) cylinder(d1=30,d2=15,h=25);
|
||||
```
|
||||
|
||||
Note that when you attach with two anchors like this, the attachment
|
||||
|
@ -710,15 +710,15 @@ hidden in the middle of the objects.
|
|||
|
||||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cylinder(d1=30,d2=15,l=25) attach(CENTER) anchor_arrow(40);
|
||||
right(40)cylinder(d1=30,d2=15,l=25) attach(CENTER) anchor_arrow(40);
|
||||
cylinder(d1=30,d2=15,h=25) attach(CENTER) anchor_arrow(40);
|
||||
right(40)cylinder(d1=30,d2=15,h=25) attach(CENTER) anchor_arrow(40);
|
||||
```
|
||||
|
||||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cylinder(d1=30,d2=15,l=25)
|
||||
cylinder(d1=30,d2=15,h=25)
|
||||
attach(CENTER,CENTER)
|
||||
cylinder(d1=30,d2=15,l=25);
|
||||
cylinder(d1=30,d2=15,h=25);
|
||||
```
|
||||
|
||||
|
||||
|
@ -729,8 +729,8 @@ You can attach or position more than one child at a time by enclosing them all i
|
|||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50, center=true) {
|
||||
attach(TOP) cylinder(d1=50,d2=20,l=20);
|
||||
position(RIGHT) cylinder(d1=50,d2=20,l=20);
|
||||
attach(TOP) cylinder(d1=50,d2=20,h=20);
|
||||
position(RIGHT) cylinder(d1=50,d2=20,h=20);
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -740,13 +740,13 @@ desired anchors as a list to the `attach()` or `position()` modules:
|
|||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50, center=true)
|
||||
attach([RIGHT,FRONT],TOP) cylinder(d1=35,d2=20,l=25);
|
||||
attach([RIGHT,FRONT],TOP) cylinder(d1=35,d2=20,h=25);
|
||||
```
|
||||
|
||||
```openscad-3D
|
||||
include <BOSL2/std.scad>
|
||||
cube(50, center=true)
|
||||
position([TOP,RIGHT,FRONT]) cylinder(d1=35,d2=20,l=25);
|
||||
position([TOP,RIGHT,FRONT]) cylinder(d1=35,d2=20,h=25);
|
||||
```
|
||||
|
||||
|
||||
|
@ -987,7 +987,7 @@ module round_corner(r) difference() {
|
|||
translate(-[1,1,1])
|
||||
cube(r+1);
|
||||
translate([r,r,r])
|
||||
sphere(r=r, style="aligned", $fn=quantup(segs(r),4));
|
||||
spheroid(r=r, style="aligned", $fn=quantup(segs(r),4));
|
||||
}
|
||||
round_corner(r=10);
|
||||
```
|
||||
|
@ -1000,7 +1000,7 @@ module round_corner(r) difference() {
|
|||
translate(-[1,1,1])
|
||||
cube(r+1);
|
||||
translate([r,r,r])
|
||||
sphere(r=r, style="aligned", $fn=quantup(segs(r),4));
|
||||
spheroid(r=r, style="aligned", $fn=quantup(segs(r),4));
|
||||
}
|
||||
diff()
|
||||
cube([50,60,70],center=true)
|
||||
|
@ -1017,7 +1017,7 @@ module round_corner(r) difference() {
|
|||
translate(-[1,1,1])
|
||||
cube(r+1);
|
||||
translate([r,r,r])
|
||||
sphere(r=r, style="aligned", $fn=quantup(segs(r),4));
|
||||
spheroid(r=r, style="aligned", $fn=quantup(segs(r),4));
|
||||
}
|
||||
module round_edge(l,r) difference() {
|
||||
translate([-1,-1,-l/2])
|
||||
|
|
Loading…
Reference in a new issue