mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Fixes for rect(center=)
This commit is contained in:
parent
aa109de9d7
commit
f9c5dc2cb9
7 changed files with 24 additions and 18 deletions
7
.github/workflows/main.yml
vendored
7
.github/workflows/main.yml
vendored
|
@ -62,3 +62,10 @@ jobs:
|
||||||
export OPENSCADPATH=$(dirname $GITHUB_WORKSPACE)
|
export OPENSCADPATH=$(dirname $GITHUB_WORKSPACE)
|
||||||
openscad-docsgen -Tmf *.scad
|
openscad-docsgen -Tmf *.scad
|
||||||
|
|
||||||
|
- name: Checking Tutorials
|
||||||
|
run: |
|
||||||
|
cd $GITHUB_WORKSPACE
|
||||||
|
echo "::add-matcher::.github/openscad_docsgen.json"
|
||||||
|
export OPENSCADPATH=$(dirname $GITHUB_WORKSPACE)
|
||||||
|
openscad-mdimggen -T *.scad
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ _ANCHOR_TYPES = ["intersect","hull"];
|
||||||
// all based on combinations of unit direction vectors. You can use these for anchoring and orienting
|
// all based on combinations of unit direction vectors. You can use these for anchoring and orienting
|
||||||
// attachable objects. You can also them to specify edge sets for rounding or chamfering cuboids,
|
// attachable objects. You can also them to specify edge sets for rounding or chamfering cuboids,
|
||||||
// or for placing edge, face and corner masks.
|
// or for placing edge, face and corner masks.
|
||||||
// SubSection: Anchor
|
// Subsection: Anchor
|
||||||
// Anchoring is specified with the `anchor` argument in most shape modules. Specifying `anchor`
|
// Anchoring is specified with the `anchor` argument in most shape modules. Specifying `anchor`
|
||||||
// when creating an object will translate the object so that the anchor point is at the origin
|
// when creating an object will translate the object so that the anchor point is at the origin
|
||||||
// (0,0,0). Anchoring always occurs before spin and orientation are applied.
|
// (0,0,0). Anchoring always occurs before spin and orientation are applied.
|
||||||
|
@ -79,20 +79,20 @@ _ANCHOR_TYPES = ["intersect","hull"];
|
||||||
// motors have anchors for `"screw1"`, `"screw2"`, etc. to refer to the various screwholes on the
|
// motors have anchors for `"screw1"`, `"screw2"`, etc. to refer to the various screwholes on the
|
||||||
// stepper motor shape. The names, positions, directions, and spins of these anchors are
|
// stepper motor shape. The names, positions, directions, and spins of these anchors are
|
||||||
// specific to the object, and are documented when they exist.
|
// specific to the object, and are documented when they exist.
|
||||||
// SubSection: Spin
|
// Subsection: Spin
|
||||||
// Spin is specified with the `spin` argument in most shape modules. Specifying a scalar `spin`
|
// Spin is specified with the `spin` argument in most shape modules. Specifying a scalar `spin`
|
||||||
// when creating an object will rotate the object counter-clockwise around the Z axis by the given
|
// when creating an object will rotate the object counter-clockwise around the Z axis by the given
|
||||||
// number of degrees. If given as a 3D vector, the object will be rotated around each of the X, Y, Z
|
// number of degrees. If given as a 3D vector, the object will be rotated around each of the X, Y, Z
|
||||||
// axes by the number of degrees in each component of the vector. Spin is always applied after
|
// axes by the number of degrees in each component of the vector. Spin is always applied after
|
||||||
// anchoring, and before orientation. Since spin is applied after anchoring it is not what
|
// anchoring, and before orientation. Since spin is applied after anchoring it is not what
|
||||||
// you might think of intuitively as spinning the shape. To do that, apply `zrot()` to the shape before anchoring.
|
// you might think of intuitively as spinning the shape. To do that, apply `zrot()` to the shape before anchoring.
|
||||||
// SubSection: Orient
|
// Subsection: Orient
|
||||||
// Orientation is specified with the `orient` argument in most shape modules. Specifying `orient`
|
// Orientation is specified with the `orient` argument in most shape modules. Specifying `orient`
|
||||||
// when creating an object will rotate the object such that the top of the object will be pointed
|
// when creating an object will rotate the object such that the top of the object will be pointed
|
||||||
// at the vector direction given in the `orient` argument. Orientation is always applied after
|
// at the vector direction given in the `orient` argument. Orientation is always applied after
|
||||||
// anchoring and spin. The constants `UP`, `DOWN`, `FRONT`, `BACK`, `LEFT`, and `RIGHT` can be
|
// anchoring and spin. The constants `UP`, `DOWN`, `FRONT`, `BACK`, `LEFT`, and `RIGHT` can be
|
||||||
// added together to form the directional vector for this. ie: `LEFT+BACK`
|
// added together to form the directional vector for this. ie: `LEFT+BACK`
|
||||||
// SubSection: Specifying Directions
|
// Subsection: Specifying Directions
|
||||||
// You can use direction vectors to specify anchors for objects or to specify edges, faces, and
|
// You can use direction vectors to specify anchors for objects or to specify edges, faces, and
|
||||||
// corners of cubes. You can simply specify these direction vectors numerically, but another
|
// corners of cubes. You can simply specify these direction vectors numerically, but another
|
||||||
// option is to use named constants for direction vectors. These constants define unit vectors
|
// option is to use named constants for direction vectors. These constants define unit vectors
|
||||||
|
@ -125,7 +125,7 @@ _ANCHOR_TYPES = ["intersect","hull"];
|
||||||
// up(.12)move(TOP)atext("TOP",size=.1,h=.01,anchor=RIGHT,orient=FRONT);
|
// up(.12)move(TOP)atext("TOP",size=.1,h=.01,anchor=RIGHT,orient=FRONT);
|
||||||
// move(TOP)atext("UP",size=.1,h=.01,anchor=RIGHT,orient=FRONT);
|
// move(TOP)atext("UP",size=.1,h=.01,anchor=RIGHT,orient=FRONT);
|
||||||
// }
|
// }
|
||||||
// SubSection: Specifying Faces
|
// Subsection: Specifying Faces
|
||||||
// Modules operating on faces accept a list of faces to describe the faces to operate on. Each
|
// Modules operating on faces accept a list of faces to describe the faces to operate on. Each
|
||||||
// face is given by a vector that points to that face. Attachments of cuboid objects onto their faces also
|
// face is given by a vector that points to that face. Attachments of cuboid objects onto their faces also
|
||||||
// work by choosing an attachment face with a single vector in the same manner.
|
// work by choosing an attachment face with a single vector in the same manner.
|
||||||
|
@ -142,7 +142,7 @@ _ANCHOR_TYPES = ["intersect","hull"];
|
||||||
// _show_cube_faces([LEFT],toplabel=["LEFT"]);
|
// _show_cube_faces([LEFT],toplabel=["LEFT"]);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// SubSection: Specifying Edges
|
// Subsection: Specifying Edges
|
||||||
// Modules operating on edges use two arguments to describe the edge set they will use: The `edges` argument
|
// Modules operating on edges use two arguments to describe the edge set they will use: The `edges` argument
|
||||||
// is a list of edge set descriptors to include in the edge set, and the `except` argument is a list of
|
// is a list of edge set descriptors to include in the edge set, and the `except` argument is a list of
|
||||||
// edge set descriptors to remove from the edge set.
|
// edge set descriptors to remove from the edge set.
|
||||||
|
@ -253,7 +253,7 @@ _ANCHOR_TYPES = ["intersect","hull"];
|
||||||
// _show_edges(_edges([1,-1,1]),toplabel=["edges=[1,-1,1]"]);
|
// _show_edges(_edges([1,-1,1]),toplabel=["edges=[1,-1,1]"]);
|
||||||
// _show_edges(_edges([TOP,BOT], TOP+RIGHT+FRONT),toplabel=["edges=[TOP,BOT]","except=TOP+RIGHT+FRONT"]);
|
// _show_edges(_edges([TOP,BOT], TOP+RIGHT+FRONT),toplabel=["edges=[TOP,BOT]","except=TOP+RIGHT+FRONT"]);
|
||||||
// }
|
// }
|
||||||
// SubSection: Specifying Corners
|
// Subsection: Specifying Corners
|
||||||
// Modules operating on corners use two arguments to describe the corner set they will use: The `corners` argument
|
// Modules operating on corners use two arguments to describe the corner set they will use: The `corners` argument
|
||||||
// is a list of corner set descriptors to include in the corner set, and the `except` argument is a list of
|
// is a list of corner set descriptors to include in the corner set, and the `except` argument is a list of
|
||||||
// corner set descriptors to remove from the corner set.
|
// corner set descriptors to remove from the corner set.
|
||||||
|
|
|
@ -989,8 +989,8 @@ module trace_bezier(bez, width=1, N=3) {
|
||||||
color("red") move_copies(bez)
|
color("red") move_copies(bez)
|
||||||
if ($idx % N !=0)
|
if ($idx % N !=0)
|
||||||
if (twodim){
|
if (twodim){
|
||||||
rect([width/2, width*3],center=true);
|
rect([width/2, width*3]);
|
||||||
rect([width*3, width/2],center=true);
|
rect([width*3, width/2]);
|
||||||
} else {
|
} else {
|
||||||
zcyl(d=width/2, h=width*3);
|
zcyl(d=width/2, h=width*3);
|
||||||
xcyl(d=width/2, h=width*3);
|
xcyl(d=width/2, h=width*3);
|
||||||
|
|
|
@ -640,7 +640,7 @@ module cylindrical_extrude(or, ir, od, id, size=1000, convexity=10, spin=0, orie
|
||||||
yflip()
|
yflip()
|
||||||
intersection() {
|
intersection() {
|
||||||
left(x) children();
|
left(x) children();
|
||||||
rect([quantup(step,pow(2,-15)),size.y],center=true);
|
rect([quantup(step,pow(2,-15)),size.y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1240,7 +1240,6 @@ module _rod(spec, length, tolerance, orient=UP, spin=0, anchor=CENTER)
|
||||||
{
|
{
|
||||||
threadspec = thread_specification(spec, internal=false, tolerance=tolerance);
|
threadspec = thread_specification(spec, internal=false, tolerance=tolerance);
|
||||||
echo(d_major_mean = mean(struct_val(threadspec, "d_major")));
|
echo(d_major_mean = mean(struct_val(threadspec, "d_major")));
|
||||||
echo(bolt_profile=_thread_profile(threadspec));
|
|
||||||
|
|
||||||
threaded_rod([mean(struct_val(threadspec, "d_minor")),
|
threaded_rod([mean(struct_val(threadspec, "d_minor")),
|
||||||
mean(struct_val(threadspec, "d_pitch")),
|
mean(struct_val(threadspec, "d_pitch")),
|
||||||
|
|
|
@ -112,7 +112,7 @@ module rect(size=1, rounding=0, chamfer=0, anchor=CENTER, spin=0) {
|
||||||
children();
|
children();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pts = rect(size=size, rounding=rounding, chamfer=chamfer, center=true);
|
pts = rect(size=size, rounding=rounding, chamfer=chamfer);
|
||||||
attachable(anchor, spin, two_d=true, path=pts) {
|
attachable(anchor, spin, two_d=true, path=pts) {
|
||||||
polygon(pts);
|
polygon(pts);
|
||||||
children();
|
children();
|
||||||
|
|
10
vnf.scad
10
vnf.scad
|
@ -1070,8 +1070,8 @@ function _triangulate_planar_convex_polygons(polys) =
|
||||||
// bent2 = vnf_bend(vnf2, axis="Y");
|
// bent2 = vnf_bend(vnf2, axis="Y");
|
||||||
// vnf_polyhedron([bent1,bent2]);
|
// vnf_polyhedron([bent1,bent2]);
|
||||||
// Example(3D):
|
// Example(3D):
|
||||||
// rgn = union(rect([100,20],center=true),
|
// rgn = union(rect([100,20]),
|
||||||
// rect([20,100],center=true));
|
// rect([20,100]));
|
||||||
// vnf0 = linear_sweep(zrot(45,p=rgn), height=10);
|
// vnf0 = linear_sweep(zrot(45,p=rgn), height=10);
|
||||||
// vnf1 = up(50, p=vnf0);
|
// vnf1 = up(50, p=vnf0);
|
||||||
// vnf2 = down(50, p=vnf0);
|
// vnf2 = down(50, p=vnf0);
|
||||||
|
@ -1080,7 +1080,7 @@ function _triangulate_planar_convex_polygons(polys) =
|
||||||
// vnf_polyhedron([bent1,bent2]);
|
// vnf_polyhedron([bent1,bent2]);
|
||||||
// Example(3D): Bending Around X Axis.
|
// Example(3D): Bending Around X Axis.
|
||||||
// rgnr = union(
|
// rgnr = union(
|
||||||
// rect([20,100],center=true),
|
// rect([20,100]),
|
||||||
// back(50, p=trapezoid(w1=40, w2=0, h=20, anchor=FRONT))
|
// back(50, p=trapezoid(w1=40, w2=0, h=20, anchor=FRONT))
|
||||||
// );
|
// );
|
||||||
// vnf0 = xrot(00,p=linear_sweep(rgnr, height=10));
|
// vnf0 = xrot(00,p=linear_sweep(rgnr, height=10));
|
||||||
|
@ -1090,7 +1090,7 @@ function _triangulate_planar_convex_polygons(polys) =
|
||||||
// vnf_polyhedron([bent1]);
|
// vnf_polyhedron([bent1]);
|
||||||
// Example(3D): Bending Around Y Axis.
|
// Example(3D): Bending Around Y Axis.
|
||||||
// rgn = union(
|
// rgn = union(
|
||||||
// rect([20,100],center=true),
|
// rect([20,100]),
|
||||||
// back(50, p=trapezoid(w1=40, w2=0, h=20, anchor=FRONT))
|
// back(50, p=trapezoid(w1=40, w2=0, h=20, anchor=FRONT))
|
||||||
// );
|
// );
|
||||||
// rgnr = zrot(-90, p=rgn);
|
// rgnr = zrot(-90, p=rgn);
|
||||||
|
@ -1101,7 +1101,7 @@ function _triangulate_planar_convex_polygons(polys) =
|
||||||
// vnf_polyhedron([bent1]);
|
// vnf_polyhedron([bent1]);
|
||||||
// Example(3D): Bending Around Z Axis.
|
// Example(3D): Bending Around Z Axis.
|
||||||
// rgn = union(
|
// rgn = union(
|
||||||
// rect([20,100],center=true),
|
// rect([20,100]),
|
||||||
// back(50, p=trapezoid(w1=40, w2=0, h=20, anchor=FRONT))
|
// back(50, p=trapezoid(w1=40, w2=0, h=20, anchor=FRONT))
|
||||||
// );
|
// );
|
||||||
// rgnr = zrot(90, p=rgn);
|
// rgnr = zrot(90, p=rgn);
|
||||||
|
|
Loading…
Reference in a new issue