Fixes for rect(center=)

This commit is contained in:
Revar Desmera 2021-12-13 16:31:14 -08:00
parent aa109de9d7
commit f9c5dc2cb9
7 changed files with 24 additions and 18 deletions

View file

@ -62,3 +62,10 @@ jobs:
export OPENSCADPATH=$(dirname $GITHUB_WORKSPACE)
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

View file

@ -50,7 +50,7 @@ _ANCHOR_TYPES = ["intersect","hull"];
// 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,
// 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`
// 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.
@ -79,20 +79,20 @@ _ANCHOR_TYPES = ["intersect","hull"];
// 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
// 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`
// 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
// 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
// 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`
// 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
// 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`
// SubSection: Specifying Directions
// Subsection: Specifying Directions
// 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
// 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);
// 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
// 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.
@ -142,7 +142,7 @@ _ANCHOR_TYPES = ["intersect","hull"];
// _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
// 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.
@ -253,7 +253,7 @@ _ANCHOR_TYPES = ["intersect","hull"];
// _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"]);
// }
// SubSection: Specifying Corners
// Subsection: Specifying Corners
// 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
// corner set descriptors to remove from the corner set.

View file

@ -989,8 +989,8 @@ module trace_bezier(bez, width=1, N=3) {
color("red") move_copies(bez)
if ($idx % N !=0)
if (twodim){
rect([width/2, width*3],center=true);
rect([width*3, width/2],center=true);
rect([width/2, width*3]);
rect([width*3, width/2]);
} else {
zcyl(d=width/2, h=width*3);
xcyl(d=width/2, h=width*3);

View file

@ -640,7 +640,7 @@ module cylindrical_extrude(or, ir, od, id, size=1000, convexity=10, spin=0, orie
yflip()
intersection() {
left(x) children();
rect([quantup(step,pow(2,-15)),size.y],center=true);
rect([quantup(step,pow(2,-15)),size.y]);
}
}
}

View file

@ -785,7 +785,7 @@ module screw_head(screw_info,details=false) {
intersection(){
arc(points=[[-head_size2/2,0], [0,-base+head_height * (head=="button"?4/3:1)], [head_size2/2,0]]);
square([head_size2, head_height-base]);
}
}
}
if (head=="pan flat")
cyl(l=head_height, d=head_size, rounding2=0.2*head_size, anchor=BOTTOM);
@ -1240,7 +1240,6 @@ module _rod(spec, length, tolerance, orient=UP, spin=0, anchor=CENTER)
{
threadspec = thread_specification(spec, internal=false, tolerance=tolerance);
echo(d_major_mean = mean(struct_val(threadspec, "d_major")));
echo(bolt_profile=_thread_profile(threadspec));
threaded_rod([mean(struct_val(threadspec, "d_minor")),
mean(struct_val(threadspec, "d_pitch")),

View file

@ -112,7 +112,7 @@ module rect(size=1, rounding=0, chamfer=0, anchor=CENTER, spin=0) {
children();
}
} 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) {
polygon(pts);
children();

View file

@ -1070,8 +1070,8 @@ function _triangulate_planar_convex_polygons(polys) =
// bent2 = vnf_bend(vnf2, axis="Y");
// vnf_polyhedron([bent1,bent2]);
// Example(3D):
// rgn = union(rect([100,20],center=true),
// rect([20,100],center=true));
// rgn = union(rect([100,20]),
// rect([20,100]));
// vnf0 = linear_sweep(zrot(45,p=rgn), height=10);
// vnf1 = up(50, p=vnf0);
// vnf2 = down(50, p=vnf0);
@ -1080,7 +1080,7 @@ function _triangulate_planar_convex_polygons(polys) =
// vnf_polyhedron([bent1,bent2]);
// Example(3D): Bending Around X Axis.
// rgnr = union(
// rect([20,100],center=true),
// rect([20,100]),
// back(50, p=trapezoid(w1=40, w2=0, h=20, anchor=FRONT))
// );
// vnf0 = xrot(00,p=linear_sweep(rgnr, height=10));
@ -1090,7 +1090,7 @@ function _triangulate_planar_convex_polygons(polys) =
// vnf_polyhedron([bent1]);
// Example(3D): Bending Around Y Axis.
// rgn = union(
// rect([20,100],center=true),
// rect([20,100]),
// back(50, p=trapezoid(w1=40, w2=0, h=20, anchor=FRONT))
// );
// rgnr = zrot(-90, p=rgn);
@ -1101,7 +1101,7 @@ function _triangulate_planar_convex_polygons(polys) =
// vnf_polyhedron([bent1]);
// Example(3D): Bending Around Z Axis.
// rgn = union(
// rect([20,100],center=true),
// rect([20,100]),
// back(50, p=trapezoid(w1=40, w2=0, h=20, anchor=FRONT))
// );
// rgnr = zrot(90, p=rgn);