Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Adrian Mariano 2023-04-04 19:59:46 -04:00
commit 60f6252e5d
31 changed files with 1209 additions and 712 deletions

View File

@ -10,9 +10,11 @@
// Function: affine2d_identity()
// Synopsis: Returns a 2D (3x3) identity transformation matrix.
// Topics: Affine, Matrices, Transforms
// See Also: affine3d_identity(), ident(), IDENT
// Usage:
// mat = affine2d_identify();
// Topics: Affine, Matrices, Transforms
// Description:
// Create a 3x3 affine2d identity matrix.
// Example:
@ -27,10 +29,11 @@ function affine2d_identity() = ident(3);
// Function: affine2d_translate()
// Synopsis: Returns a 2D (3x3) translation transformation matrix.
// Topics: Affine, Matrices, Transforms, Translation
// See Also: affine3d_translate(), move(), translate(), left(), right(), fwd(), back(), down(), up()
// Usage:
// mat = affine2d_translate(v);
// Topics: Affine, Matrices, Transforms, Translation
// See Also: move(), affine3d_translate()
// Description:
// Returns the 3x3 affine2d matrix to perform a 2D translation.
// Arguments:
@ -53,10 +56,11 @@ function affine2d_translate(v=[0,0]) =
// Function: affine2d_scale()
// Synopsis: Returns a 2D (3x3) scaling transformation matrix.
// Topics: Affine, Matrices, Transforms, Scaling
// See Also: affine3d_scale(), scale(), xscale(), yscale(), zscale(), affine3d_scale()
// Usage:
// mat = affine2d_scale(v);
// Topics: Affine, Matrices, Transforms, Scaling
// See Also: scale(), xscale(), yscale(), zscale(), affine3d_scale()
// Description:
// Returns the 3x3 affine2d matrix to perform a 2D scaling transformation.
// Arguments:
@ -79,10 +83,11 @@ function affine2d_scale(v=[1,1]) =
// Function: affine2d_zrot()
// Usage:
// mat = affine2d_zrot(ang);
// Synopsis: Returns a 2D (3x3) rotation transformation matrix.
// Topics: Affine, Matrices, Transforms, Rotation
// See Also: rot(), xrot(), yrot(), zrot(), affine3d_zrot()
// Usage:
// mat = affine2d_zrot(ang);
// Description:
// Returns the 3x3 affine2d matrix to perform a rotation of a 2D vector around the Z axis.
// Arguments:
@ -105,10 +110,11 @@ function affine2d_zrot(ang=0) =
// Function: affine2d_mirror()
// Usage:
// mat = affine2d_mirror(v);
// Synopsis: Returns a 2D (3x3) reflection transformation matrix.
// Topics: Affine, Matrices, Transforms, Reflection, Mirroring
// See Also: mirror(), xflip(), yflip(), zflip(), affine3d_mirror()
// Usage:
// mat = affine2d_mirror(v);
// Description:
// Returns the 3x3 affine2d matrix to perform a reflection of a 2D vector across the line given by its normal vector.
// Arguments:
@ -148,12 +154,13 @@ function affine2d_mirror(v) =
// Function: affine2d_skew()
// Synopsis: Returns a 2D (3x3) skewing transformation matrix.
// Topics: Affine, Matrices, Transforms, Skewing
// See Also: skew(), affine3d_skew()
// Usage:
// mat = affine2d_skew(xa);
// mat = affine2d_skew(ya=);
// mat = affine2d_skew(xa, ya);
// Topics: Affine, Matrices, Transforms, Skewing
// See Also: skew(), affine3d_skew()
// Description:
// Returns the 3x3 affine2d matrix to skew a 2D vector along the XY plane.
// Arguments:
@ -182,9 +189,11 @@ function affine2d_skew(xa=0, ya=0) =
// Function: affine3d_identity()
// Synopsis: Returns a 3D (4x4) identity transformation matrix.
// Topics: Affine, Matrices, Transforms
// See Also: affine2d_identity(), ident(), IDENT
// Usage:
// mat = affine3d_identity();
// Topics: Affine, Matrices, Transforms
// Description:
// Create a 4x4 affine3d identity matrix.
// Example:
@ -200,10 +209,11 @@ function affine3d_identity() = ident(4);
// Function: affine3d_translate()
// Synopsis: Returns a 3D (4x4) translation transformation matrix.
// Topics: Affine, Matrices, Transforms, Translation
// See Also: move(), translate(), left(), right(), fwd(), back(), down(), up(), affine2d_translate()
// Usage:
// mat = affine3d_translate(v);
// Topics: Affine, Matrices, Transforms, Translation
// See Also: move(), affine2d_translate()
// Description:
// Returns the 4x4 affine3d matrix to perform a 3D translation.
// Arguments:
@ -229,10 +239,11 @@ function affine3d_translate(v=[0,0,0]) =
// Function: affine3d_scale()
// Usage:
// mat = affine3d_scale(v);
// Synopsis: Returns a 3D (4x4) scaling transformation matrix.
// Topics: Affine, Matrices, Transforms, Scaling
// See Also: scale(), affine2d_scale()
// Usage:
// mat = affine3d_scale(v);
// Description:
// Returns the 4x4 affine3d matrix to perform a 3D scaling transformation.
// Arguments:
@ -258,10 +269,11 @@ function affine3d_scale(v=[1,1,1]) =
// Function: affine3d_xrot()
// Usage:
// mat = affine3d_xrot(ang);
// Synopsis: Returns a 3D (4x4) X-axis rotation transformation matrix.
// Topics: Affine, Matrices, Transforms, Rotation
// See Also: rot(), xrot(), yrot(), zrot(), affine2d_zrot()
// Usage:
// mat = affine3d_xrot(ang);
// Description:
// Returns the 4x4 affine3d matrix to perform a rotation of a 3D vector around the X axis.
// Arguments:
@ -286,10 +298,11 @@ function affine3d_xrot(ang=0) =
// Function: affine3d_yrot()
// Usage:
// mat = affine3d_yrot(ang);
// Synopsis: Returns a 3D (4x4) Y-axis rotation transformation matrix.
// Topics: Affine, Matrices, Transforms, Rotation
// See Also: rot(), xrot(), yrot(), zrot(), affine2d_zrot()
// Usage:
// mat = affine3d_yrot(ang);
// Description:
// Returns the 4x4 affine3d matrix to perform a rotation of a 3D vector around the Y axis.
// Arguments:
@ -314,10 +327,11 @@ function affine3d_yrot(ang=0) =
// Function: affine3d_zrot()
// Usage:
// mat = affine3d_zrot(ang);
// Synopsis: Returns a 3D (4x4) Z-axis rotation transformation matrix.
// Topics: Affine, Matrices, Transforms, Rotation
// See Also: rot(), xrot(), yrot(), zrot(), affine2d_zrot()
// Usage:
// mat = affine3d_zrot(ang);
// Description:
// Returns the 4x4 affine3d matrix to perform a rotation of a 3D vector around the Z axis.
// Arguments:
@ -342,10 +356,11 @@ function affine3d_zrot(ang=0) =
// Function: affine3d_rot_by_axis()
// Usage:
// mat = affine3d_rot_by_axis(u, ang);
// Synopsis: Returns a 3D (4x4) arbitrary-axis rotation transformation matrix.
// Topics: Affine, Matrices, Transforms, Rotation
// See Also: rot(), xrot(), yrot(), zrot(), affine2d_zrot()
// Usage:
// mat = affine3d_rot_by_axis(u, ang);
// Description:
// Returns the 4x4 affine3d matrix to perform a rotation of a 3D vector around an axis.
// Arguments:
@ -378,10 +393,11 @@ function affine3d_rot_by_axis(u=UP, ang=0) =
// Function: affine3d_rot_from_to()
// Usage:
// mat = affine3d_rot_from_to(from, to);
// Synopsis: Returns a 3D (4x4) tilt rotation transformation matrix.
// Topics: Affine, Matrices, Transforms, Rotation
// See Also: rot(), xrot(), yrot(), zrot(), affine2d_zrot()
// Usage:
// mat = affine3d_rot_from_to(from, to);
// Description:
// Returns the 4x4 affine3d matrix to perform a rotation of a 3D vector from one vector direction to another.
// Arguments:
@ -424,10 +440,11 @@ function affine3d_rot_from_to(from, to) =
// Function: affine3d_mirror()
// Usage:
// mat = affine3d_mirror(v);
// Synopsis: Returns a 3D (4x4) reflection transformation matrix.
// Topics: Affine, Matrices, Transforms, Reflection, Mirroring
// See Also: mirror(), xflip(), yflip(), zflip(), affine2d_mirror()
// Usage:
// mat = affine3d_mirror(v);
// Description:
// Returns the 4x4 affine3d matrix to perform a reflection of a 3D vector across the plane given by its normal vector.
// Arguments:
@ -464,10 +481,11 @@ function affine3d_mirror(v) =
// Function: affine3d_skew()
// Usage:
// mat = affine3d_skew([sxy=], [sxz=], [syx=], [syz=], [szx=], [szy=]);
// Synopsis: Returns a 3D (4x4) skewing transformation matrix.
// Topics: Affine, Matrices, Transforms, Skewing
// See Also: skew(), affine3d_skew_xy(), affine3d_skew_xz(), affine3d_skew_yz(), affine2d_skew()
// Usage:
// mat = affine3d_skew([sxy=], [sxz=], [syx=], [syz=], [szx=], [szy=]);
// Description:
// Returns the 4x4 affine3d matrix to perform a skew transformation.
// Arguments:
@ -495,12 +513,13 @@ function affine3d_skew(sxy=0, sxz=0, syx=0, syz=0, szx=0, szy=0) = [
// Function: affine3d_skew_xy()
// Synopsis: Returns a 3D (4x4) XY-plane skewing transformation matrix.
// Topics: Affine, Matrices, Transforms, Skewing
// See Also: skew(), affine3d_skew(), affine3d_skew_xz(), affine3d_skew_yz(), affine2d_skew()
// Usage:
// mat = affine3d_skew_xy(xa);
// mat = affine3d_skew_xy(ya=);
// mat = affine3d_skew_xy(xa, ya);
// Topics: Affine, Matrices, Transforms, Skewing
// See Also: skew(), affine3d_skew(), affine3d_skew_xz(), affine3d_skew_yz(), affine2d_skew()
// Description:
// Returns the 4x4 affine3d matrix to perform a skew transformation along the XY plane.
// Arguments:
@ -527,12 +546,13 @@ function affine3d_skew_xy(xa=0, ya=0) =
// Function: affine3d_skew_xz()
// Synopsis: Returns a 3D (4x4) XZ-plane skewing transformation matrix.
// Topics: Affine, Matrices, Transforms, Skewing
// See Also: skew(), affine3d_skew(), affine3d_skew_xy(), affine3d_skew_yz(), affine2d_skew()
// Usage:
// mat = affine3d_skew_xz(xa);
// mat = affine3d_skew_xz(za=);
// mat = affine3d_skew_xz(xa, za);
// Topics: Affine, Matrices, Transforms, Skewing
// See Also: skew(), affine3d_skew(), affine3d_skew_xy(), affine3d_skew_yz(), affine2d_skew()
// Description:
// Returns the 4x4 affine3d matrix to perform a skew transformation along the XZ plane.
// Arguments:
@ -559,12 +579,13 @@ function affine3d_skew_xz(xa=0, za=0) =
// Function: affine3d_skew_yz()
// Synopsis: Returns a 3D (4x4) YZ-plane skewing transformation matrix.
// Topics: Affine, Matrices, Transforms, Skewing
// See Also: skew(), affine3d_skew(), affine3d_skew_xy(), affine3d_skew_xz(), affine2d_skew()
// Usage:
// mat = affine3d_skew_yz(ya);
// mat = affine3d_skew_yz(za=);
// mat = affine3d_skew_yz(ya, za);
// Topics: Affine, Matrices, Transforms, Skewing
// See Also: skew(), affine3d_skew(), affine3d_skew_xy(), affine3d_skew_xz(), affine2d_skew()
// Description:
// Returns the 4x4 affine3d matrix to perform a skew transformation along the YZ plane.
// Arguments:

View File

@ -466,10 +466,8 @@ _ANCHOR_TYPES = ["intersect","hull"];
// Synopsis: Attaches children to a parent object at an anchor point.
// Topics: Attachments
// See Also: attachable(), attach(), orient()
//
// Usage:
// PARENT() position(from) CHILDREN;
//
// Description:
// Attaches children to a parent object at an anchor point. For a step-by-step explanation
// of attachments, see the [[Attachments Tutorial|Tutorial-Attachments]].
@ -504,7 +502,6 @@ module position(from)
// Synopsis: Orients children's tops in the directon of the specified anchor.
// Topics: Attachments
// See Also: attachable(), attach(), orient()
// Usage:
// PARENT() orient(anchor, [spin]) CHILDREN;
// Description:
@ -558,7 +555,6 @@ module orient(anchor, spin) {
// Synopsis: Attaches children to a parent object at an anchor point and orientation.
// Topics: Attachments
// See Also: attachable(), position(), face_profile(), edge_profile(), corner_profile()
//
// Usage:
// PARENT() attach(from, [overlap=], [norot=]) CHILDREN;
// PARENT() attach(from, to, [overlap=], [norot=]) CHILDREN;
@ -615,7 +611,6 @@ module attach(from, to, overlap, norot=false)
// Synopsis: Assigns a tag to an object
// Topics: Attachments
// See Also: force_tag(), recolor(), hide(), show_only(), diff(), intersect()
//
// Usage:
// PARENT() tag(tag) CHILDREN;
// Description:
@ -651,10 +646,9 @@ module tag(tag)
// Module: force_tag()
// Assigns a tag to a non-attachable object.
// Synopsis: Assigns a tag to a non-attachable object.
// Topics: Attachments
// See Also: tag(), recolor(), hide(), show_only(), diff(), intersect()
//
// Usage:
// PARENT() force_tag([tag]) CHILDREN;
// Description:
@ -718,7 +712,6 @@ module force_tag(tag)
// Synopsis: Sets a default tag for all children.
// Topics: Attachments
// See Also: force_tag(), recolor(), hide(), show_only(), diff(), intersect()
//
// Usage:
// PARENT() default_tag(tag) CHILDREN;
// Description:
@ -756,6 +749,9 @@ module default_tag(tag)
// Module: tag_scope()
// Synopsis: Creates a new tag scope.
// See Also: tag(), force_tag(), default_tag()
// Topics: Attachments
// Usage:
// tag_scope([scope]) CHILDREN;
// Description:
@ -803,7 +799,6 @@ module tag_scope(scope){
// Synopsis: Performs a differencing operation using tags rather than hierarchy to control what happens.
// Topics: Attachments
// See Also: tag(), force_tag(), recolor(), show_only(), hide(), tag_diff(), intersect(), tag_intersect()
//
// Usage:
// diff([remove], [keep]) PARENT() CHILDREN;
// Description:
@ -993,7 +988,6 @@ module diff(remove="remove", keep="keep")
// Synopsis: Performs a {{diff()}} and then sets a tag on the result.
// Topics: Attachments
// See Also: tag(), force_tag(), recolor(), show_only(), hide(), diff(), intersect(), tag_intersect()
//
// Usage:
// tag_diff(tag, [remove], [keep]) PARENT() CHILDREN;
// Description:
@ -1065,7 +1059,6 @@ module tag_diff(tag,remove="remove", keep="keep")
// Synopsis: Perform an intersection operation on children using tags rather than hierarchy to control what happens.
// Topics: Attachments
// See Also: tag(), force_tag(), recolor(), show_only(), hide(), diff(), tag_diff(), tag_intersect()
//
// Usage:
// intersect([intersect], [keep]) PARENT() CHILDREN;
// Description:
@ -1136,7 +1129,6 @@ module intersect(intersect="intersect",keep="keep")
// Synopsis: Performs an {{intersect()}} and then tags the result.
// Topics: Attachments
// See Also: tag(), force_tag(), recolor(), show_only(), hide(), diff(), tag_diff(), intersect()
//
// Usage:
// tag_intersect(tag, [intersect], [keep]) PARENT() CHILDREN;
// Description:
@ -1193,7 +1185,6 @@ module tag_intersect(tag,intersect="intersect",keep="keep")
// Synopsis: Performs a hull operation on the children using tags to determine what happens.
// Topics: Attachments
// See Also: tag(), recolor(), show_only(), hide(), diff(), intersect()
//
// Usage:
// conv_hull([keep]) CHILDREN;
// Description:
@ -1231,7 +1222,6 @@ module conv_hull(keep="keep")
// Synopsis: Performs a {{conv_hull()}} and then sets a tag on the result.
// Topics: Attachments
// See Also: tag(), recolor(), show_only(), hide(), diff(), intersect()
//
// Usage:
// tag_conv_hull(tag, [keep]) CHILDREN;
// Description:
@ -1283,7 +1273,6 @@ module tag_conv_hull(tag,keep="keep")
// Synopsis: Hides attachable children with the given tags.
// Topics: Attachments
// See Also: tag(), recolor(), show_only(), show_all(), show_int(), diff(), intersect()
//
// Usage:
// hide(tags) CHILDREN;
// Description:
@ -1319,7 +1308,6 @@ module hide(tags)
// Synopsis: Show only the children with the listed tags.
// See Also: tag(), recolor(), show_all(), show_int(), diff(), intersect()
// Topics: Attachments
//
// Usage:
// show_only(tags) CHILDREN;
// Description:
@ -1347,7 +1335,6 @@ module show_only(tags)
// Synopsis: Shows all children and clears tags.
// See Also: tag(), recolor(), show_only(), show_int(), diff(), intersect()
// Topics: Attachments
//
// Usage;
// show_all() CHILDREN;
// Description:
@ -1369,7 +1356,6 @@ module show_all()
// Synopsis: Shows children with the listed tags which were already shown in the parent context.
// See Also: tag(), recolor(), show_only(), show_all(), show_int(), diff(), intersect()
// Topics: Attachments
//
// Usage:
// show_int(tags) CHILDREN;
// Description:
@ -1395,8 +1381,7 @@ module show_int(tags)
// Module: face_mask()
// Synopsis: Ataches a 3d mask shape to the given faces of the parent.
// Topics: Attachments, Masking
// See Also: attachable(), position(), edge_mask(), corner_mask(), face_profile(), edge_profile(), corner_profile()
//
// See Also: attachable(), position(), attach(), edge_mask(), corner_mask(), face_profile(), edge_profile(), corner_profile()
// Usage:
// PARENT() face_mask(faces) CHILDREN;
// Description:
@ -1412,7 +1397,6 @@ module show_int(tags)
// Tags the children with "remove" (and hence sets `$tag`) if no tag is already set.
// `$idx` is set to the index number of each face in the list of faces given.
// `$attach_anchor` is set for each face given, to the `[ANCHOR, POSITION, ORIENT, SPIN]` information for that anchor.
// See Also: attachable(), position(), attach(), face_profile(), edge_profile(), corner_mask(), edge_mask()
// Example:
// diff()
// cylinder(r=30, h=60)
@ -1441,7 +1425,6 @@ module face_mask(faces=[LEFT,RIGHT,FRONT,BACK,BOT,TOP]) {
// Synopsis: Attaches a 3D mask shape to the given edges of the parent.
// Topics: Attachments, Masking
// See Also: attachable(), position(), attach(), face_mask(), corner_mask(), face_profile(), edge_profile(), corner_profile()
//
// Usage:
// PARENT() edge_mask([edges], [except]) CHILDREN;
// Description:
@ -1506,7 +1489,6 @@ module edge_mask(edges=EDGES_ALL, except=[]) {
// Synopsis: Attaches a 3d mask shape to the given corners of the parent.
// Topics: Attachments, Masking
// See Also: attachable(), position(), attach(), face_mask(), edge_mask(), face_profile(), edge_profile(), corner_profile()
//
// Usage:
// PARENT() corner_mask([corners], [except]) CHILDREN;
// Description:
@ -1557,7 +1539,6 @@ module corner_mask(corners=CORNERS_ALL, except=[]) {
// Synopsis: Extrudes a 2D edge profile into a mask for all edges and corners of the given faces on the parent.
// Topics: Attachments, Masking
// See Also: attachable(), position(), attach(), edge_profile(), corner_profile(), face_mask(), edge_mask(), corner_mask()
//
// Usage:
// PARENT() face_profile(faces, r|d=, [convexity=]) CHILDREN;
// Description:
@ -1596,7 +1577,6 @@ module face_profile(faces=[], r, d, convexity=10) {
// Synopsis: Extrudes a 2d edge profile into a mask on the given edges of the parent.
// Topics: Attachments, Masking
// See Also: attachable(), position(), attach(), face_profile(), corner_profile(), edge_mask(), face_mask(), corner_mask()
//
// Usage:
// PARENT() edge_profile([edges], [except], [convexity]) CHILDREN;
// Description:
@ -1660,7 +1640,6 @@ module edge_profile(edges=EDGES_ALL, except=[], convexity=10) {
// Synopsis: Rotationally extrudes a 2d edge profile into corner mask on the given corners of the parent.
// Topics: Attachments, Masking
// See Also: attachable(), position(), attach(), face_profile(), edge_profile(), corner_mask(), face_mask(), edge_mask()
//
// Usage:
// PARENT() corner_profile([corners], [except], [r=|d=], [convexity=]) CHILDREN;
// Description:
@ -1735,7 +1714,6 @@ module corner_profile(corners=CORNERS_ALL, except=[], r, d, convexity=10) {
// Synopsis: Manages the anchoring, spin, orientation, and attachments for an object.
// Topics: Attachments
// See Also: reorient()
//
// Usage: Square/Trapezoid Geometry
// attachable(anchor, spin, two_d=true, size=, [size2=], [shift=], [override=], ...) {OBJECT; children();}
// Usage: Circle/Oval Geometry
@ -2045,7 +2023,6 @@ module attachable(
// Synopsis: Calculates the transformation matrix needed to reorient an object.
// Topics: Attachments
// See Also: reorient(), attachable()
//
// Usage: Square/Trapezoid Geometry
// mat = reorient(anchor, spin, [orient], two_d=true, size=, [size2=], [shift=], ...);
// pts = reorient(anchor, spin, [orient], two_d=true, size=, [size2=], [shift=], p=, ...);
@ -2170,7 +2147,6 @@ function reorient(
// Synopsis: Creates an anchro data structure.
// Topics: Attachments
// See Also: reorient(), attachable()
//
// Usage:
// a = named_anchor(name, pos, [orient], [spin]);
// Description:
@ -2188,7 +2164,6 @@ function named_anchor(name, pos, orient=UP, spin=0) = [name, pos, orient, spin];
// Synopsis: Returns the internal geometry description of an attachable object.
// Topics: Attachments
// See Also: reorient(), attachable()
//
// Usage: Null/Point Geometry
// geom = attach_geom(...);
// Usage: Square/Trapezoid Geometry
@ -2418,11 +2393,10 @@ function attach_geom(
/// Internal Function: _attach_geom_2d()
/// Topics: Attachments
/// See Also: reorient(), attachable()
//
// Usage:
// bool = _attach_geom_2d(geom);
// Description:
// Returns true if the given attachment geometry description is for a 2D shape.
/// Usage:
/// bool = _attach_geom_2d(geom);
/// Description:
/// Returns true if the given attachment geometry description is for a 2D shape.
function _attach_geom_2d(geom) =
let( type = geom[0] )
type == "trapezoid" || type == "ellipse" ||
@ -2430,12 +2404,12 @@ function _attach_geom_2d(geom) =
/// Internal Function: _attach_geom_size()
// Usage:
// bounds = _attach_geom_size(geom);
/// Usage:
/// bounds = _attach_geom_size(geom);
/// Topics: Attachments
/// See Also: reorient(), attachable()
// Description:
// Returns the `[X,Y,Z]` bounding size for the given attachment geometry description.
/// Description:
/// Returns the `[X,Y,Z]` bounding size for the given attachment geometry description.
function _attach_geom_size(geom) =
let( type = geom[0] )
type == "point"? [0,0,0] :
@ -2495,21 +2469,21 @@ function _attach_geom_size(geom) =
/// Internal Function: _attach_transform()
// Usage: To Get a Transformation Matrix
// mat = _attach_transform(anchor, spin, orient, geom);
// Usage: To Transform Points, Paths, Patches, or VNFs
// new_p = _attach_transform(anchor, spin, orient, geom, p);
/// Usage: To Get a Transformation Matrix
/// mat = _attach_transform(anchor, spin, orient, geom);
/// Usage: To Transform Points, Paths, Patches, or VNFs
/// new_p = _attach_transform(anchor, spin, orient, geom, p);
/// Topics: Attachments
/// See Also: reorient(), attachable()
// Description:
// Returns the affine3d transformation matrix needed to `anchor`, `spin`, and `orient`
// the given geometry `geom` shape into position.
// Arguments:
// anchor = Anchor point to translate to the origin `[0,0,0]`. See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
// geom = The geometry description of the shape.
// p = If given as a VNF, path, or point, applies the affine3d transformation matrix to it and returns the result.
/// Description:
/// Returns the affine3d transformation matrix needed to `anchor`, `spin`, and `orient`
/// the given geometry `geom` shape into position.
/// Arguments:
/// anchor = Anchor point to translate to the origin `[0,0,0]`. See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
/// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
/// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
/// geom = The geometry description of the shape.
/// p = If given as a VNF, path, or point, applies the affine3d transformation matrix to it and returns the result.
function _attach_transform(anchor, spin, orient, geom, p) =
assert(is_undef(anchor) || is_vector(anchor) || is_string(anchor), str("Got: ",anchor))
assert(is_undef(spin) || is_vector(spin,3) || is_num(spin), str("Got: ",spin))
@ -2616,18 +2590,18 @@ function _force_anchor_2d(anchor) =
/// Internal Function: _find_anchor()
// Usage:
// anchorinfo = _find_anchor(anchor, geom);
/// Usage:
/// anchorinfo = _find_anchor(anchor, geom);
/// Topics: Attachments
/// See Also: reorient(), attachable()
// Description:
// Calculates the anchor data for the given `anchor` vector or name, in the given attachment
// geometry. Returns `[ANCHOR, POS, VEC, ANG]` where `ANCHOR` is the requested anchorname
// or vector, `POS` is the anchor position, `VEC` is the direction vector of the anchor, and
// `ANG` is the angle to align with around the rotation axis of th anchor direction vector.
// Arguments:
// anchor = Vector or named anchor string.
// geom = The geometry description of the shape.
/// Description:
/// Calculates the anchor data for the given `anchor` vector or name, in the given attachment
/// geometry. Returns `[ANCHOR, POS, VEC, ANG]` where `ANCHOR` is the requested anchorname
/// or vector, `POS` is the anchor position, `VEC` is the direction vector of the anchor, and
/// `ANG` is the angle to align with around the rotation axis of th anchor direction vector.
/// Arguments:
/// anchor = Vector or named anchor string.
/// geom = The geometry description of the shape.
function _find_anchor(anchor, geom) =
is_string(anchor)? (
anchor=="origin"? [anchor, CENTER, UP, 0]
@ -2883,12 +2857,12 @@ function _find_anchor(anchor, geom) =
/// Internal Function: _is_shown()
// Usage:
// bool = _is_shown();
/// Usage:
/// bool = _is_shown();
/// Topics: Attachments
/// See Also: reorient(), attachable()
// Description:
// Returns true if objects should currently be shown based on the tag settings.
/// Description:
/// Returns true if objects should currently be shown based on the tag settings.
function _is_shown() =
assert(is_list($tags_shown) || $tags_shown=="ALL")
assert(is_list($tags_hidden))
@ -2932,7 +2906,6 @@ function _standard_anchors(two_d=false) = [
// Synopsis: Shows anchors for the parent object.
// Topics: Attachments
// See Also: expose_anchors(), anchor_arrow(), anchor_arrow2d(), frame_ref()
//
// Usage:
// PARENT() show_anchors([s], [std=], [custom=]);
// Description:
@ -2996,7 +2969,6 @@ module show_anchors(s=10, std=true, custom=true) {
// Synopsis: Shows a 3d anchor orientation arrow.
// Topics: Attachments
// See Also: anchor_arrow2d(), show_anchors(), expose_anchors(), frame_ref()
//
// Usage:
// anchor_arrow([s], [color], [flag], [anchor=], [orient=], [spin=]) [ATTACHMENTS];
// Description:
@ -3035,7 +3007,6 @@ module anchor_arrow(s=10, color=[0.333,0.333,1], flag=true, $tag="anchor-arrow",
// Synopsis: Shows a 2d anchor orientation arrow.
// Topics: Attachments
// See Also: anchor_arrow(), show_anchors(), expose_anchors(), frame_ref()
//
// Usage:
// anchor_arrow2d([s], [color], [flag]);
// Description:

View File

@ -13,6 +13,9 @@
// Section: Ball Bearing Models
// Module: ball_bearing()
// Synopsis: Creates a standardized ball bearing assembly.
// Topics: Parts, Bearings
// See Also: linear_bearing(), lmXuu_bearing(), lmXuu_housing()
// Description:
// Creates a model of a ball bearing assembly.
// Arguments:
@ -70,6 +73,9 @@ module ball_bearing(trade_size, id, od, width, shield=true, anchor=CTR, spin=0,
// Function: ball_bearing_info()
// Synopsis: Creates a standardized ball bearing assembly.
// Topics: Parts, Bearings
// See Also: ball_bearing(), linear_bearing(), lmXuu_info()
// Description:
// Get dimensional info for a standard metric ball bearing cartridge.
// Returns `[SHAFT_DIAM, OUTER_DIAM, WIDTH, SHIELDED]` for the cylindrical cartridge.

View File

@ -28,11 +28,13 @@
// Section: Bezier Curves
// Function: bezier_points()
// Synopsis: Computes one or more specified points along a bezier curve.
// Topics: Bezier Curves
// See Also: bezier_curve(), bezier_curvature(), bezier_tangent(), bezier_derivative(), bezier_points()
// Usage:
// pt = bezier_points(bezier, u);
// ptlist = bezier_points(bezier, RANGE);
// ptlist = bezier_points(bezier, LIST);
// Topics: Bezier Curves
// Description:
// Computes points on a bezier curve with control points specified by `bezier` at parameter values
// specified by `u`, which can be a scalar or a list. The value `u=0` gives the first endpoint; `u=1` gives the final endpoint,
@ -176,10 +178,11 @@ function _bezier_matrix(N) =
// Function: bezier_curve()
// Synopsis: Computes a number of uniformly distributed points along a bezier curve.
// Topics: Bezier Curves
// See Also: bezier_curve(), bezier_curvature(), bezier_tangent(), bezier_derivative(), bezier_points()
// Usage:
// path = bezier_curve(bezier, [splinesteps], [endpoint]);
// Topics: Bezier Curves
// See Also: bezier_curvature(), bezier_tangent(), bezier_derivative(), bezier_points()
// Description:
// Takes a list of bezier control points and generates splinesteps segments (splinesteps+1 points)
// along the bezier curve they define.
@ -210,12 +213,13 @@ function bezier_curve(bezier,splinesteps=16,endpoint=true) =
// Function: bezier_derivative()
// Synopsis: Evaluates the derivative of the bezier curve at the given point or points.
// Topics: Bezier Curves
// See Also: bezier_curvature(), bezier_tangent(), bezier_points()
// Usage:
// deriv = bezier_derivative(bezier, u, [order]);
// derivs = bezier_derivative(bezier, LIST, [order]);
// derivs = bezier_derivative(bezier, RANGE, [order]);
// Topics: Bezier Curves
// See Also: bezier_curvature(), bezier_tangent(), bezier_points()
// Description:
// Evaluates the derivative of the bezier curve at the given parameter value or values, `u`. The `order` gives the order of the derivative.
// The degree of the bezier curve is one less than the number of points in `bezier`.
@ -234,12 +238,13 @@ function bezier_derivative(bezier, u, order=1) =
// Function: bezier_tangent()
// Synopsis: Calculates unit tangent vectors along the bezier curve at one or more given positions.
// Topics: Bezier Curves
// See Also: bezier_curvature(), bezier_derivative(), bezier_points()
// Usage:
// tanvec = bezier_tangent(bezier, u);
// tanvecs = bezier_tangent(bezier, LIST);
// tanvecs = bezier_tangent(bezier, RANGE);
// Topics: Bezier Curves
// See Also: bezier_curvature(), bezier_derivative(), bezier_points()
// Description:
// Returns the unit tangent vector at the given parameter values on a bezier curve with control points `bezier`.
// Arguments:
@ -254,12 +259,13 @@ function bezier_tangent(bezier, u) =
// Function: bezier_curvature()
// Synopsis: Returns the curvature values at one or more given positions along a bezier curve.
// Topics: Bezier Curves
// See Also: bezier_tangent(), bezier_derivative(), bezier_points()
// Usage:
// crv = bezier_curvature(curve, u);
// crvlist = bezier_curvature(curve, LIST);
// crvlist = bezier_curvature(curve, RANGE);
// Topics: Bezier Curves
// See Also: bezier_tangent(), bezier_derivative(), bezier_points()
// Description:
// Returns the curvature value for the given parameters `u` on the bezier curve with control points `bezier`.
// The curvature is the inverse of the radius of the tangent circle at the given point.
@ -284,10 +290,11 @@ function bezier_curvature(bezier, u) =
// Function: bezier_closest_point()
// Usage:
// u = bezier_closest_point(bezier, pt, [max_err]);
// Synopsis: Finds the closest position on a bezier curve to a given point.
// Topics: Bezier Curves
// See Also: bezier_points()
// Usage:
// u = bezier_closest_point(bezier, pt, [max_err]);
// Description:
// Finds the closest part of the given bezier curve to point `pt`.
// The degree of the curve, N, is one less than the number of points in `curve`.
@ -333,10 +340,11 @@ function bezier_closest_point(bezier, pt, max_err=0.01, u=0, end_u=1) =
// Function: bezier_length()
// Usage:
// pathlen = bezier_length(bezier, [start_u], [end_u], [max_deflect]);
// Synopsis: Approximate the length of part of a bezier curve.
// Topics: Bezier Curves
// See Also: bezier_points()
// Usage:
// pathlen = bezier_length(bezier, [start_u], [end_u], [max_deflect]);
// Description:
// Approximates the length of the portion of the bezier curve between start_u and end_u.
// Arguments:
@ -370,10 +378,11 @@ function bezier_length(bezier, start_u=0, end_u=1, max_deflect=0.01) =
// Function: bezier_line_intersection()
// Usage:
// u = bezier_line_intersection(bezier, line);
// Synopsis: Calculates where a bezier curve intersects a line.
// Topics: Bezier Curves, Geometry, Intersection
// See Also: bezier_points(), bezier_length(), bezier_closest_point()
// Usage:
// u = bezier_line_intersection(bezier, line);
// Description:
// Finds the intersection points of the 2D Bezier curve with control points `bezier` and the given line, specified as a pair of points.
// Returns the intersection as a list of `u` values for the Bezier.
@ -404,12 +413,13 @@ function bezier_line_intersection(bezier, line) =
// Function: bezpath_points()
// Synopsis: Computes one or more specified points along a bezier path.
// Topics: Bezier Paths
// See Also: bezier_points(), bezier_curve()
// Usage:
// pt = bezpath_points(bezpath, curveind, u, [N]);
// ptlist = bezpath_points(bezpath, curveind, LIST, [N]);
// path = bezpath_points(bezpath, curveind, RANGE, [N]);
// Topics: Bezier Paths
// See Also: bezier_points(), bezier_curve()
// Description:
// Extracts from the Bezier path `bezpath` the control points for the Bezier curve whose index is `curveind` and
// computes the point or points on the corresponding Bezier curve specified by `u`. If `curveind` is zero you
@ -424,12 +434,13 @@ function bezpath_points(bezpath, curveind, u, N=3) =
// Function: bezpath_curve()
// Synopsis: Takes a bezier path and converts it into a path of points.
// Topics: Bezier Paths
// See Also: bezier_points(), bezier_curve(), bezpath_points()
// Usage:
// path = bezpath_curve(bezpath, [splinesteps], [N], [endpoint])
// Topics: Bezier Paths
// See Also: bezier_points(), bezier_curve()
// Description:
// Takes a bezier path and converts it into a path of points.
// Computes a number of uniformly distributed points along a bezier path.
// Arguments:
// bezpath = A bezier path to approximate.
// splinesteps = Number of straight lines to split each bezier curve into. default=16
@ -459,10 +470,11 @@ function bezpath_curve(bezpath, splinesteps=16, N=3, endpoint=true) =
// Function: bezpath_closest_point()
// Synopsis: Finds the closest part of a bezier path to a give point.
// Topics: Bezier Paths
// See Also: bezpath_points(), bezpath_curve(), bezier_points(), bezier_curve(), bezier_closest_point()
// Usage:
// res = bezpath_closest_point(bezpath, pt, [N], [max_err]);
// Topics: Bezier Paths
// See Also: bezier_points(), bezier_curve(), bezier_closest_point()
// Description:
// Finds an approximation to the closest part of the given bezier path to point `pt`.
// Returns [segnum, u] for the closest position on the bezier path to the given point `pt`.
@ -504,10 +516,11 @@ function bezpath_closest_point(bezpath, pt, N=3, max_err=0.01, seg=0, min_seg=un
// Function: bezpath_length()
// Usage:
// plen = bezpath_length(path, [N], [max_deflect]);
// Synopsis: Approximate the length of a bezier path.
// Topics: Bezier Paths
// See Also: bezier_points(), bezier_curve(), bezier_length()
// Usage:
// plen = bezpath_length(path, [N], [max_deflect]);
// Description:
// Approximates the length of the bezier path.
// Arguments:
@ -530,10 +543,11 @@ function bezpath_length(bezpath, N=3, max_deflect=0.001) =
// Function: path_to_bezpath()
// Usage:
// bezpath = path_to_bezpath(path, [closed], [tangents], [uniform], [size=]|[relsize=]);
// Synopsis: Generates a bezier path that passes through all points in a given linear path.
// Topics: Bezier Paths, Rounding
// See Also: path_tangents()
// Usage:
// bezpath = path_to_bezpath(path, [closed], [tangents], [uniform], [size=]|[relsize=]);
// Description:
// Given a 2d or 3d input path and optional list of tangent vectors, computes a cubic (degree 3) bezier
// path that passes through every point on the input path and matches the tangent vectors. If you do
@ -616,10 +630,11 @@ function path_to_bezpath(path, closed, tangents, uniform=false, size, relsize) =
// Function: bezpath_close_to_axis()
// Usage:
// bezpath = bezpath_close_to_axis(bezpath, [axis], [N]);
// Synopsis: Closes a 2D bezier path to the specified axis.
// Topics: Bezier Paths
// See Also: bezpath_offset()
// Usage:
// bezpath = bezpath_close_to_axis(bezpath, [axis], [N]);
// Description:
// Takes a 2D bezier path and closes it to the specified axis.
// Arguments:
@ -659,10 +674,11 @@ function bezpath_close_to_axis(bezpath, axis="X", N=3) =
// Function: bezpath_offset()
// Usage:
// bezpath = bezpath_offset(offset, bezier, [N]);
// Synopsis: Forms a closed bezier path loop with a translated and reversed copy of itself.
// Topics: Bezier Paths
// See Also: bezpath_close_to_axis()
// Usage:
// bezpath = bezpath_offset(offset, bezier, [N]);
// Description:
// Takes a 2D bezier path and closes it with a matching reversed path that is offset by the given `offset` [X,Y] distance.
// Arguments:
@ -697,6 +713,7 @@ function bezpath_offset(offset, bezier, N=3) =
// Section: Cubic Bezier Path Construction
// Function: bez_begin()
// Synopsis: Calculates starting bezier path control points.
// Topics: Bezier Paths
// See Also: bez_tang(), bez_joint(), bez_end()
// Usage:
@ -767,6 +784,7 @@ function bez_begin(pt,a,r,p) =
// Function: bez_tang()
// Synopsis: Calculates control points for a smooth bezier path joint.
// Topics: Bezier Paths
// See Also: bez_begin(), bez_joint(), bez_end()
// Usage:
@ -802,6 +820,7 @@ function bez_tang(pt,a,r1,r2,p) =
// Function: bez_joint()
// Synopsis: Calculates control points for a disjointed corner bezier path joint.
// Topics: Bezier Paths
// See Also: bez_begin(), bez_tang(), bez_end()
// Usage:
@ -842,6 +861,7 @@ function bez_joint(pt,a1,a2,r1,r2,p1,p2) =
// Function: bez_end()
// Synopsis: Calculates ending bezier path control points.
// Topics: Bezier Paths
// See Also: bez_tang(), bez_joint(), bez_end()
// Usage:
@ -868,11 +888,12 @@ function bez_end(pt,a,r,p) =
// Function: is_bezier_patch()
// Synopsis: Returns true if the given item is a bezier patch.
// Topics: Bezier Patches, Type Checking
// Usage:
// bool = is_bezier_patch(x);
// Topics: Bezier Patches, Type Checking
// Description:
// Returns true if the given item is a bezier patch.
// Returns true if the given item is a bezier patch. (a 2D array of 3D points.)
// Arguments:
// x = The value to check the type of.
function is_bezier_patch(x) =
@ -880,10 +901,11 @@ function is_bezier_patch(x) =
// Function: bezier_patch_flat()
// Usage:
// patch = bezier_patch_flat(size, [N=], [spin=], [orient=], [trans=]);
// Synopsis: Creates a flat bezier patch.
// Topics: Bezier Patches
// See Also: bezier_patch_points()
// Usage:
// patch = bezier_patch_flat(size, [N=], [spin=], [orient=], [trans=]);
// Description:
// Returns a flat rectangular bezier patch of degree `N`, centered on the XY plane.
// Arguments:
@ -913,10 +935,11 @@ function bezier_patch_flat(size, N=1, spin=0, orient=UP, trans=[0,0,0]) =
// Function: bezier_patch_reverse()
// Usage:
// rpatch = bezier_patch_reverse(patch);
// Synopsis: Reverses the orientation of a bezier patch.
// Topics: Bezier Patches
// See Also: bezier_patch_points(), bezier_patch_flat()
// Usage:
// rpatch = bezier_patch_reverse(patch);
// Description:
// Reverses the patch, so that the faces generated from it are flipped back to front.
// Arguments:
@ -926,12 +949,13 @@ function bezier_patch_reverse(patch) =
// Function: bezier_patch_points()
// Synopsis: Computes one or more specified points across a bezier surface patch.
// Topics: Bezier Patches
// See Also: bezier_patch_normals(), bezier_points(), bezier_curve(), bezpath_curve()
// Usage:
// pt = bezier_patch_points(patch, u, v);
// ptgrid = bezier_patch_points(patch, LIST, LIST);
// ptgrid = bezier_patch_points(patch, RANGE, RANGE);
// Topics: Bezier Patches
// See Also: bezier_patch_normals(), bezier_points(), bezier_curve(), bezpath_curve()
// Description:
// Sample a bezier patch on a listed point set. The bezier patch must be a rectangular array of
// points, and it will be sampled at all the (u,v) pairs that you specify. If you give u and v
@ -987,10 +1011,11 @@ function _bezier_rectangle(patch, splinesteps=16, style="default") =
// Function: bezier_vnf()
// Usage:
// vnf = bezier_vnf(patches, [splinesteps], [style]);
// Synopsis: Generates a (probably non-manifold) VNF for one or more bezier surface patches.
// Topics: Bezier Patches
// See Also: bezier_patch_points(), bezier_patch_flat()
// Usage:
// vnf = bezier_vnf(patches, [splinesteps], [style]);
// Description:
// Convert a patch or list of patches into the corresponding Bezier surface, representing the
// result as a [VNF structure](vnf.scad). The `splinesteps` argument specifies the sampling grid of
@ -1113,6 +1138,9 @@ function bezier_vnf(patches=[], splinesteps=16, style="default") =
// Function: bezier_vnf_degenerate_patch()
// Synopsis: Generates a VNF for a degenerate bezier surface patch.
// Topics: Bezier Patches
// See Also: bezier_patch_points(), bezier_patch_flat(), bezier_vnf()
// Usage:
// vnf = bezier_vnf_degenerate_patch(patch, [splinesteps], [reverse]);
// vnf_edges = bezier_vnf_degenerate_patch(patch, [splinesteps], [reverse], return_edges=true);
@ -1297,12 +1325,13 @@ function bezier_vnf_degenerate_patch(patch, splinesteps=16, reverse=false, retur
// Function: bezier_patch_normals()
// Synopsis: Computes surface normals for one or more places on a bezier surface patch.
// Topics: Bezier Patches
// See Also: bezier_patch_points(), bezier_points(), bezier_curve(), bezpath_curve()
// Usage:
// n = bezier_patch_normals(patch, u, v);
// ngrid = bezier_patch_normals(patch, LIST, LIST);
// ngrid = bezier_patch_normals(patch, RANGE, RANGE);
// Topics: Bezier Patches
// See Also: bezier_patch_points(), bezier_points(), bezier_curve(), bezpath_curve()
// Description:
// Compute the unit normal vector to a bezier patch at the listed point set. The bezier patch must be a rectangular array of
// points, and the normal will be computed at all the (u,v) pairs that you specify. If you give u and v
@ -1409,10 +1438,11 @@ function bezier_patch_normals(patch, u, v) =
// Module: debug_bezier()
// Usage:
// debug_bezier(bez, [size], [N=]);
// Synopsis: Shows a bezier path and it's associated control points.
// Topics: Bezier Paths, Debugging
// See Also: bezpath_curve()
// Usage:
// debug_bezier(bez, [size], [N=]);
// Description:
// Renders 2D or 3D bezier paths and their associated control points.
// Useful for debugging bezier paths.
@ -1462,10 +1492,11 @@ module debug_bezier(bezpath, width=1, N=3) {
// Module: debug_bezier_patches()
// Usage:
// debug_bezier_patches(patches, [size=], [splinesteps=], [showcps=], [showdots=], [showpatch=], [convexity=], [style=]);
// Synopsis: Shows a bezier surface patch and its associated control points.
// Topics: Bezier Patches, Debugging
// See Also: bezier_patch_points(), bezier_patch_flat(), bezier_vnf()
// Usage:
// debug_bezier_patches(patches, [size=], [splinesteps=], [showcps=], [showdots=], [showpatch=], [convexity=], [style=]);
// Description:
// Shows the surface, and optionally, control points of a list of bezier patches.
// Arguments:

View File

@ -17,6 +17,9 @@ include <rounding.scad>
// Module: pco1810_neck()
// Synopsis: Creates a neck for a PCO1810 standard bottle.
// Topics: Bottles, Threading
// See Also: pco1810_cap()
// Usage:
// pco1810_neck([wall]) [ATTACHMENTS];
// Description:
@ -138,6 +141,9 @@ function pco1810_neck(wall=2, anchor="support-ring", spin=0, orient=UP) =
// Module: pco1810_cap()
// Synopsis: Creates a cap for a PCO1810 standard bottle.
// Topics: Bottles, Threading
// See Also: pco1810_neck()
// Usage:
// pco1810_cap([wall], [texture]) [ATTACHMENTS];
// Description:
@ -205,6 +211,9 @@ function pco1810_cap(wall=2, texture="none", anchor=BOTTOM, spin=0, orient=UP) =
// Module: pco1881_neck()
// Synopsis: Creates a neck for a PCO1881 standard bottle.
// Topics: Bottles, Threading
// See Also: pco1881_cap()
// Usage:
// pco1881_neck([wall]) [ATTACHMENTS];
// Description:
@ -326,6 +335,9 @@ function pco1881_neck(wall=2, anchor="support-ring", spin=0, orient=UP) =
// Module: pco1881_cap()
// Synopsis: Creates a cap for a PCO1881 standard bottle.
// Topics: Bottles, Threading
// See Also: pco1881_neck()
// Usage:
// pco1881_cap(wall, [texture]) [ATTACHMENTS];
// Description:
@ -385,6 +397,9 @@ function pco1881_cap(wall=2, texture="none", anchor=BOTTOM, spin=0, orient=UP) =
// Section: Generic Bottle Connectors
// Module: generic_bottle_neck()
// Synopsis: Creates a generic neck for a bottle.
// Topics: Bottles, Threading
// See Also: generic_bottle_cap()
// Usage:
// generic_bottle_neck([wall], ...) [ATTACHMENTS];
// Description:
@ -510,6 +525,9 @@ function generic_bottle_neck(
// Module: generic_bottle_cap()
// Synopsis: Creates a generic cap for a bottle.
// Topics: Bottles, Threading
// See Also: generic_bottle_neck()
// Usage:
// generic_bottle_cap(wall, [texture], ...) [ATTACHMENTS];
// Description:
@ -596,6 +614,9 @@ function generic_bottle_cap(
// Module: bottle_adapter_neck_to_cap()
// Synopsis: Creates a generic adaptor between a neck and a cap.
// Topics: Bottles, Threading
// See Also: bottle_adapter_neck_to_neck()
// Usage:
// bottle_adapter_neck_to_cap(wall, [texture], ...) [ATTACHMENTS];
// Description:
@ -709,6 +730,9 @@ function bottle_adapter_neck_to_cap(
// Module: bottle_adapter_cap_to_cap()
// Synopsis: Creates a generic adaptor between a cap and a cap.
// Topics: Bottles, Threading
// See Also: bottle_adapter_neck_to_cap(), bottle_adapter_neck_to_neck()
// Usage:
// bottle_adapter_cap_to_cap(wall, [texture]);
// Description:
@ -822,6 +846,9 @@ function bottle_adapter_cap_to_cap(
// Module: bottle_adapter_neck_to_neck()
// Synopsis: Creates a generic adaptor between a neck and a neck.
// Topics: Bottles, Threading
// See Also: bottle_adapter_neck_to_cap(), bottle_adapter_cap_to_cap()
// Usage:
// bottle_adapter_neck_to_neck(...);
// Description:
@ -946,6 +973,9 @@ function bottle_adapter_neck_to_neck(
// Module: sp_neck()
// Synopsis: Creates an SPI threaded bottle neck.
// Topics: Bottles, Threading
// See Also: sp_cap()
// Usage:
// sp_neck(diam, type, wall|id=, [style=], [bead=]) [ATTACHMENTS];
// Description:
@ -1146,6 +1176,9 @@ module sp_neck(diam,type,wall,id,style="L",bead=false, anchor, spin, orient)
// Module: sp_cap()
// Synopsis: Creates an SPI threaded bottle cap.
// Topics: Bottles, Threading
// See Also: sp_neck()
// Usage:
// sp_cap(diam, type, wall, [style=], [top_adj=], [bot_adj=], [texture=], [$slop]) [ATTACHMENTS];
// Description:
@ -1241,6 +1274,9 @@ module sp_cap(diam,type,wall,style="L",top_adj=0, bot_adj=0, texture="none", anc
// Function: sp_diameter()
// Synopsis: Returns the base diameter of an SPI bottle neck from the nominal diameter and type number.
// Topics: Bottles, Threading
// See Also: sp_neck(), sp_cap()
// Usage:
// true_diam = sp_diameter(diam,type)
// Description:

View File

@ -19,7 +19,6 @@ use <builtins.scad>
// Synopsis: Sets the color for attachable children and all their descendants.
// Topics: Attachments
// See Also: color_this(), hsl(), hsv()
//
// Usage:
// recolor([c]) CHILDREN;
// Description:
@ -48,7 +47,6 @@ module recolor(c="default")
// Synopsis: Sets the color for children at the current level only.
// Topics: Attachments
// See Also: recolor(), hsl(), hsv()
//
// Usage:
// color_this([c]) CHILDREN;
// Description:
@ -79,7 +77,6 @@ module color_this(c="default")
// Synopsis: Iterates through a list, displaying children in different colors.
// Topics: List Handling
// See Also: hsl(), hsv()
//
// Usage:
// rainbow(list,[stride],[maxhues],[shuffle],[seed]) CHILDREN;
// Description:
@ -121,7 +118,7 @@ module rainbow(list, stride=1, maxhues, shuffle=false, seed)
// Function&Module: hsl()
// Synopsis: Sets the color of children to a specified hue, saturation, lightness and optional alpha channel value.
// See Also: hsv(), recolor(), color_this()
//
// Topics: Colors, Colorspace
// Usage:
// hsl(h,[s],[l],[a]) CHILDREN;
// rgb = hsl(h,[s],[l],[a]);
@ -159,7 +156,7 @@ module hsl(h,s=1,l=0.5,a=1)
// Function&Module: hsv()
// Synopsis: Sets the color of children to a hue, saturation, value and optional alpha channel value.
// See Also: hsl(), recolor(), color_this()
//
// Topics: Colors, Colorspace
// Usage:
// hsv(h,[s],[v],[a]) CHILDREN;
// rgb = hsv(h,[s],[v],[a]);

View File

@ -12,6 +12,9 @@
// Section: List comparison operations
// Function: approx()
// Synopsis: Returns true if two values are equal to within a small epsilon value.
// Topics: Comparisons
// See Also: all_zero(), all_nonzero()
// Usage:
// test = approx(a, b, [eps])
// Description:
@ -44,6 +47,9 @@ function approx(a,b,eps=EPSILON) =
// Function: all_zero()
// Synopsis: Returns true if the value(s) given are aproximately zero.
// Topics: Comparisons, List Handling
// See Also: approx(), all_zero(), all_nonzero()
// Usage:
// x = all_zero(x, [eps]);
// Description:
@ -64,6 +70,9 @@ function all_zero(x, eps=EPSILON) =
// Function: all_nonzero()
// Synopsis: Returns true if the value(s) given are not aproximately zero.
// Topics: Comparisons, List Handling
// See Also: approx(), all_zero(), all_nonzero()
// Usage:
// test = all_nonzero(x, [eps]);
// Description:
@ -85,6 +94,9 @@ function all_nonzero(x, eps=EPSILON) =
// Function: all_positive()
// Synopsis: Returns true if the value(s) given are greater than zero.
// Topics: Comparisons, List Handling
// See Also: approx(), all_zero(), all_nonzero(), all_negative(), all_nonpositive(), all_nonnegative()
// Usage:
// test = all_positive(x,[eps]);
// Description:
@ -108,6 +120,9 @@ function all_positive(x,eps=0) =
// Function: all_negative()
// Synopsis: Returns true if the value(s) given are less than zero.
// Topics: Comparisons, List Handling
// See Also: approx(), all_zero(), all_nonzero(), all_positive(), all_nonpositive(), all_nonnegative()
// Usage:
// test = all_negative(x, [eps]);
// Description:
@ -132,6 +147,9 @@ function all_negative(x, eps=0) =
// Function: all_nonpositive()
// Synopsis: Returns true if the value(s) given are less than or equal to zero.
// Topics: Comparisons, List Handling
// See Also: approx(), all_zero(), all_nonzero(), all_positive(), all_negative(), all_nonpositive(), all_nonnegative()
// Usage:
// all_nonpositive(x, [eps]);
// Description:
@ -156,6 +174,9 @@ function all_nonpositive(x,eps=0) =
// Function: all_nonnegative()
// Synopsis: Returns true if the value(s) given are greater than or equal to zero.
// Topics: Comparisons, List Handling
// See Also: approx(), all_zero(), all_nonzero(), all_positive(), all_negative(), all_nonpositive(), all_nonnegative()
// Usage:
// all_nonnegative(x, [eps]);
// Description:
@ -181,6 +202,9 @@ function all_nonnegative(x,eps=0) =
// Function: all_equal()
// Synopsis: Returns true if all items in a list are approximately equal to each other.
// Topics: Comparisons, List Handling
// See Also: approx(), all_zero(), all_nonzero(), all_positive(), all_negative(), all_nonpositive(), all_nonnegative()
// Usage:
// b = all_equal(vec, [eps]);
// Description:
@ -195,6 +219,9 @@ function all_equal(vec,eps=0) =
// Function: are_ends_equal()
// Synopsis: Returns true if the first and last items in a list are approximately equal.
// Topics: Comparisons, List Handling
// See Also: approx(), all_zero(), all_nonzero(), all_positive(), all_negative(), all_nonpositive(), all_nonnegative()
// Usage:
// are_ends_equal(list, [eps]);
// Description:
@ -208,10 +235,11 @@ function are_ends_equal(list, eps=EPSILON) =
// Function: is_increasing()
// Synopsis: Returns true if exery item in a list is greater than the previous item.
// Topics: Comparisons, List Handling
// See Also: max_index(), min_index(), is_increasing(), is_decreasing()
// Usage:
// bool = is_increasing(list, [strict]);
// Topics: List Handling
// See Also: max_index(), min_index(), is_decreasing()
// Description:
// Returns true if the list is (non-strictly) increasing, or strictly increasing if strict is set to true.
// The list can be a list of any items that OpenSCAD can compare, or it can be a string which will be
@ -232,10 +260,11 @@ function is_increasing(list,strict=false) =
// Function: is_decreasing()
// Synopsis: Returns true if exery item in a list is less than the previous item.
// Topics: Comparisons, List Handling
// See Also: max_index(), min_index(), is_increasing(), is_decreasing()
// Usage:
// bool = is_decreasing(list, [strict]);
// Topics: List Handling
// See Also: max_index(), min_index(), is_increasing()
// Description:
// Returns true if the list is (non-strictly) decreasing, or strictly decreasing if strict is set to true.
// The list can be a list of any items that OpenSCAD can compare, or it can be a string which will be
@ -265,6 +294,9 @@ function _type_num(x) =
// Function: compare_vals()
// Synopsis: Compares two values, possibly of different type.
// Topics: Comparisons, List Handling
// See Also: approx(), is_increasing(), is_decreasing()
// Usage:
// test = compare_vals(a, b);
// Description:
@ -283,6 +315,9 @@ function compare_vals(a, b) =
// Function: compare_lists()
// Synopsis: Compares two lists of values, possibly of different type.
// Topics: Comparisons, List Handling
// See Also: compare_vals(), approx(), is_increasing(), is_decreasing()
// Usage:
// test = compare_lists(a, b)
// Description:
@ -310,11 +345,12 @@ function compare_lists(a, b) =
// Function: min_index()
// Synopsis: Returns the index of the minimal value in the given list.
// Topics: List Handling
// See Also: max_index(), is_increasing(), is_decreasing()
// Usage:
// idx = min_index(vals);
// idxlist = min_index(vals, all=true);
// Topics: List Handling
// See Also: max_index(), is_increasing(), is_decreasing()
// Description:
// Returns the index of the first occurrence of the minimum value in the given list.
// If `all` is true then returns a list of all indices where the minimum value occurs.
@ -330,11 +366,12 @@ function min_index(vals, all=false) =
// Function: max_index()
// Synopsis: Returns the index of the minimal value in the given list.
// Topics: List Handling
// See Also: min_index(), is_increasing(), is_decreasing()
// Usage:
// idx = max_index(vals);
// idxlist = max_index(vals, all=true);
// Topics: List Handling
// See Also: min_index(), is_increasing(), is_decreasing()
// Description:
// Returns the index of the first occurrence of the maximum value in the given list.
// If `all` is true then returns a list of all indices where the maximum value occurs.
@ -353,6 +390,7 @@ function max_index(vals, all=false) =
// Function: find_approx()
// Synopsis: Finds the indexes of the item(s) in the given list that are aproximately the given value.
// Topics: List Handling
// See Also: in_list()
// Usage:
@ -386,10 +424,11 @@ function __find_approx(val, list, eps, i=0) =
// Function: deduplicate()
// Usage:
// list = deduplicate(list, [closed], [eps]);
// Synopsis: Returns a list with all consecutive duplicate values removed.
// Topics: List Handling
// See Also: deduplicate_indexed()
// Usage:
// list = deduplicate(list, [closed], [eps]);
// Description:
// Removes consecutive duplicate items in a list.
// When `eps` is zero, the comparison between consecutive items is exact.
@ -419,10 +458,11 @@ function deduplicate(list, closed=false, eps=EPSILON) =
// Function: deduplicate_indexed()
// Usage:
// new_idxs = deduplicate_indexed(list, indices, [closed], [eps]);
// Synopsis: Takes a list of indices into a list of values, and returns a list of indices whose values are not consecutively the same.
// Topics: List Handling
// See Also: deduplicate()
// Usage:
// new_idxs = deduplicate_indexed(list, indices, [closed], [eps]);
// Description:
// Given a list, and a list of indices, removes consecutive indices corresponding to list values that are equal
// or approximately equal.
@ -465,6 +505,9 @@ function deduplicate_indexed(list, indices, closed=false, eps=EPSILON) =
// Function: list_wrap()
// Synopsis: Returns a list whose last value is the same as the first.
// Topics: List Handling, Paths
// See Also: list_unwrap(), deduplicate()
// Usage:
// list_wrap(path, [eps]);
// Description:
@ -474,7 +517,6 @@ function deduplicate_indexed(list, indices, closed=false, eps=EPSILON) =
// Arguments:
// list = list to unwrap
// eps = epsilon for comparison. Default: EPSILON (1e-9)
// See Also: list_unwrap(), deduplicate()
function list_wrap(list, eps=EPSILON) =
assert(is_list(list))
@ -490,6 +532,9 @@ function close_path(list,eps=EPSILON) =
list_wrap(list,eps);
// Function: list_unwrap()
// Synopsis: Removes the last item of a list if it's first and last values are equal.
// Topics: List Handling, Paths
// See Also: list_wrap(), deduplicate()
// Usage:
// list_unwrap(list, [eps]);
// Description:
@ -506,10 +551,11 @@ function list_unwrap(list, eps=EPSILON) =
// Function: unique()
// Usage:
// ulist = unique(list);
// Synopsis: Returns a sorted list with all duplicates removed.
// Topics: List Handling
// See Also: shuffle(), sort(), sortidx(), unique_count()
// Usage:
// ulist = unique(list);
// Description:
// Given a string or a list returns the sorted string or the sorted list with all repeated items removed.
// The sorting order of non homogeneous lists is the function `sort` order.
@ -548,10 +594,11 @@ function _unique_sort(l) =
// Function: unique_count()
// Usage:
// sorted_counts = unique_count(list);
// Synopsis: Returns a sorted list of unique items with counts.
// Topics: List Handling
// See Also: shuffle(), sort(), sortidx(), unique()
// Usage:
// sorted_counts = unique_count(list);
// Description:
// Returns `[sorted,counts]` where `sorted` is a sorted list of the unique items in `list` and `counts` is a list such
// that `count[i]` gives the number of times that `sorted[i]` appears in `list`.
@ -710,10 +757,11 @@ function _indexed_sort(arrind) =
// Function: sort()
// Usage:
// slist = sort(list, [idx]);
// Synopsis: Returns a sorted list.
// Topics: List Handling
// See Also: shuffle(), sortidx(), unique(), unique_count(), group_sort()
// Usage:
// slist = sort(list, [idx]);
// Description:
// Sorts the given list in lexicographic order. The sort is stable, meaning equivalent items will not change order.
// If the input is a homogeneous simple list or a homogeneous
@ -752,10 +800,11 @@ function sort(list, idx=undef) =
// Function: sortidx()
// Usage:
// idxlist = sortidx(list, [idx]);
// Synopsis: Returns a list of sorted indices into a list.
// Topics: List Handling
// See Also: shuffle(), sort(), group_sort(), unique(), unique_count()
// Usage:
// idxlist = sortidx(list, [idx]);
// Description:
// Given a list, sort it as function `sort()`, and returns
// a list of indexes into the original list in that sorted order.
@ -806,10 +855,11 @@ function sortidx(list, idx=undef) =
// Function: group_sort()
// Synopsis: Returns a sorted list of groups of values.
// Topics: List Handling
// See Also: group_data(), shuffle(), sort(), sortidx(), unique(), unique_count()
// Usage:
// ulist = group_sort(list,[idx]);
// Topics: List Handling
// See Also: shuffle(), sort(), sortidx(), unique(), unique_count()
// Description:
// Given a list of numbers, sorts the list into a sequence of lists, where each list contains any repeated values.
// If there are no repeated values the output will be a list of singleton lists.
@ -839,9 +889,11 @@ function group_sort(list, idx) =
// Function: group_data()
// Synopsis: Groups list data by integer group numbers.
// Topics: List Handling
// See Also: group_sort(), shuffle(), sort(), sortidx(), unique(), unique_count()
// Usage:
// groupings = group_data(groups, values);
// Topics: List Handling
// Description:
// Given a list of integer group numbers, and an equal-length list of values,
// returns a list of groups with the values sorted into the corresponding groups.
@ -877,6 +929,9 @@ function group_data(groups, values) =
// Function: list_smallest()
// Synopsis: Returns the `k` smallest values in the list, in arbitrary order.
// Topics: List Handling
// See Also: group_sort(), shuffle(), sort(), sortidx(), unique(), unique_count()
// Usage:
// small = list_smallest(list, k)
// Description:
@ -900,4 +955,6 @@ function list_smallest(list, k) =
let( bigger = [for(li=list) if(li>v) li ] )
concat(smaller, equal, list_smallest(bigger, k-len(smaller) -len(equal)));
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap

View File

@ -15,6 +15,8 @@ _UNDEF="LRG+HX7dy89RyHvDlAKvb9Y04OTuaikpx205CTh8BSI";
// Section: General Constants
// Constant: $slop
// Synopsis: The slop amount to make printed items fit closely. `0.0` by default.
// Topics: Constants
// Description:
// A number of printers, particularly FDM/FFF printers, tend to be a bit sloppy in their printing.
// This has made it so that some parts won't fit together without adding a bit of extra slop space.
@ -102,6 +104,9 @@ _UNDEF="LRG+HX7dy89RyHvDlAKvb9Y04OTuaikpx205CTh8BSI";
// }
// Function: get_slop()
// Synopsis: Returns the $slop value.
// Topics: Slop
// See Also: $slop
// Usage:
// slop = get_slop();
// Description:
@ -111,6 +116,8 @@ function get_slop() = is_undef($slop) ? 0 : $slop;
// Constant: INCH
// Synopsis: A constant containing the number of millimeters in an inch. `25.4`
// Topics: Constants
// Description:
// The number of millimeters in an inch.
// Example(2D):
@ -125,6 +132,7 @@ INCH = 25.4;
// Vectors useful for `rotate()`, `mirror()`, and `anchor` arguments for `cuboid()`, `cyl()`, etc.
// Constant: LEFT
// Synopsis: The left-wards (X-) direction vector constant `[-1,0,0]`.
// Topics: Constants, Vectors
// See Also: RIGHT, FRONT, BACK, UP, DOWN, CENTER
// Description: Vector pointing left. [-1,0,0]
@ -133,6 +141,7 @@ INCH = 25.4;
LEFT = [-1, 0, 0];
// Constant: RIGHT
// Synopsis: The right-wards (X+) direction vector constant `[1,0,0]`.
// Topics: Constants, Vectors
// See Also: LEFT, FRONT, BACK, UP, DOWN, CENTER
// Description: Vector pointing right. [1,0,0]
@ -142,6 +151,7 @@ RIGHT = [ 1, 0, 0];
// Constant: FRONT
// Aliases: FWD, FORWARD
// Synopsis: The front-wards (Y-) direction vector constant `[0,-1,0]`.
// Topics: Constants, Vectors
// See Also: LEFT, RIGHT, BACK, UP, DOWN, CENTER
// Description: Vector pointing forward. [0,-1,0]
@ -152,6 +162,7 @@ FWD = FRONT;
FORWARD = FRONT;
// Constant: BACK
// Synopsis: The back-wards (Y+) direction vector constant `[0,1,0]`.
// Topics: Constants, Vectors
// See Also: LEFT, RIGHT, FRONT, UP, DOWN, CENTER
// Description: Vector pointing back. [0,1,0]
@ -161,6 +172,7 @@ BACK = [ 0, 1, 0];
// Constant: BOTTOM
// Aliases: BOT, DOWN
// Synopsis: The down-wards (Z-) direction vector constant `[0,0,-1]`.
// Topics: Constants, Vectors
// See Also: LEFT, RIGHT, FRONT, BACK, UP, CENTER
// Description: Vector pointing down. [0,0,-1]
@ -172,6 +184,7 @@ DOWN = BOTTOM;
// Constant: TOP
// Aliases: UP
// Synopsis: The top-wards (Z+) direction vector constant `[0,0,1]`.
// Topics: Constants, Vectors
// See Also: LEFT, RIGHT, FRONT, BACK, DOWN, CENTER
// Description: Vector pointing up. [0,0,1]
@ -182,6 +195,7 @@ UP = TOP;
// Constant: CENTER
// Aliases: CTR, CENTRE
// Synopsis: The center vector constant `[0,0,0]`.
// Topics: Constants, Vectors
// See Also: LEFT, RIGHT, FRONT, BACK, UP, DOWN
// Description: Zero vector. Centered. [0,0,0]
@ -198,6 +212,7 @@ CENTRE = CENTER;
// with two endpoints.
// Constant: SEGMENT
// Synopsis: A constant for specifying a line segment in various geometry.scad functions. `[true,true]`
// Topics: Constants, Lines
// See Also: RAY, LINE
// Description: Treat a line as a segment. [true, true]
@ -209,6 +224,7 @@ SEGMENT = [true,true];
// Constant: RAY
// Synopsis: A constant for specifying a ray line in various geometry.scad functions. `[true,false]`
// Topics: Constants, Lines
// See Also: SEGMENT, LINE
// Description: Treat a line as a ray, based at the first point. [true, false]
@ -220,6 +236,7 @@ RAY = [true, false];
// Constant: LINE
// Synopsis: A constant for specifying an unbounded line in various geometry.scad functions. `[false,false]`
// Topics: Constants, Lines
// See Also: RAY, SEGMENT
// Description: Treat a line as an unbounded line. [false, false]
@ -231,6 +248,9 @@ LINE = [false, false];
// Constant: IDENT
// Synopsis: A constant containing the 3D identity transformation matrix.
// Topics: Affine, Matrices, Transforms
// See Also: ident()
// Description: Identity transformation matrix for three-dimensional transforms. Equal to `ident(4)`.
IDENT=ident(4);

View File

@ -16,85 +16,147 @@ $cubetruss_clip_thickness = 1.6;
// Section: Cube Trusses
// Function: cubetruss_dist()
// Module: cubetruss()
// Synopsis: Creates a multi-cube straight cubetruss shape.
// Topics: Trusses, CubeTruss, FDM Optimized, Parts
// See Also: cubetruss_segment(), cubetruss_support(), cubetruss(), cubetruss_corner()
// Usage:
// cubetruss_dist(cubes, gaps, [size], [strut]);
// cubetruss(extents, [clips], [bracing], [size], [strut], [clipthick]);
// Description:
// Function to calculate the length of a cubetruss truss.
// Arguments:
// cubes = The number of cubes along the truss's length.
// gaps = The number of extra strut widths to add in, corresponding to each time a truss butts up against another.
// size = The length of each side of the cubetruss cubes. Default: `$cubetruss_size` (usually 30)
// strut = The width of the struts on the cubetruss cubes. Default: `$cubetruss_strut_size` (usually 3)
// Topics: Trusses
function cubetruss_dist(cubes=0, gaps=0, size, strut) =
let(
size = is_undef(size)? $cubetruss_size : size,
strut = is_undef(strut)? $cubetruss_strut_size : strut
) cubes*(size-strut)+gaps*strut;
// Module: cubetruss_segment()
// Usage:
// cubetruss_segment([size], [strut], [bracing]);
// Description:
// Creates a single cubetruss cube segment.
// Creates a cubetruss truss, assembled out of one or more cubical segments.
// Arguments:
// extents = The number of cubes in length to make the truss. If given as a [X,Y,Z] vector, specifies the number of cubes in each dimension.
// clips = List of vectors pointing towards the sides to add clips to.
// size = The length of each side of the cubetruss cubes. Default: `$cubetruss_size` (usually 30)
// strut = The width of the struts on the cubetruss cubes. Default: `$cubetruss_strut_size` (usually 3)
// bracing = If true, adds internal cross-braces. Default: `$cubetruss_bracing` (usually true)
// clipthick = The thickness of the clips. Default: `$cubetruss_clip_thickness` (usually 1.6)
// ---
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards. See [orient](attachments.scad#subsection-orient). Default: `UP`
// Topics: Attachable, Trusses
// Examples:
// cubetruss_segment(bracing=false);
// cubetruss_segment(bracing=true);
// cubetruss_segment(strut=4);
// cubetruss_segment(size=40);
module cubetruss_segment(size, strut, bracing, anchor=CENTER, spin=0, orient=UP) {
// cubetruss(extents=3);
// cubetruss(extents=3, clips=FRONT);
// cubetruss(extents=3, clips=[FRONT,BACK]);
// cubetruss(extents=[2,3]);
// cubetruss(extents=[1,4,2]);
// cubetruss(extents=[1,4,2], bracing=false);
module cubetruss(extents=6, clips=[], bracing, size, strut, clipthick, anchor=CENTER, spin=0, orient=UP) {
clips = is_vector(clips)? [clips] : clips;
size = is_undef(size)? $cubetruss_size : size;
strut = is_undef(strut)? $cubetruss_strut_size : strut;
bracing = is_undef(bracing)? $cubetruss_bracing : bracing;
h = size;
crossthick = strut/sqrt(2);
voffset = 0.333;
attachable(anchor,spin,orient, size=[size,size,size]) {
render(convexity=10)
clipthick = is_undef(clipthick)? $cubetruss_clip_thickness : clipthick;
extents = is_vector(extents)? point3d(extents,fill=1) : [1,extents,1];
w = extents[0];
l = extents[1];
h = extents[2];
s = [cubetruss_dist(w,1), cubetruss_dist(l,1), cubetruss_dist(h,1)];
attachable(anchor,spin,orient, size=s) {
union() {
difference() {
// Start with a cube.
cube([size, size, h], center=true);
cube([size-strut*2, size-strut*2, h-strut*2], center=true);
// Hollow out octogons in X and Y axes.
zrot_copies([0,90]) {
xrot(90) zrot(180/8) cylinder(h=max(h,size)+1, d=(min(h,size)-2*strut)/cos(180/8), center=true, $fn=8);
}
// Hollow out octogon vertically.
zrot(180/8) cylinder(h=max(h,size)+1, d=(min(h,size)-2*strut)/cos(180/8), center=true, $fn=8);
}
// Interior cross-supports
if (bracing) {
for (i = [-1,1]) {
zrot(i*45) {
difference() {
cube([crossthick, (size-strut)*sqrt(2), h], center=true);
up(i*voffset) {
yscale(1.3) {
yrot(90) {
zrot(180/6) {
cylinder(h=crossthick+1, d=(min(h,size)-2*strut)/cos(180/6)-2*voffset, center=true, $fn=6);
for (zrow = [0:h-1]) {
up((zrow-(h-1)/2)*(size-strut)) {
for (xcol = [0:w-1]) {
right((xcol-(w-1)/2)*(size-strut)) {
for (ycol = [0:l-1]) {
back((ycol-(l-1)/2)*(size-strut)) {
cubetruss_segment(size=size, strut=strut, bracing=bracing);
}
}
}
}
}
}
if (clipthick > 0) {
for (vec = clips) {
exts = v_abs(rot(from=FWD, to=vec, p=extents));
rot(from=FWD,to=vec) {
for (zrow = [0:1:exts.z-1]) {
up((zrow-(exts.z-1)/2)*(size-strut)) {
fwd((exts.y*(size-strut)+strut)/2) {
cubetruss_clip(size=size, strut=strut, extents=exts.x, clipthick=clipthick);
}
}
}
}
}
}
}
children();
}
}
// Module: cubetruss_corner()
// Synopsis: Creates a multi-cube corner cubetruss shape.
// Topics: Trusses, CubeTruss, FDM Optimized, Parts
// See Also: cubetruss_segment(), cubetruss_support(), cubetruss(), cubetruss_corner()
// Usage:
// cubetruss_corner(h, extents, [bracing], [size], [strut], [clipthick]);
// Description:
// Creates a corner cubetruss with extents jutting out in one or more directions.
// Arguments:
// h = The number of cubes high to make the base and horizontal extents.
// extents = The number of cubes to extend beyond the corner. If given as a vector of cube counts, gives the number of cubes to extend right, back, left, front, and up in order. If the vector is shorter than length 5 the extra cube counts are taken to be zero.
// size = The length of each side of the cubetruss cubes. Default: `$cubetruss_size` (usually 30)
// strut = The width of the struts on the cubetruss cubes. Default: `$cubetruss_strut_size` (usually 3)
// bracing = If true, adds internal cross-braces. Default: `$cubetruss_bracing` (usually true)
// clipthick = The thickness of the clips. Default: `$cubetruss_clip_thickness` (usually 1.6)
// ---
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards. See [orient](attachments.scad#subsection-orient). Default: `UP`
// Topics: Attachable, Trusses
// Examples:
// cubetruss_corner(extents=2);
// cubetruss_corner(extents=2, h=2);
// cubetruss_corner(extents=[3,3,0,0,2]);
// cubetruss_corner(extents=[3,0,3,0,2]);
// cubetruss_corner(extents=[3,3,3,3,2]);
module cubetruss_corner(h=1, extents=[1,1,0,0,1], bracing, size, strut, clipthick, anchor=CENTER, spin=0, orient=UP) {
size = is_undef(size)? $cubetruss_size : size;
strut = is_undef(strut)? $cubetruss_strut_size : strut;
bracing = is_undef(bracing)? $cubetruss_bracing : bracing;
clipthick = is_undef(clipthick)? $cubetruss_clip_thickness : clipthick;
exts = is_vector(extents)? list_pad(extents,5,fill=0) : [extents, extents, 0, 0, extents];
dummy = assert(len(exts)==5, "Input extents must be a scalar or vector with length 5 or less.");
s = [cubetruss_dist(exts[0]+1+exts[2],1), cubetruss_dist(exts[1]+1+exts[3],1), cubetruss_dist(h+exts[4],1)];
offset = [cubetruss_dist(exts[0]-exts[2],0), cubetruss_dist(exts[1]-exts[3],0), cubetruss_dist(h+exts[4]-1,0)]/2;
attachable(anchor,spin,orient, size=s, offset=offset) {
union() {
for (zcol = [0:h-1]) {
up((size-strut)*zcol) {
cubetruss_segment(size=size, strut=strut, bracing=bracing);
}
}
for (dir = [0:3]) {
if (exts[dir] != undef && exts[dir] > 0) {
zrot(dir*90) {
for (zcol = [0:h-1]) {
up((size-strut+0.01)*zcol) {
for (i = [1:exts[dir]]) {
right((size-strut+0.01)*i) cubetruss_segment(size=size, strut=strut, bracing=bracing);
}
if (clipthick > 0) {
right(exts[dir]*(size-strut)+size/2) {
zrot(90) cubetruss_clip(size=size, strut=strut, clipthick=clipthick);
}
}
}
}
}
}
}
if (exts[4] != undef && exts[4] > 0) {
for (i = [1:exts[4]]) {
up((size-strut+0.01)*(i+h-1)) cubetruss_segment(size=size, strut=strut, bracing=bracing);
}
if (clipthick > 0) {
up((exts[4]+h-1)*(size-strut)+size/2) {
xrot(-90) cubetruss_clip(size=size, strut=strut, clipthick=clipthick);
}
}
}
}
@ -104,6 +166,9 @@ module cubetruss_segment(size, strut, bracing, anchor=CENTER, spin=0, orient=UP)
// Module: cubetruss_support()
// Synopsis: Creates a cubetruss support structure shape.
// Topics: Trusses, CubeTruss, FDM Optimized, Parts
// See Also: cubetruss_segment(), cubetruss_support(), cubetruss(), cubetruss_corner()
// Usage:
// cubetruss_support([size], [strut], [extents], [anchor], [spin], [orient]) [ATTACHMENTS];
// Description:
@ -164,72 +229,13 @@ module cubetruss_support(size, strut, extents=1, anchor=CENTER, spin=0, orient=U
}
// Module: cubetruss_clip()
// Usage:
// cubetruss_clip(extents, [size], [strut], [clipthick], [$slop=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
// Creates a pair of clips to add onto the end of a truss.
// Arguments:
// extents = How many cubes to separate the clips by.
// size = The length of each side of the cubetruss cubes. Default: `$cubetruss_size` (usually 30)
// strut = The width of the struts on the cubetruss cubes. Default: `$cubetruss_strut_size` (usually 3)
// clipthick = The thickness of the clip. Default: `$cubetruss_clip_thickness` (usually 1.6)
// ---
// $slop = allowance for printer overextrusion
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards. See [orient](attachments.scad#subsection-orient). Default: `UP`
// Topics: Attachable, Trusses
// Examples:
// cubetruss_clip(extents=2);
// cubetruss_clip(extents=1);
// cubetruss_clip(clipthick=2.5);
module cubetruss_clip(extents=1, size, strut, clipthick, anchor=CENTER, spin=0, orient=UP) {
size = is_undef(size)? $cubetruss_size : size;
strut = is_undef(strut)? $cubetruss_strut_size : strut;
clipthick = is_undef(clipthick)? $cubetruss_clip_thickness : clipthick;
cliplen = strut * 2.6;
clipheight = min(size+strut, size/3+2*strut*2.6);
clipsize = 0.5;
s = [extents*(size-strut)+strut+2*clipthick, strut*2, clipheight-2*strut];
attachable(anchor,spin,orient, size=s) {
xflip_copy(offset=(extents*(size-strut)+strut)/2) {
difference() {
union() {
difference() {
right(clipthick/2-0.01) {
back(strut) {
difference() {
xrot(90) prismoid([clipthick, clipheight], [clipthick, clipheight-cliplen*2], h=cliplen);
right(clipthick/2) chamfer_edge_mask(l=clipheight+0.1, chamfer=clipthick);
}
}
}
fwd(strut*3/2) {
cube([get_slop(), strut*3, size], center=true);
}
}
right(get_slop()/2+0.01) {
fwd(strut*1.25+get_slop()) {
yrot(-90) prismoid([clipheight-cliplen*2, strut/2], [clipheight-cliplen*2-2*clipsize, strut/2], h=clipsize+0.01);
}
}
}
fwd(strut*1.6) {
left(clipsize) {
yscale(1.5) chamfer_edge_mask(l=size+1, chamfer=clipsize+clipthick/3);
}
}
zcopies(clipheight-strut) cube([clipthick*3, cliplen*2, strut], center=true);
zcopies(clipheight-2*strut) right(clipthick) chamfer_edge_mask(l=cliplen*2, chamfer=clipthick, orient=BACK);
}
}
children();
}
}
// Section: Cubetruss Support
// Module: cubetruss_foot()
// Synopsis: Creates a foot that can connect two cubetrusses.
// Topics: Trusses, CubeTruss, FDM Optimized, Parts
// See Also: cubetruss_segment(), cubetruss_support(), cubetruss(), cubetruss_corner()
// Usage:
// cubetruss_foot(w, [size], [strut], [clipthick], [$slop=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
@ -307,6 +313,9 @@ module cubetruss_foot(w=1, size, strut, clipthick, anchor=CENTER, spin=0, orient
// Module: cubetruss_joiner()
// Synopsis: Creates a joiner that can connect two cubetrusses end-to-end.
// Topics: Trusses, CubeTruss, FDM Optimized, Parts
// See Also: cubetruss_segment(), cubetruss_support(), cubetruss(), cubetruss_corner()
// Usage:
// cubetruss_joiner([w], [vert], [size], [strut], [clipthick], [$slop=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
@ -375,6 +384,9 @@ module cubetruss_joiner(w=1, vert=true, size, strut, clipthick, anchor=CENTER, s
// Module: cubetruss_uclip()
// Synopsis: Creates a joiner that can connect two cubetrusses end-to-end.
// Topics: Trusses, CubeTruss, FDM Optimized, Parts
// See Also: cubetruss_segment(), cubetruss_support(), cubetruss(), cubetruss_corner()
// Usage:
// cubetruss_uclip(dual, [size], [strut], [clipthick], [$slop=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
@ -420,69 +432,142 @@ module cubetruss_uclip(dual=true, size, strut, clipthick, anchor=CENTER, spin=0,
}
// Module: cubetruss()
// Section: Cubetruss Primitives
// Module: cubetruss_segment()
// Synopsis: Creates a single cubetruss cube.
// Topics: Trusses, CubeTruss, FDM Optimized, Parts
// See Also: cubetruss_segment(), cubetruss_support(), cubetruss(), cubetruss_corner()
// Usage:
// cubetruss(extents, [clips], [bracing], [size], [strut], [clipthick]);
// cubetruss_segment([size], [strut], [bracing]);
// Description:
// Creates a cubetruss truss, assembled out of one or more cubical segments.
// Creates a single cubetruss cube segment.
// Arguments:
// extents = The number of cubes in length to make the truss. If given as a [X,Y,Z] vector, specifies the number of cubes in each dimension.
// clips = List of vectors pointing towards the sides to add clips to.
// size = The length of each side of the cubetruss cubes. Default: `$cubetruss_size` (usually 30)
// strut = The width of the struts on the cubetruss cubes. Default: `$cubetruss_strut_size` (usually 3)
// bracing = If true, adds internal cross-braces. Default: `$cubetruss_bracing` (usually true)
// clipthick = The thickness of the clips. Default: `$cubetruss_clip_thickness` (usually 1.6)
// ---
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards. See [orient](attachments.scad#subsection-orient). Default: `UP`
// Topics: Attachable, Trusses
// Examples:
// cubetruss(extents=3);
// cubetruss(extents=3, clips=FRONT);
// cubetruss(extents=3, clips=[FRONT,BACK]);
// cubetruss(extents=[2,3]);
// cubetruss(extents=[1,4,2]);
// cubetruss(extents=[1,4,2], bracing=false);
module cubetruss(extents=6, clips=[], bracing, size, strut, clipthick, anchor=CENTER, spin=0, orient=UP) {
clips = is_vector(clips)? [clips] : clips;
// cubetruss_segment(bracing=false);
// cubetruss_segment(bracing=true);
// cubetruss_segment(strut=4);
// cubetruss_segment(size=40);
module cubetruss_segment(size, strut, bracing, anchor=CENTER, spin=0, orient=UP) {
size = is_undef(size)? $cubetruss_size : size;
strut = is_undef(strut)? $cubetruss_strut_size : strut;
bracing = is_undef(bracing)? $cubetruss_bracing : bracing;
h = size;
crossthick = strut/sqrt(2);
voffset = 0.333;
attachable(anchor,spin,orient, size=[size,size,size]) {
render(convexity=10)
union() {
difference() {
// Start with a cube.
cube([size, size, h], center=true);
cube([size-strut*2, size-strut*2, h-strut*2], center=true);
// Hollow out octogons in X and Y axes.
zrot_copies([0,90]) {
xrot(90) zrot(180/8) cylinder(h=max(h,size)+1, d=(min(h,size)-2*strut)/cos(180/8), center=true, $fn=8);
}
// Hollow out octogon vertically.
zrot(180/8) cylinder(h=max(h,size)+1, d=(min(h,size)-2*strut)/cos(180/8), center=true, $fn=8);
}
// Interior cross-supports
if (bracing) {
for (i = [-1,1]) {
zrot(i*45) {
difference() {
cube([crossthick, (size-strut)*sqrt(2), h], center=true);
up(i*voffset) {
yscale(1.3) {
yrot(90) {
zrot(180/6) {
cylinder(h=crossthick+1, d=(min(h,size)-2*strut)/cos(180/6)-2*voffset, center=true, $fn=6);
}
}
}
}
}
}
}
}
}
children();
}
}
// Module: cubetruss_clip()
// Synopsis: Creates a clip for the end of a cubetruss to snap-lock it to another cubetruss.
// Topics: Trusses, CubeTruss, FDM Optimized, Parts
// See Also: cubetruss_segment(), cubetruss_support(), cubetruss(), cubetruss_corner()
// Usage:
// cubetruss_clip(extents, [size], [strut], [clipthick], [$slop=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
// Creates a pair of clips to add onto the end of a truss.
// Arguments:
// extents = How many cubes to separate the clips by.
// size = The length of each side of the cubetruss cubes. Default: `$cubetruss_size` (usually 30)
// strut = The width of the struts on the cubetruss cubes. Default: `$cubetruss_strut_size` (usually 3)
// clipthick = The thickness of the clip. Default: `$cubetruss_clip_thickness` (usually 1.6)
// ---
// $slop = allowance for printer overextrusion
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards. See [orient](attachments.scad#subsection-orient). Default: `UP`
// Topics: Attachable, Trusses
// Examples:
// cubetruss_clip(extents=2);
// cubetruss_clip(extents=1);
// cubetruss_clip(clipthick=2.5);
module cubetruss_clip(extents=1, size, strut, clipthick, anchor=CENTER, spin=0, orient=UP) {
size = is_undef(size)? $cubetruss_size : size;
strut = is_undef(strut)? $cubetruss_strut_size : strut;
clipthick = is_undef(clipthick)? $cubetruss_clip_thickness : clipthick;
extents = is_vector(extents)? point3d(extents,fill=1) : [1,extents,1];
w = extents[0];
l = extents[1];
h = extents[2];
s = [cubetruss_dist(w,1), cubetruss_dist(l,1), cubetruss_dist(h,1)];
cliplen = strut * 2.6;
clipheight = min(size+strut, size/3+2*strut*2.6);
clipsize = 0.5;
s = [extents*(size-strut)+strut+2*clipthick, strut*2, clipheight-2*strut];
attachable(anchor,spin,orient, size=s) {
xflip_copy(offset=(extents*(size-strut)+strut)/2) {
difference() {
union() {
for (zrow = [0:h-1]) {
up((zrow-(h-1)/2)*(size-strut)) {
for (xcol = [0:w-1]) {
right((xcol-(w-1)/2)*(size-strut)) {
for (ycol = [0:l-1]) {
back((ycol-(l-1)/2)*(size-strut)) {
cubetruss_segment(size=size, strut=strut, bracing=bracing);
difference() {
right(clipthick/2-0.01) {
back(strut) {
difference() {
xrot(90) prismoid([clipthick, clipheight], [clipthick, clipheight-cliplen*2], h=cliplen);
right(clipthick/2) chamfer_edge_mask(l=clipheight+0.1, chamfer=clipthick);
}
}
}
fwd(strut*3/2) {
cube([get_slop(), strut*3, size], center=true);
}
}
right(get_slop()/2+0.01) {
fwd(strut*1.25+get_slop()) {
yrot(-90) prismoid([clipheight-cliplen*2, strut/2], [clipheight-cliplen*2-2*clipsize, strut/2], h=clipsize+0.01);
}
}
}
if (clipthick > 0) {
for (vec = clips) {
exts = v_abs(rot(from=FWD, to=vec, p=extents));
rot(from=FWD,to=vec) {
for (zrow = [0:1:exts.z-1]) {
up((zrow-(exts.z-1)/2)*(size-strut)) {
fwd((exts.y*(size-strut)+strut)/2) {
cubetruss_clip(size=size, strut=strut, extents=exts.x, clipthick=clipthick);
}
}
}
fwd(strut*1.6) {
left(clipsize) {
yscale(1.5) chamfer_edge_mask(l=size+1, chamfer=clipsize+clipthick/3);
}
}
zcopies(clipheight-strut) cube([clipthick*3, cliplen*2, strut], center=true);
zcopies(clipheight-2*strut) right(clipthick) chamfer_edge_mask(l=cliplen*2, chamfer=clipthick, orient=BACK);
}
}
children();
@ -490,77 +575,25 @@ module cubetruss(extents=6, clips=[], bracing, size, strut, clipthick, anchor=CE
}
// Module: cubetruss_corner()
// Function: cubetruss_dist()
// Synopsis: Returns the length of a cubetruss truss.
// Topics: Trusses, CubeTruss, FDM Optimized, Parts
// See Also: cubetruss_segment(), cubetruss_support(), cubetruss(), cubetruss_corner()
// Usage:
// cubetruss_corner(h, extents, [bracing], [size], [strut], [clipthick]);
// cubetruss_dist(cubes, gaps, [size], [strut]);
// Description:
// Creates a corner cubetruss with extents jutting out in one or more directions.
// Function to calculate the length of a cubetruss truss.
// Arguments:
// h = The number of cubes high to make the base and horizontal extents.
// extents = The number of cubes to extend beyond the corner. If given as a vector of cube counts, gives the number of cubes to extend right, back, left, front, and up in order. If the vector is shorter than length 5 the extra cube counts are taken to be zero.
// cubes = The number of cubes along the truss's length.
// gaps = The number of extra strut widths to add in, corresponding to each time a truss butts up against another.
// size = The length of each side of the cubetruss cubes. Default: `$cubetruss_size` (usually 30)
// strut = The width of the struts on the cubetruss cubes. Default: `$cubetruss_strut_size` (usually 3)
// bracing = If true, adds internal cross-braces. Default: `$cubetruss_bracing` (usually true)
// clipthick = The thickness of the clips. Default: `$cubetruss_clip_thickness` (usually 1.6)
// ---
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards. See [orient](attachments.scad#subsection-orient). Default: `UP`
// Topics: Attachable, Trusses
// Examples:
// cubetruss_corner(extents=2);
// cubetruss_corner(extents=2, h=2);
// cubetruss_corner(extents=[3,3,0,0,2]);
// cubetruss_corner(extents=[3,0,3,0,2]);
// cubetruss_corner(extents=[3,3,3,3,2]);
module cubetruss_corner(h=1, extents=[1,1,0,0,1], bracing, size, strut, clipthick, anchor=CENTER, spin=0, orient=UP) {
size = is_undef(size)? $cubetruss_size : size;
strut = is_undef(strut)? $cubetruss_strut_size : strut;
bracing = is_undef(bracing)? $cubetruss_bracing : bracing;
clipthick = is_undef(clipthick)? $cubetruss_clip_thickness : clipthick;
exts = is_vector(extents)? list_pad(extents,5,fill=0) : [extents, extents, 0, 0, extents];
dummy = assert(len(exts)==5, "Input extents must be a scalar or vector with length 5 or less.");
s = [cubetruss_dist(exts[0]+1+exts[2],1), cubetruss_dist(exts[1]+1+exts[3],1), cubetruss_dist(h+exts[4],1)];
offset = [cubetruss_dist(exts[0]-exts[2],0), cubetruss_dist(exts[1]-exts[3],0), cubetruss_dist(h+exts[4]-1,0)]/2;
attachable(anchor,spin,orient, size=s, offset=offset) {
union() {
for (zcol = [0:h-1]) {
up((size-strut)*zcol) {
cubetruss_segment(size=size, strut=strut, bracing=bracing);
}
}
for (dir = [0:3]) {
if (exts[dir] != undef && exts[dir] > 0) {
zrot(dir*90) {
for (zcol = [0:h-1]) {
up((size-strut+0.01)*zcol) {
for (i = [1:exts[dir]]) {
right((size-strut+0.01)*i) cubetruss_segment(size=size, strut=strut, bracing=bracing);
}
if (clipthick > 0) {
right(exts[dir]*(size-strut)+size/2) {
zrot(90) cubetruss_clip(size=size, strut=strut, clipthick=clipthick);
}
}
}
}
}
}
}
if (exts[4] != undef && exts[4] > 0) {
for (i = [1:exts[4]]) {
up((size-strut+0.01)*(i+h-1)) cubetruss_segment(size=size, strut=strut, bracing=bracing);
}
if (clipthick > 0) {
up((exts[4]+h-1)*(size-strut)+size/2) {
xrot(-90) cubetruss_clip(size=size, strut=strut, clipthick=clipthick);
}
}
}
}
children();
}
}
// Topics: Trusses
function cubetruss_dist(cubes=0, gaps=0, size, strut) =
let(
size = is_undef(size)? $cubetruss_size : size,
strut = is_undef(strut)? $cubetruss_strut_size : strut
) cubes*(size-strut)+gaps*strut;

View File

@ -10,7 +10,6 @@
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////
// Section: Adaptive Children Using `$` Variables
// The distributor methods create multiple copies of their children and place them in various ways. While many models
// require multiple identical copies of an object, this framework is more powerful than
@ -92,8 +91,10 @@
// Section: Translating copies of all the children
//////////////////////////////////////////////////////////////////////
// Function&Module: move_copies()
// Synopsis: Translates copies of all children.
// Topics: Transformations, Distributors, Translation, Copiers
// See Also: xcopies(), ycopies(), zcopies(), line_copies(), grid_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Usage:
// move_copies(a) CHILDREN;
@ -101,9 +102,6 @@
// copies = move_copies(a, p=);
// Usage: Get Translation Matrices
// mats = move_copies(a);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module, translates copies of all children to each given translation offset.
// When called as a function, with no `p=` argument, returns a list of transformation matrices, one for each copy.
@ -118,7 +116,6 @@
// `$pos` is set to the relative centerpoint of each child copy, and can be used to modify each child individually.
// `$idx` is set to the index number of each child being copied.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example:
// #sphere(r=10);
@ -147,6 +144,9 @@ function move_copies(a=[[0,0,0]],p=_NO_ARG) =
// Function&Module: xcopies()
// Synopsis: Places copies of children along the X axis.
// Topics: Transformations, Distributors, Translation, Copiers
// See Also: move_copies(), ycopies(), zcopies(), line_copies(), grid_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Usage:
// xcopies(spacing, [n], [sp]) CHILDREN;
@ -160,9 +160,6 @@ function move_copies(a=[[0,0,0]],p=_NO_ARG) =
// mats = xcopies(spacing, [n], [sp]);
// mats = xcopies(l, [n], [sp]);
// mats = xcopies(LIST);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module, places `n` copies of the children along a line on the X axis.
// When called as a function, *without* a `p=` argument, returns a list of transformation matrices, one for each copy.
@ -180,7 +177,6 @@ function move_copies(a=[[0,0,0]],p=_NO_ARG) =
// `$pos` is set to the relative centerpoint of each child copy, and can be used to modify each child individually.
// `$idx` is set to the index number of each child being copied.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Examples:
// xcopies(20) sphere(3);
@ -233,6 +229,9 @@ function xcopies(spacing, n, l, sp, p=_NO_ARG) =
// Function&Module: ycopies()
// Synopsis: Places copies of children along the Y axis.
// Topics: Transformations, Distributors, Translation, Copiers
// See Also: move_copies(), xcopies(), zcopies(), line_copies(), grid_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Usage:
// ycopies(spacing, [n], [sp]) CHILDREN;
@ -246,9 +245,6 @@ function xcopies(spacing, n, l, sp, p=_NO_ARG) =
// mats = ycopies(spacing, [n], [sp]);
// mats = ycopies(l, [n], [sp]);
// mats = ycopies(LIST);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module, places `n` copies of the children along a line on the Y axis.
// When called as a function, *without* a `p=` argument, returns a list of transformation matrices, one for each copy.
@ -266,7 +262,6 @@ function xcopies(spacing, n, l, sp, p=_NO_ARG) =
// `$pos` is set to the relative centerpoint of each child copy, and can be used to modify each child individually.
// `$idx` is set to the index number of each child being copied.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Examples:
// ycopies(20) sphere(3);
@ -319,6 +314,9 @@ function ycopies(spacing, n, l, sp, p=_NO_ARG) =
// Function&Module: zcopies()
// Synopsis: Places copies of children along the Z axis.
// Topics: Transformations, Distributors, Translation, Copiers
// See Also: move_copies(), xcopies(), ycopies(), line_copies(), grid_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Usage:
// zcopies(spacing, [n], [sp]) CHILDREN;
@ -332,9 +330,6 @@ function ycopies(spacing, n, l, sp, p=_NO_ARG) =
// mats = zcopies(spacing, [n], [sp]);
// mats = zcopies(l, [n], [sp]);
// mats = zcopies(LIST);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module, places `n` copies of the children along a line on the Z axis.
// When called as a function, *without* a `p=` argument, returns a list of transformation matrices, one for each copy.
@ -352,7 +347,6 @@ function ycopies(spacing, n, l, sp, p=_NO_ARG) =
// `$pos` is set to the relative centerpoint of each child copy, and can be used to modify each child individually.
// `$idx` is set to the index number of each child being copied.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Examples:
// zcopies(20) sphere(3);
@ -420,6 +414,9 @@ function zcopies(spacing, n, l, sp, p=_NO_ARG) =
// Function&Module: line_copies()
// Synopsis: Places copies of children along an arbitrary line.
// Topics: Transformations, Distributors, Translation, Copiers
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Usage: Place `n` copies at a given spacing along the line
// line_copies(spacing, [n], [p1=]) CHILDREN;
@ -443,9 +440,6 @@ function zcopies(spacing, n, l, sp, p=_NO_ARG) =
// mats = line_copies([n=], [l=], [p1=]);
// mats = line_copies([n=], [p1=], [p2=]);
// mats = line_copies([spacing], [p1=], [p2=]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a function, *without* a `p=` argument, returns a list of transformation matrices, one for each copy.
// When called as a function, *with* a `p=` argument, returns a list of transformed copies of `p=`.
@ -479,7 +473,6 @@ function zcopies(spacing, n, l, sp, p=_NO_ARG) =
// `$pos` is set to the relative centerpoint of each child copy, and can be used to modify each child individually.
// `$idx` is set to the index number of each child being copied.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Examples:
// line_copies(10) sphere(d=1.5);
@ -554,6 +547,9 @@ function line_copies(spacing, n, l, p1, p2, p=_NO_ARG) =
// Function&Module: grid_copies()
// Synopsis: Places copies of children in an [X,Y] grid.
// Topics: Transformations, Distributors, Translation, Copiers
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Usage:
// grid_copies(spacing, size=, [stagger=], [scale=], [inside=]) CHILDREN;
@ -570,9 +566,6 @@ function line_copies(spacing, n, l, p1, p2, p=_NO_ARG) =
// mats = grid_copies(n=, size=, [stagger=], [scale=], [inside=]);
// mats = grid_copies(spacing, [n], [stagger=], [scale=], [inside=]);
// mats = grid_copies(n=, inside=, [stagger], [scale]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module, makes a square or hexagonal grid of copies of children, with an optional masking polygon or region.
// When called as a function, *without* a `p=` argument, returns a list of transformation matrices, one for each copy.
@ -593,7 +586,6 @@ function line_copies(spacing, n, l, p1, p2, p=_NO_ARG) =
// `$col` is set to the integer column number for each child.
// `$row` is set to the integer row number for each child.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Examples:
// grid_copies(size=50, spacing=10) cylinder(d=10, h=1);
@ -777,8 +769,10 @@ function grid_copies(spacing, n, size, stagger=false, inside=undef, nonzero, p=_
// Section: Rotating copies of all children
//////////////////////////////////////////////////////////////////////
// Function&Module: rot_copies()
// Synopsis: Rotates copies of children.
// Topics: Transformations, Distributors, Rotation, Copiers
// See Also: rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies(), move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), grid_copies()
//
// Usage:
// rot_copies(rots, [cp=], [sa=], [delta=], [subrot=]) CHILDREN;
@ -792,9 +786,6 @@ function grid_copies(spacing, n, size, stagger=false, inside=undef, nonzero, p=_
// mats = rot_copies(rots, [cp=], [sa=], [delta=], [subrot=]);
// mats = rot_copies(rots, v, [cp=], [sa=], [delta=], [subrot=]);
// mats = rot_copies(n=, [v=], [cp=], [sa=], [delta=], [subrot=]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module:
// - Given a list of [X,Y,Z] rotation angles in `rots`, rotates copies of the children to each of those angles, regardless of axis of rotation.
@ -824,7 +815,6 @@ function grid_copies(spacing, n, size, stagger=false, inside=undef, nonzero, p=_
// `$idx` is set to the index value of each child copy.
// `$axis` is set to the axis to rotate around, if `rots` was given as a list of angles instead of a list of [X,Y,Z] rotation angles.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example:
// #cylinder(h=20, r1=5, r2=0);
@ -904,6 +894,9 @@ function rot_copies(rots=[], v, cp=[0,0,0], n, sa=0, offset=0, delta=[0,0,0], su
// Function&Module: xrot_copies()
// Synopsis: Rotates copies of children around the X axis.
// Topics: Transformations, Distributors, Rotation, Copiers
// See Also: rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies(), move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), grid_copies()
//
// Usage:
// xrot_copies(rots, [cp], [r=|d=], [sa=], [subrot=]) CHILDREN;
@ -914,9 +907,6 @@ function rot_copies(rots=[], v, cp=[0,0,0], n, sa=0, offset=0, delta=[0,0,0], su
// Usage: Get Translation Matrices
// mats = xrot_copies(rots, [cp], [r=|d=], [sa=], [subrot=]);
// mats = xrot_copies(n=, [cp=], [r=|d=], [sa=], [subrot=]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module:
// - Given an array of angles, rotates copies of the children to each of those angles around the X axis.
@ -944,7 +934,6 @@ function rot_copies(rots=[], v, cp=[0,0,0], n, sa=0, offset=0, delta=[0,0,0], su
// `$ang` is set to the rotation angle of each child copy, and can be used to modify each child individually.
// `$axis` is set to the axis vector rotated around.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example:
// xrot_copies([180, 270, 315])
@ -984,6 +973,9 @@ function xrot_copies(rots=[], cp=[0,0,0], n, sa=0, r, d, subrot=true, p=_NO_ARG)
// Function&Module: yrot_copies()
// Synopsis: Rotates copies of children around the Y axis.
// Topics: Transformations, Distributors, Rotation, Copiers
// See Also: rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies(), move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), grid_copies()
//
// Usage:
// yrot_copies(rots, [cp], [r=|d=], [sa=], [subrot=]) CHILDREN;
@ -994,9 +986,6 @@ function xrot_copies(rots=[], cp=[0,0,0], n, sa=0, r, d, subrot=true, p=_NO_ARG)
// Usage: Get Translation Matrices
// mats = yrot_copies(rots, [cp], [r=|d=], [sa=], [subrot=]);
// mats = yrot_copies(n=, [cp=], [r=|d=], [sa=], [subrot=]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module:
// - Given an array of angles, rotates copies of the children to each of those angles around the Y axis.
@ -1024,7 +1013,6 @@ function xrot_copies(rots=[], cp=[0,0,0], n, sa=0, r, d, subrot=true, p=_NO_ARG)
// `$ang` is set to the rotation angle of each child copy, and can be used to modify each child individually.
// `$axis` is set to the axis vector rotated around.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example:
// yrot_copies([180, 270, 315])
@ -1064,6 +1052,9 @@ function yrot_copies(rots=[], cp=[0,0,0], n, sa=0, r, d, subrot=true, p=_NO_ARG)
// Function&Module: zrot_copies()
// Synopsis: Rotates copies of children around the Z axis.
// Topics: Transformations, Distributors, Rotation, Copiers
// See Also: rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies(), move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), grid_copies()
//
// Usage:
// zrot_copies(rots, [cp], [r=|d=], [sa=], [subrot=]) CHILDREN;
@ -1075,8 +1066,6 @@ function yrot_copies(rots=[], cp=[0,0,0], n, sa=0, r, d, subrot=true, p=_NO_ARG)
// mats = zrot_copies(rots, [cp], [r=|d=], [sa=], [subrot=]);
// mats = zrot_copies(n=, [cp=], [r=|d=], [sa=], [subrot=]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module:
// - Given an array of angles, rotates copies of the children to each of those angles around the Z axis.
@ -1104,7 +1093,6 @@ function yrot_copies(rots=[], cp=[0,0,0], n, sa=0, r, d, subrot=true, p=_NO_ARG)
// `$ang` is set to the rotation angle of each child copy, and can be used to modify each child individually.
// `$axis` is set to the axis vector rotated around.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example:
// zrot_copies([180, 270, 315])
@ -1143,6 +1131,9 @@ function zrot_copies(rots=[], cp=[0,0,0], n, sa=0, r, d, subrot=true, p=_NO_ARG)
// Function&Module: arc_copies()
// Synopsis: Distributes duplicates of children along an arc.
// Topics: Transformations, Distributors, Rotation, Copiers
// See Also: rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), sphere_copies(), move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), grid_copies()
//
// Usage:
// arc_copies(n, r|d=, [sa=], [ea=], [rot=]) CHILDREN;
@ -1154,7 +1145,6 @@ function zrot_copies(rots=[], cp=[0,0,0], n, sa=0, r, d, subrot=true, p=_NO_ARG)
// mats = arc_copies(n, r|d=, [sa=], [ea=], [rot=]);
// mats = arc_copies(n, rx=|dx=, ry=|dy=, [sa=], [ea=], [rot=]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module, evenly distributes n duplicate children around an ovoid arc on the XY plane.
@ -1180,7 +1170,6 @@ function zrot_copies(rots=[], cp=[0,0,0], n, sa=0, r, d, subrot=true, p=_NO_ARG)
// `$pos` is set to the relative centerpoint of each child copy, and can be used to modify each child individually.
// `$idx` is set to the index value of each child copy.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example:
// #cube(size=[10,3,3],center=true);
@ -1266,6 +1255,9 @@ function arc_copies(
// Function&Module: sphere_copies()
// Synopsis: Distributes copies of children over the surface of a sphere.
// Topics: Transformations, Distributors, Rotation, Copiers
// See Also: rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), grid_copies()
//
// Usage:
// sphere_copies(n, r|d=, [cone_ang=], [scale=], [perp=]) CHILDREN;
@ -1274,8 +1266,6 @@ function arc_copies(
// Usage: Get Translation Matrices
// mats = sphere_copies(n, r|d=, [cone_ang=], [scale=], [perp=]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module, spreads children semi-evenly over the surface of a sphere or ellipsoid.
// When called as a function, *without* a `p=` argument, returns a list of transformation matrices, one for each copy.
@ -1298,7 +1288,6 @@ function arc_copies(
// `$rad` is set to the pre-scaled radial distance of the child from the center of the sphere.
// `$idx` is set to the index number of each child being copied.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example:
// sphere_copies(n=250, d=100, cone_ang=45, scale=[3,3,1])
@ -1373,6 +1362,9 @@ function sphere_copies(n=100, r=undef, d=undef, cone_ang=90, scale=[1,1,1], perp
// Function&Module: path_copies()
// Synopsis: Uniformly distributes copies of children along a path.
// Topics: Transformations, Distributors, Copiers
// See Also: line_copies(), move_copies(), xcopies(), ycopies(), zcopies(), grid_copies(), xflip_copy(), yflip_copy(), zflip_copy(), mirror_copy()
//
// Usage: Uniformly distribute copies
// path_copies(path, [n], [spacing], [sp], [rotate_children], [closed=]) CHILDREN;
@ -1385,8 +1377,6 @@ function sphere_copies(n=100, r=undef, d=undef, cone_ang=90, scale=[1,1,1], perp
// mats = path_copies(path, [n], [spacing], [sp], [rotate_children], [closed=]);
// mats = path_copies(path, dist=, [rotate_children=], [closed=]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module:
// - Place copies all of the children at points along the path based on path length. You can specify `dist` as
@ -1415,7 +1405,6 @@ function sphere_copies(n=100, r=undef, d=undef, cone_ang=90, scale=[1,1,1], perp
// `$dir` is set to the direction vector of the path at the point where the copy is placed.
// `$normal` is set to the direction of the normal vector to the path direction that is coplanar with the path at this point
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example(2D):
// spiral = [for(theta=[0:360*8]) theta * [cos(theta), sin(theta)]]/100;
@ -1585,8 +1574,10 @@ function path_copies(path, n, spacing, sp=undef, dist, rotate_children=true, dis
// Section: Making a copy of all children with reflection
//////////////////////////////////////////////////////////////////////
// Function&Module: xflip_copy()
// Synopsis: Makes a copy of children mirrored across the X axis.
// Topics: Transformations, Distributors, Translation, Copiers
// See Also: yflip_copy(), zflip_copy(), mirror_copy(), path_copies(), move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), grid_copies()
//
// Usage:
// xflip_copy([offset], [x]) CHILDREN;
@ -1595,8 +1586,6 @@ function path_copies(path, n, spacing, sp=undef, dist, rotate_children=true, dis
// Usage: Get Translation Matrices
// mats = xflip_copy([offset], [x]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module, makes a copy of the children, mirrored across the X axis.
// When called as a function, *without* a `p=` argument, returns a list of transformation matrices, one for each copy.
@ -1612,7 +1601,6 @@ function path_copies(path, n, spacing, sp=undef, dist, rotate_children=true, dis
// `$orig` is true for the original instance of children. False for the copy.
// `$idx` is set to the index value of each copy.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example:
// xflip_copy() yrot(90) cylinder(h=20, r1=4, r2=0);
@ -1637,6 +1625,9 @@ function xflip_copy(offset=0, x=0, p=_NO_ARG) =
// Function&Module: yflip_copy()
// Synopsis: Makes a copy of children mirrored across the Y axis.
// Topics: Transformations, Distributors, Translation, Copiers
// See Also: xflip_copy(), zflip_copy(), mirror_copy(), path_copies(), move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), grid_copies()
//
// Usage:
// yflip_copy([offset], [y]) CHILDREN;
@ -1645,8 +1636,6 @@ function xflip_copy(offset=0, x=0, p=_NO_ARG) =
// Usage: Get Translation Matrices
// mats = yflip_copy([offset], [y]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module, makes a copy of the children, mirrored across the Y axis.
// When called as a function, *without* a `p=` argument, returns a list of transformation matrices, one for each copy.
@ -1662,7 +1651,6 @@ function xflip_copy(offset=0, x=0, p=_NO_ARG) =
// `$orig` is true for the original instance of children. False for the copy.
// `$idx` is set to the index value of each copy.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example:
// yflip_copy() xrot(-90) cylinder(h=20, r1=4, r2=0);
@ -1687,6 +1675,9 @@ function yflip_copy(offset=0, y=0, p=_NO_ARG) =
// Function&Module: zflip_copy()
// Synopsis: Makes a copy of children mirrored across the Z axis.
// Topics: Transformations, Distributors, Translation, Copiers
// See Also: xflip_copy(), yflip_copy(), mirror_copy(), path_copies(), move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), grid_copies()
//
// Usage:
// zflip_copy([offset], [z]) CHILDREN;
@ -1695,8 +1686,6 @@ function yflip_copy(offset=0, y=0, p=_NO_ARG) =
// Usage: Get Translation Matrices
// mats = zflip_copy([offset], [z]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module, makes a copy of the children, mirrored across the Z axis.
// When called as a function, *without* a `p=` argument, returns a list of transformation matrices, one for each copy.
@ -1712,7 +1701,6 @@ function yflip_copy(offset=0, y=0, p=_NO_ARG) =
// `$orig` is true for the original instance of children. False for the copy.
// `$idx` is set to the index value of each copy.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example:
// zflip_copy() cylinder(h=20, r1=4, r2=0);
@ -1737,6 +1725,9 @@ function zflip_copy(offset=0, z=0, p=_NO_ARG) =
// Function&Module: mirror_copy()
// Synopsis: Makes a copy of children mirrored across a given plane.
// Topics: Transformations, Distributors, Translation, Copiers
// See Also: xflip_copy(), yflip_copy(), zflip_copy(), path_copies(), move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), grid_copies()
//
// Usage:
// mirror_copy(v, [cp], [offset]) CHILDREN;
@ -1745,8 +1736,6 @@ function zflip_copy(offset=0, z=0, p=_NO_ARG) =
// Usage: Get Translation Matrices
// mats = mirror_copy(v, [cp], [offset]);
//
// Topics: Transformations, Distributors, Copiers
//
// Description:
// When called as a module, makes a copy of the children, mirrored across the given plane.
// When called as a function, *without* a `p=` argument, returns a list of transformation matrices, one for each copy.
@ -1763,7 +1752,6 @@ function zflip_copy(offset=0, z=0, p=_NO_ARG) =
// `$orig` is true for the original instance of children. False for the copy.
// `$idx` is set to the index value of each copy.
//
// See Also: move_copies(), xcopies(), ycopies(), zcopies(), line_copies(), rot_copies(), xrot_copies(), yrot_copies(), zrot_copies(), arc_copies(), sphere_copies()
//
// Example:
// mirror_copy([1,-1,0]) zrot(-45) yrot(90) cylinder(d1=10, d2=0, h=20);
@ -1826,7 +1814,6 @@ function mirror_copy(v=[0,0,1], offset=0, cp, p=_NO_ARG) =
////////////////////
// Section: Distributing children individually along a line
///////////////////
// Module: xdistribute()
//
// Description:

View File

@ -20,7 +20,6 @@
// Synopsis: Draws a line along a path or region boundry.
// Topics: Paths (2D), Paths (3D), Drawing Tools
// See Also: offset_stroke(), path_sweep()
//
// Usage:
// stroke(path, [width], [closed], [endcaps], [endcap_width], [endcap_length], [endcap_extent], [trim]);
// stroke(path, [width], [closed], [endcap1], [endcap2], [endcap_width1], [endcap_width2], [endcap_length1], [endcap_length2], [endcap_extent1], [endcap_extent2], [trim1], [trim2]);
@ -550,7 +549,6 @@ module stroke(
// Synopsis: Draws a dashed line along a path or region boundry.
// Topics: Paths, Drawing Tools
// See Also: stroke(), path_cut()
//
// Usage: As a Module
// dashed_stroke(path, dashpat, [width=], [closed=]);
// Usage: As a Function
@ -879,7 +877,6 @@ function _normal_segment(p1,p2) =
// Synopsis: Uses [turtle graphics](https://en.wikipedia.org/wiki/Turtle_graphics) to generate a 2D path.
// Topics: Shapes (2D), Path Generators (2D), Mini-Language
// See Also: turtle3d()
//
// Usage:
// turtle(commands, [state], [full_state=], [repeat=])
// Description:

View File

@ -14,23 +14,32 @@ include <screws.scad>
// Section: Hinges
// Module: knuckle_hinge()
// Synopsis: Creates a knuckle-hinge shape.
// Topics: Hinges, Parts
// See Also: living_hinge_mask(), snap_lock(), snap_socket()
// Usage:
// knuckle_hinge(length, offset, segs, [inner], [arm_height=], [arm_angle=], [fill=], [clear_top=], [gap=], [round_top=], [round_bot=], [knuckle_diam=], [pin_diam=], [pin_fn=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
// Construct standard knuckle hinge in two parts using a hinge pin that must be separately supplied. The default is configured to use a piece of 1.75 mm filament as the hinge pin,
// but you can select any dimensions you like to use a screw or other available pin material. The BOTTOM of the hinge is its mount point, which is aligned with
// the hinge pin centersurface, and the hinge pin hole is the CENTER of the hinge.
// The offset is the distance from a vertical mounting point to the center of the hinge pin. The hinge barrel is held by an angled support and
// vertical support. The length of the angled support is determined by its angle and the offset. You specify the length of the vertical support with the
// arm_height parameter.
//
// Construct standard knuckle hinge in two parts using a hinge pin that must be separately supplied.
// The default is configured to use a piece of 1.75 mm filament as the hinge pin, but you can select
// any dimensions you like to use a screw or other available pin material. The BOTTOM of the hinge
// is its mount point, which is aligned with the hinge pin centersurface, and the hinge pin hole is
// the CENTER of the hinge. The offset is the distance from a vertical mounting point to the center
// of the hinge pin. The hinge barrel is held by an angled support and vertical support. The
// length of the angled support is determined by its angle and the offset. You specify the length
// of the vertical support with the arm_height parameter.
// .
// A hinge requires clearance so its parts don't interfere. If the hinge pin is exactly centered on the top of your part, then the hinge may not close all the way
// due to interference at the edge. A small clearance, specified with `clearance=`, raises the hinge up and can ease this interference. It should probably be equal to a layer thickness or two.
// If the hinge knuckle is close to the hinged part then the mating part may interfere. You can create clearance to address this problem by increasing the offset
// to move the hinge knuckles farther away. Another method is to cut out a curved recess on the parts to allow space for the other hinges. This is possible
// using the `knuckle_clearance=` parameter, which specifies the extra space to cut away to leave room for the hinge knuckles. It must be positive for any space
// to be cut, and to use this option you must make the hinge a child of some object and specify {{diff()}} for the parent object of the hinge.
// A hinge requires clearance so its parts don't interfere. If the hinge pin is exactly centered on
// the top of your part, then the hinge may not close all the way due to interference at the edge.
// A small clearance, specified with `clearance=`, raises the hinge up and can ease this
// interference. It should probably be equal to a layer thickness or two. If the hinge knuckle is
// close to the hinged part then the mating part may interfere. You can create clearance to address
// this problem by increasing the offset to move the hinge knuckles farther away. Another method is
// to cut out a curved recess on the parts to allow space for the other hinges. This is possible
// using the `knuckle_clearance=` parameter, which specifies the extra space to cut away to leave
// room for the hinge knuckles. It must be positive for any space to be cut, and to use this option
// you must make the hinge a child of some object and specify {{diff()}} for the parent object of
// the hinge.
// Figure(2D,Med,NoScales): The basic hinge form appears on the left. If fill is set to true the gap between the mount surface and hinge arm is filled as shown on the right.
// _knuckle_hinge_profile(4, 5, $fn=32, fill=false);
// right(13)_knuckle_hinge_profile(4, 5, $fn=32, fill=true);
@ -336,6 +345,9 @@ module _knuckle_hinge_profile(offset, arm_height, arm_angle=45, knuckle_diam=4,
// Module: living_hinge_mask()
// Synopsis: Creates a mask to make a folding "living" hinge.
// Topics: Hinges, Parts
// See Also: knuckle_hinge(), living_hinge_mask(), snap_lock(), snap_socket(), apply_folding_hinges_and_snaps()
// Usage:
// living_hinge_mask(l, thick, [layerheight=], [foldangle=], [hingegap=], [$slop=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
@ -378,6 +390,9 @@ module folding_hinge_mask(l, thick, layerheight=0.2, foldangle=90, hingegap=unde
// Module: apply_folding_hinges_and_snaps()
// Synopsis: Adds snap shapes and removes living hinges from a child shape.
// Topics: Hinges, Parts
// See Also: knuckle_hinge(), living_hinge_mask(), snap_lock(), snap_socket()
// Usage:
// apply_folding_hinges_and_snaps(thick, [foldangle=], [hinges=], [snaps=], [sockets=], [snaplen=], [snapdiam=], [hingegap=], [layerheight=], [$slop=]) CHILDREN;
// Description:
@ -460,6 +475,9 @@ module apply_folding_hinges_and_snaps(thick, foldangle=90, hinges=[], snaps=[],
// Module: snap_lock()
// Synopsis: Creates a snap-lock shape.
// Topics: Hinges, Parts
// See Also: knuckle_hinge(), living_hinge_mask(), snap_lock(), snap_socket()
// Usage:
// snap_lock(thick, [snaplen=], [snapdiam=], [layerheight=], [foldangle=], [hingegap=], [$slop=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
@ -496,6 +514,9 @@ module snap_lock(thick, snaplen=5, snapdiam=5, layerheight=0.2, foldangle=90, hi
// Module: snap_socket()
// Synopsis: Creates a snap-lock socket shape.
// Topics: Hinges, Parts
// See Also: knuckle_hinge(), living_hinge_mask(), snap_lock(), snap_socket()
// Usage:
// snap_socket(thick, [snaplen=], [snapdiam=], [layerheight=], [foldangle=], [hingegap=], [$slop=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
@ -533,3 +554,6 @@ module snap_socket(thick, snaplen=5, snapdiam=5, layerheight=0.2, foldangle=90,
}
}
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap

View File

@ -16,11 +16,13 @@ include <rounding.scad>
// Function&Module: half_joiner_clear()
// Synopsis: Creates a mask to clear space for a {{half_joiner()}}.
// Topics: Joiners, Parts
// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner(), snap_pin(), rabbit_clip(), dovetail()
// Usage: As Module
// half_joiner_clear(l, w, [ang=], [clearance=], [overlap=]) [ATTACHMENTS];
// Usage: As Function
// vnf = half_joiner_clear(l, w, [ang=], [clearance=], [overlap=]);
// Topics: Joiners, Parts
// Description:
// Creates a mask to clear an area so that a half_joiner can be placed there.
// Arguments:
@ -33,7 +35,6 @@ include <rounding.scad>
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner()
// Example:
// half_joiner_clear();
function half_joiner_clear(l=20, w=10, ang=30, clearance=0, overlap=0.01, anchor=CENTER, spin=0, orient=UP) =
@ -60,11 +61,13 @@ module half_joiner_clear(l=20, w=10, ang=30, clearance=0, overlap=0.01, anchor=C
// Function&Module: half_joiner()
// Synopsis: Creates a half-joiner shape to mate with a {{half_joiner2()}} shape..
// Topics: Joiners, Parts
// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner(), snap_pin(), rabbit_clip(), dovetail()
// Usage: As Module
// half_joiner(l, w, [base=], [ang=], [screwsize=], [$slop=]) [ATTACHMENTS];
// Usage: As Function
// vnf = half_joiner(l, w, [base=], [ang=], [screwsize=], [$slop=]);
// Topics: Joiners, Parts
// Description:
// Creates a half_joiner object that can be attached to a matching half_joiner2 object.
// Arguments:
@ -78,7 +81,6 @@ module half_joiner_clear(l=20, w=10, ang=30, clearance=0, overlap=0.01, anchor=C
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
// $slop = Printer specific slop value to make parts fit more closely.
// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner()
// Examples(FlatSpin,VPD=75):
// half_joiner(screwsize=3);
// half_joiner(l=20,w=10,base=10);
@ -241,11 +243,13 @@ module half_joiner(l=20, w=10, base=10, ang=30, screwsize, anchor=CENTER, spin=0
// Function&Module: half_joiner2()
// Synopsis: Creates a half_joiner2 shape to mate with a {{half_joiner()}} shape..
// Topics: Joiners, Parts
// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner(), snap_pin(), rabbit_clip(), dovetail()
// Usage: As Module
// half_joiner2(l, w, [base=], [ang=], [screwsize=])
// Usage: As Function
// vnf = half_joiner2(l, w, [base=], [ang=], [screwsize=])
// Topics: Joiners, Parts
// Description:
// Creates a half_joiner2 object that can be attached to half_joiner object.
// Arguments:
@ -258,7 +262,6 @@ module half_joiner(l=20, w=10, base=10, ang=30, screwsize, anchor=CENTER, spin=0
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner()
// Examples(FlatSpin,VPD=75):
// half_joiner2(screwsize=3);
// half_joiner2(w=10,base=10,l=20);
@ -444,11 +447,13 @@ module half_joiner2(l=20, w=10, base=10, ang=30, screwsize, anchor=CENTER, spin=
// Module: joiner_clear()
// Synopsis: Creates a mask to clear space for a {{joiner()}} shape.
// Topics: Joiners, Parts
// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner(), snap_pin(), rabbit_clip(), dovetail()
// Description:
// Creates a mask to clear an area so that a joiner can be placed there.
// Usage:
// joiner_clear(l, w, [ang=], [clearance=], [overlap=]) [ATTACHMENTS];
// Topics: Joiners, Parts
// Arguments:
// l = Length of the joiner to clear space for.
// w = Width of the joiner to clear space for.
@ -459,7 +464,6 @@ module half_joiner2(l=20, w=10, base=10, ang=30, screwsize, anchor=CENTER, spin=
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner()
// Example:
// joiner_clear();
function joiner_clear(l=40, w=10, ang=30, clearance=0, overlap=0.01, anchor=CENTER, spin=0, orient=UP) = no_function("joiner_clear");
@ -482,9 +486,11 @@ module joiner_clear(l=40, w=10, ang=30, clearance=0, overlap=0.01, anchor=CENTER
// Module: joiner()
// Synopsis: Creates a joiner shape that can mate with another rotated joiner shape.
// Topics: Joiners, Parts
// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner(), snap_pin(), rabbit_clip(), dovetail()
// Usage:
// joiner(l, w, base, [ang=], [screwsize=], [$slop=]) [ATTACHMENTS];
// Topics: Joiners, Parts
// Description:
// Creates a joiner object that can be attached to another joiner object.
// Arguments:
@ -498,7 +504,6 @@ module joiner_clear(l=40, w=10, ang=30, clearance=0, overlap=0.01, anchor=CENTER
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
// $slop = Printer specific slop value to make parts fit more closely.
// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner()
// Examples(FlatSpin,VPD=125):
// joiner(screwsize=3);
// joiner(l=40, w=10, base=10);
@ -532,6 +537,9 @@ module joiner(l=40, w=10, base=10, ang=30, screwsize, anchor=CENTER, spin=0, ori
// Section: Dovetails
// Module: dovetail()
// Synopsis: Creates a possibly tapered dovetail shape.
// Topics: Joiners, Parts
// See Also: joiner(), snap_pin(), rabbit_clip()
//
// Usage:
// dovetail(gender, w=|width, h=|height, slide|thickness=, [slope=|angle=], [taper=|back_width=], [chamfer=], [r=|radius=], [round=], [extra=], [$slop=])
@ -799,6 +807,9 @@ function _pin_size(size) =
// Module: snap_pin()
// Synopsis: Creates a snap-pin that can slot into a {{snap_pin_socket()}} to join two parts.
// Topics: Joiners, Parts
// See Also: snap_pin_socket(), joiner(), dovetail(), snap_pin(), rabbit_clip()
// Usage:
// snap_pin(size, [pointed=], [anchor=], [spin=], [orient]=) [ATTACHMENTS];
// snap_pin(r=|radius=|d=|diameter=, l=|length=, nub_depth=, snap=, thickness=, [clearance=], [preload=], [pointed=]) [ATTACHMENTS];
@ -869,6 +880,9 @@ module snap_pin(size,r,radius,d,diameter, l,length, nub_depth, snap, thickness,
}
// Module: snap_pin_socket()
// Synopsis: Creates a snap-pin socket for a {{snap_pin()}} to slot into.
// Topics: Joiners, Parts
// See Also: snap_pin(), joiner(), dovetail(), snap_pin(), rabbit_clip()
// Usage:
// snap_pin_socket(size, [fixed=], [fins=], [pointed=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// snap_pin_socket(r=|radius=|d=|diameter=, l=|length=, nub_depth=, snap=, [fixed=], [pointed=], [fins=]) [ATTACHMENTS];
@ -939,6 +953,9 @@ module snap_pin_socket(size, r, radius, l,length, d,diameter,nub_depth, snap, fi
// Module: rabbit_clip()
// Synopsis: Creates a rabbit-eared clip that can snap into a slot.
// Topics: Joiners, Parts
// See Also: snap_pin(), joiner(), dovetail(), snap_pin(), rabbit_clip()
// Usage:
// rabbit_clip(type, length, width, snap, thickness, depth, [compression=], [clearance=], [lock=], [lock_clearance=], [splineteps=], [anchor=], [orient=], [spin=]) [ATTACHMENTS];
// Description:

View File

@ -15,6 +15,9 @@ include <metric_screws.scad>
// Section: Generic Linear Bearings
// Module: linear_bearing_housing()
// Synopsis: Creates a generic linear bearing mount clamp.
// Topics: Parts, Bearings
// See Also: linear_bearing(), lmXuu_info(), ball_bearing()
// Description:
// Creates a model of a clamp to hold a generic linear bearing cartridge.
// Arguments:
@ -75,6 +78,9 @@ module linear_bearing_housing(d=15, l=24, tab=7, gap=5, wall=3, tabwall=5, screw
// Module: linear_bearing()
// Synopsis: Creates a generic linear bearing cartridge.
// Topics: Parts, Bearings
// See Also: linear_bearing_housing(), lmXuu_info(), ball_bearing()
// Description:
// Creates a rough model of a generic linear ball bearing cartridge.
// Arguments:
@ -103,6 +109,9 @@ module linear_bearing(l, od=15, id=8, length, anchor=CTR, spin=0, orient=UP) {
// Section: lmXuu Linear Bearings
// Module: lmXuu_housing()
// Synopsis: Creates a standardized LM*UU linear bearing mount clamp.
// Topics: Parts, Bearings
// See Also: linear_bearing(), linear_bearing_housing(), lmXuu_info(), lmXuu_bearing(), lmXuu_housing(), ball_bearing()
// Description:
// Creates a model of a clamp to hold a standard sized lmXuu linear bearing cartridge.
// Arguments:
@ -127,6 +136,9 @@ module lmXuu_housing(size=8, tab=7, gap=5, wall=3, tabwall=5, screwsize=3, ancho
// Module: lmXuu_bearing()
// Synopsis: Creates a standardized LM*UU linear bearing cartridge.
// Topics: Parts, Bearings
// See Also: linear_bearing(), linear_bearing_housing(), lmXuu_info(), lmXuu_bearing(), lmXuu_housing(), ball_bearing()
// Description:
// Creates a model of an lmXuu linear ball bearing cartridge.
// Arguments:
@ -146,6 +158,9 @@ module lmXuu_bearing(size=8, anchor=CTR, spin=0, orient=UP) {
// Function: lmXuu_info()
// Synopsis: Returns the sizes of a standard LM*UU linear bearing cartridge.
// Topics: Parts, Bearings
// See Also: linear_bearing(), linear_bearing_housing(), lmXuu_info(), lmXuu_bearing(), lmXuu_housing(), ball_bearing()
// Description:
// Get dimensional info for a standard metric lmXuu linear bearing cartridge.
// Returns `[DIAM, LENGTH]` for the cylindrical cartridge.

View File

@ -18,10 +18,11 @@
// Function: is_homogeneous()
// Alias: is_homogenous()
// Usage:
// bool = is_homogeneous(list, [depth]);
// Synopsis: Returns true if all members of a list are of the same type.
// Topics: List Handling, Type Checking
// See Also: is_vector(), is_matrix()
// Usage:
// bool = is_homogeneous(list, [depth]);
// Description:
// Returns true when the list has elements of same type up to the depth `depth`.
// Booleans and numbers are not distinguinshed as of distinct types.
@ -53,10 +54,11 @@ function _same_type(a,b, depth) =
// Function: min_length()
// Usage:
// llen = min_length(list);
// Synopsis: Returns the length of the shortest list.
// Topics: List Handling
// See Also: max_length()
// Usage:
// llen = min_length(list);
// Description:
// Returns the length of the shortest sublist in a list of lists.
// Arguments:
@ -69,10 +71,11 @@ function min_length(list) =
// Function: max_length()
// Usage:
// llen = max_length(list);
// Synopsis: Returns the length of the longest list.
// Topics: List Handling
// See Also: min_length()
// Usage:
// llen = max_length(list);
// Description:
// Returns the length of the longest sublist in a list of lists.
// Arguments:
@ -107,9 +110,11 @@ function _list_shape_recurse(v) =
// Function: list_shape()
// Synopsis: Returns the dimensions of an array.
// Topics: Matrices, List Handling
// See Also: is_homogenous()
// Usage:
// dims = list_shape(v, [depth]);
// Topics: Matrices, List Handling
// Description:
// Returns the size of a multi-dimensional array, a list of the lengths at each depth.
// If the returned value has `dims[i] = j` then it means the ith index ranges of j items.
@ -139,9 +144,11 @@ function list_shape(v, depth=undef) =
// Function: in_list()
// Synopsis: Returns true if a value is in a list.
// Topics: List Handling
// See Also: select(), slice()
// Usage:
// bool = in_list(val, list, [idx]);
// Topics: List Handling
// Description:
// Returns true if value `val` is in list `list`. When `val==NAN` the answer will be false for any list.
// Arguments:
@ -177,7 +184,9 @@ function in_list(val,list,idx) =
// Section: List Indexing
// Function: select()
// Synopsis: Returns one or more items from a list, with wrapping.
// Topics: List Handling
// See Also: slice(), column(), last()
// Description:
// Returns a portion of a list, wrapping around past the beginning, if end<start.
// The first item is index 0. Negative indexes are counted back from the end.
@ -193,7 +202,6 @@ function in_list(val,list,idx) =
// list = The list to get the portion of.
// start = Either the index of the first item or an index range or a list of indices.
// end = The index of the last item when `start` is a number. When `start` is a list or a range, `end` should not be given.
// See Also: slice(), column(), last()
// Example:
// l = [3,4,5,6,7,8,9];
// a = select(l, 5, 6); // Returns [8,9]
@ -225,6 +233,9 @@ function select(list, start, end) =
// Function: slice()
// Synopsis: Returns part of a list, not including the last index.
// Topics: List Handling
// See Also: select(), column(), last()
// Usage:
// list = slice(list, s, e);
// Description:
@ -236,7 +247,6 @@ function select(list, start, end) =
// list = The list to get the slice of.
// start = The index of the first item to return. Default: 0
// end = The index of the last item to return. Default: -1 (last item)
// See Also: select(), column(), last()
// Example:
// a = slice([3,4,5,6,7,8,9], 3, 5); // Returns [6,7,8]
// b = slice([3,4,5,6,7,8,9], 2, -1); // Returns [5,6,7,8,9]
@ -259,10 +269,11 @@ function slice(list,start=0,end=-1) =
[if (start<=end && end>=0 && start<=l) for (i=[max(start,0):1:min(end,l-1)]) list[i]];
// Function: last()
// Usage:
// item = last(list);
// Synopsis: Returns the last item of a list.
// Topics: List Handling
// See Also: select(), slice(), column()
// Usage:
// item = last(list);
// Description:
// Returns the last element of a list, or undef if empty.
// Arguments:
@ -275,10 +286,11 @@ function last(list) =
// Function: list_head()
// Usage:
// list = list_head(list, [to]);
// Synopsis: Returns the head of the given list.
// Topics: List Handling
// See Also: select(), slice(), list_tail(), last()
// Usage:
// list = list_head(list, [to]);
// Description:
// Returns the head of the given list, from the first item up until the `to` index, inclusive.
// By default returns all but the last element of the list.
@ -303,10 +315,11 @@ function list_head(list, to=-2) =
// Function: list_tail()
// Usage:
// list = list_tail(list, [from]);
// Synopsis: Returns the tail of the given list.
// Topics: List Handling
// See Also: select(), slice(), list_tail(), last()
// Usage:
// list = list_tail(list, [from]);
// Description:
// Returns the tail of the given list, from the `from` index up until the end of the list, inclusive.
// By default returns all but the first item.
@ -333,10 +346,11 @@ function list_tail(list, from=1) =
// Function: bselect()
// Usage:
// sublist = bselect(list, index);
// Synopsis: Cherry-picks specific items from a list.
// Topics: List Handling
// See Also: list_bset()
// Usage:
// sublist = bselect(list, index);
// Description:
// Returns the items in `list` whose matching element in `index` evaluates as true.
// Arguments:
@ -355,10 +369,11 @@ function bselect(list,index) =
// Function: repeat()
// Usage:
// list = repeat(val, n);
// Synopsis: Returns a list of N copies of a value.
// Topics: List Handling
// See Also: count(), lerpn()
// Usage:
// list = repeat(val, n);
// Description:
// Generates a list of `n` copies of the given value `val`.
// If the count `n` is given as a list of counts, then this creates a
@ -380,10 +395,11 @@ function repeat(val, n, i=0) =
// Function: list_bset()
// Usage:
// arr = list_bset(indexset, valuelist, [dflt]);
// Synopsis: Returns a list where specific values are set from a list of values.
// Topics: List Handling
// See Also: bselect()
// Usage:
// arr = list_bset(indexset, valuelist, [dflt]);
// Description:
// Opposite of `bselect()`. Returns a list the same length as `indexlist`, where each item will
// either be 0 if the corresponding item in `indexset` is false, or the next sequential value
@ -410,7 +426,9 @@ function list_bset(indexset, valuelist, dflt=0) =
// Function: list()
// Synopsis: Expands a range into a full list.
// Topics: List Handling, Type Conversion
// See Also: scalar_vec3(), force_list()
// Usage:
// list = list(l)
// Description:
@ -418,7 +436,6 @@ function list_bset(indexset, valuelist, dflt=0) =
// If given a string, explodes it into a list of single letters.
// Arguments:
// l = The value to expand.
// See Also: scalar_vec3(), force_list()
// Example:
// l1 = list([3:2:9]); // Returns: [3,5,7,9]
// l2 = list([3,4,5]); // Returns: [3,4,5]
@ -428,10 +445,11 @@ function list(l) = is_list(l)? l : [for (x=l) x];
// Function: force_list()
// Usage:
// list = force_list(value, [n], [fill]);
// Synopsis: Coerces non-list values into a list.
// Topics: List Handling
// See Also: scalar_vec3()
// Usage:
// list = force_list(value, [n], [fill]);
// Description:
// Coerces non-list values into a list. Makes it easy to treat a scalar input
// consistently as a singleton list, as well as list inputs.
@ -455,10 +473,11 @@ function force_list(value, n=1, fill) =
// Section: List Modification
// Function: reverse()
// Usage:
// rlist = reverse(list);
// Synopsis: Reverses the ordering of a list.
// Topics: List Handling
// See Also: select(), list_rotate()
// Usage:
// rlist = reverse(list);
// Description:
// Reverses a list or string.
// Arguments:
@ -472,10 +491,11 @@ function reverse(list) =
// Function: list_rotate()
// Usage:
// rlist = list_rotate(list, [n]);
// Synopsis: Rotates the ordering of a list.
// Topics: List Handling
// See Also: select(), reverse()
// Usage:
// rlist = list_rotate(list, [n]);
// Description:
// Rotates the contents of a list by `n` positions left, so that list[n] becomes the first entry of the list.
// If `n` is negative, then the rotation is `abs(n)` positions to the right.
@ -509,10 +529,11 @@ function list_rotate(list,n=1) =
// Function: shuffle()
// Usage:
// shuffled = shuffle(list, [seed]);
// Synopsis: Randomizes the ordering of a list.
// Topics: List Handling
// See Also: sort(), sortidx(), unique(), unique_count()
// Usage:
// shuffled = shuffle(list, [seed]);
// Description:
// Shuffles the input list into random order.
// If given a string, shuffles the characters within the string.
@ -542,10 +563,11 @@ function shuffle(list,seed) =
// Function: repeat_entries()
// Usage:
// newlist = repeat_entries(list, N, [exact]);
// Synopsis: Repeats items in a list to expand it to a given length.
// Topics: List Handling
// See Also: repeat()
// Usage:
// newlist = repeat_entries(list, N, [exact]);
// Description:
// Takes a list as input and duplicates some of its entries to produce a list
// with length `N`. If the requested `N` is not a multiple of the list length then
@ -583,10 +605,11 @@ function repeat_entries(list, N, exact=true) =
// Function: list_pad()
// Usage:
// newlist = list_pad(list, minlen, [fill]);
// Synopsis: Adds items to the end of a list until it is a given length.
// Topics: List Handling
// See Also: force_list(), scalar_vec3()
// Usage:
// newlist = list_pad(list, minlen, [fill]);
// Description:
// If the list `list` is shorter than `minlen` length, pad it to length with the value given in `fill`.
// Arguments:
@ -602,10 +625,11 @@ function list_pad(list, minlen, fill) =
// Function: list_set()
// Usage:
// list = list_set(list, indices, values, [dflt], [minlen]);
// Synopsis: Sets the value of specific list items.
// Topics: List Handling
// See Also: list_insert(), list_remove(), list_remove_values()
// Usage:
// list = list_set(list, indices, values, [dflt], [minlen]);
// Description:
// Takes the input list and returns a new list such that `list[indices[i]] = values[i]` for all of
// the (index,value) pairs supplied and unchanged for other indices. If you supply `indices` that are
@ -648,10 +672,11 @@ function list_set(list=[],indices,values,dflt=0,minlen=0) =
// Function: list_insert()
// Usage:
// list = list_insert(list, indices, values);
// Synopsis: Inserts values into the middle of a list.
// Topics: List Handling
// See Also: list_set(), list_remove(), list_remove_values()
// Usage:
// list = list_insert(list, indices, values);
// Description:
// Insert `values` into `list` before position `indices`. The indices for insertion
// are based on the original list, before any insertions have occurred.
@ -692,10 +717,11 @@ function list_insert(list, indices, values) =
// Function: list_remove()
// Usage:
// list = list_remove(list, ind);
// Synopsis: Removes items from the middle of a list.
// Topics: List Handling
// See Also: list_set(), list_insert(), list_remove_values()
// Usage:
// list = list_remove(list, ind);
// Description:
// If `ind` is a number remove `list[ind]` from the list. If `ind` is a list of indices
// remove from the list the item all items whose indices appear in `ind`. If you give
@ -734,10 +760,11 @@ function list_remove(list, ind) =
// Function: list_remove_values()
// Usage:
// list = list_remove_values(list, values, [all]);
// Synopsis: Removes specific values from a list.
// Topics: List Handling
// See Also: list_set(), list_insert(), list_remove()
// Usage:
// list = list_remove_values(list, values, [all]);
// Description:
// Removes the first, or all instances of the given value or list of values from the list.
// If you specify `all=false` and list a value twice then the first two instances will be removed.
@ -801,11 +828,12 @@ function list_remove_values(list,values=[],all=false) =
// Section: List Iteration Index Helper
// Function: idx()
// Synopsis: Returns a range useful for iterating over a list.
// Topics: List Handling, Iteration
// See Also: count()
// Usage:
// range = idx(list, [s=], [e=], [step=]);
// for(i=idx(list, [s=], [e=], [step=])) ...
// Topics: List Handling, Iteration
// See Also: count()
// Description:
// Returns the range that gives the indices for a given list. This makes is a little bit
// easier to loop over a list by index, when you need the index numbers and looping of list values isn't enough.
@ -833,11 +861,12 @@ function idx(list, s=0, e=-1, step=1) =
// Function: pair()
// Synopsis: Returns a list of consecutive pairs in a list.
// Topics: List Handling, Iteration
// See Also: idx(), triplet(), combinations(), permutations()
// Usage:
// p = pair(list, [wrap]);
// for (p = pair(list, [wrap])) ... // On each iteration, p contains a list of two adjacent items.
// Topics: List Handling, Iteration
// See Also: idx(), triplet(), combinations(), permutations()
// Description:
// Returns a list of all of the pairs of adjacent items from a list, optionally wrapping back to the front. The pairs overlap, and
// are returned in order starting with the first two entries in the list. If the list has less than two elements, the empty list is returned.
@ -866,11 +895,12 @@ function pair(list, wrap=false) =
// Function: triplet()
// Synopsis: Returns a list of consecutive triplets in a list.
// Topics: List Handling, Iteration
// See Also: idx(), pair(), combinations(), permutations()
// Usage:
// list = triplet(list, [wrap]);
// for (t = triplet(list, [wrap])) ...
// Topics: List Handling, Iteration
// See Also: idx(), pair(), combinations(), permutations()
// Description:
// Returns a list of all adjacent triplets from a list, optionally wrapping back to the front.
// If you set `wrap` to true then the first triplet is the one centered on the first list element, so it includes
@ -905,10 +935,11 @@ function triplet(list, wrap=false) =
// Function: combinations()
// Usage:
// list = combinations(l, [n]);
// Synopsis: Returns a list of all item combinations in a list.
// Topics: List Handling, Iteration
// See Also: idx(), pair(), triplet(), permutations()
// Usage:
// list = combinations(l, [n]);
// Description:
// Returns a list of all of the (unordered) combinations of `n` items out of the given list `l`.
// For the list `[1,2,3,4]`, with `n=2`, this will return `[[1,2], [1,3], [1,4], [2,3], [2,4], [3,4]]`.
@ -931,10 +962,11 @@ function combinations(l,n=2,_s=0) =
// Function: permutations()
// Usage:
// list = permutations(l, [n]);
// Synopsis: Returns a list of all item permutations in a list.
// Topics: List Handling, Iteration
// See Also: idx(), pair(), triplet(), combinations()
// Usage:
// list = permutations(l, [n]);
// Description:
// Returns a list of all of the (ordered) permutation `n` items out of the given list `l`.
// For the list `[1,2,3]`, with `n=2`, this will return `[[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]`
@ -957,13 +989,14 @@ function permutations(l,n=2) =
// Function: list_to_matrix()
// Synopsis: Groups items in a list into sublists.
// Topics: Matrices, List Handling
// See Also: column(), submatrix(), hstack(), flatten(), full_flatten()
// Usage:
// groups = list_to_matrix(v, cnt, [dflt]);
// Description:
// Takes a flat list of values, and groups items in sets of `cnt` length.
// The opposite of this is `flatten()`.
// Topics: Matrices, List Handling
// See Also: column(), submatrix(), hstack(), flatten(), full_flatten()
// Arguments:
// v = The list of items to group.
// cnt = The number of items to put in each grouping.
@ -979,10 +1012,11 @@ function list_to_matrix(v, cnt, dflt=undef) =
// Function: flatten()
// Usage:
// list = flatten(l);
// Synopsis: Flattens a list of sublists into a single list.
// Topics: Matrices, List Handling
// See Also: column(), submatrix(), hstack(), full_flatten()
// Usage:
// list = flatten(l);
// Description:
// Takes a list of lists and flattens it by one level.
// Arguments:
@ -995,10 +1029,11 @@ function flatten(l) =
// Function: full_flatten()
// Usage:
// list = full_flatten(l);
// Synopsis: Recursively flattens nested sublists into a single list of non-list values.
// Topics: Matrices, List Handling
// See Also: column(), submatrix(), hstack(), flatten()
// Usage:
// list = full_flatten(l);
// Description:
// Collects in a list all elements recursively found in any level of the given list.
// The output list is ordered in depth first order.
@ -1015,10 +1050,11 @@ function full_flatten(l) =
// Section: Set Manipulation
// Function: set_union()
// Usage:
// s = set_union(a, b, [get_indices]);
// Synopsis: Merges two lists, returning a list of unique items.
// Topics: Set Handling, List Handling
// See Also: set_difference(), set_intersection()
// Usage:
// s = set_union(a, b, [get_indices]);
// Description:
// Given two sets (lists with unique items), returns the set of unique items that are in either `a` or `b`.
// If `get_indices` is true, a list of indices into the new union set are returned for each item in `b`,
@ -1057,10 +1093,11 @@ function set_union(a, b, get_indices=false) =
// Function: set_difference()
// Usage:
// s = set_difference(a, b);
// Synopsis: Returns a list of unique items that are in list A, but not in list B.
// Topics: Set Handling, List Handling
// See Also: set_union(), set_intersection()
// Usage:
// s = set_difference(a, b);
// Description:
// Given two sets (lists with unique items), returns the set of items that are in `a`, but not `b`.
// Arguments:
@ -1078,10 +1115,11 @@ function set_difference(a, b) =
// Function: set_intersection()
// Usage:
// s = set_intersection(a, b);
// Synopsis: Returns a list of unique items that are in both given lists.
// Topics: Set Handling, List Handling
// See Also: set_union(), set_difference()
// Usage:
// s = set_intersection(a, b);
// Description:
// Given two sets (lists with unique items), returns the set of items that are in both sets.
// Arguments:

View File

@ -18,7 +18,6 @@
// Synopsis: Creates a 2D beading mask shape useful for rounding 90° edges.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable, Masks (2D)
// See Also: corner_profile(), edge_profile(), face_profile(), fillet()
//
// Usage: As module
// mask2d_roundover(r|d=, [inset], [excess]) [ATTACHMENTS];
// Usage: As function
@ -80,10 +79,9 @@ function mask2d_roundover(r, inset=0, excess=0.01, d, anchor=CENTER,spin=0) =
// Function&Module: mask2d_cove()
// Synopsis: Creates a 2d cove (quarter-round) mask shape.
// Synopsis: Creates a 2D cove (quarter-round) mask shape.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable, Masks (2D)
// See Also: corner_profile(), edge_profile(), face_profile()
//
// Usage: As module
// mask2d_cove(r|d=, [inset], [excess]) [ATTACHMENTS];
// Usage: As function
@ -148,7 +146,6 @@ function mask2d_cove(r, inset=0, excess=0.01, d, anchor=CENTER,spin=0) =
// Synopsis: Produces a 2D chamfer mask shape.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable, Masks (2D)
// See Also: corner_profile(), edge_profile(), face_profile()
//
// Usage: As Module
// mask2d_chamfer(edge, [angle], [inset], [excess]) [ATTACHMENTS];
// mask2d_chamfer(y=, [angle=], [inset=], [excess=]) [ATTACHMENTS];
@ -228,7 +225,6 @@ function mask2d_chamfer(edge, angle=45, inset=0, excess=0.01, x, y, anchor=CENTE
// Synopsis: Creates a rabbet mask shape.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable, Masks (2D)
// See Also: corner_profile(), edge_profile(), face_profile()
//
// Usage: As Module
// mask2d_rabbet(size, [excess]) [ATTACHMENTS];
// Usage: As Function
@ -284,10 +280,9 @@ function mask2d_rabbet(size, excess=0.01, anchor=CENTER,spin=0) =
// Function&Module: mask2d_dovetail()
// Creates a 2d dovetail mask shape.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable, Masks (2D)
// Synopsis: Creates a 2D dovetail mask shape.
// Topics: Masks (2D), Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: corner_profile(), edge_profile(), face_profile()
//
// Usage: As Module
// mask2d_dovetail(edge, [angle], [inset], [shelf], [excess], ...) [ATTACHMENTS];
// mask2d_dovetail(x=, [angle=], [inset=], [shelf=], [excess=], ...) [ATTACHMENTS];
@ -363,10 +358,9 @@ function mask2d_dovetail(edge, angle=30, inset=0, shelf=0, excess=0.01, x, y, an
// Function&Module: mask2d_teardrop()
// Synopsis: Creates a 2d teardrop mask shape with a controllable maximum angle from vertical.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable, Masks (2D)
// Synopsis: Creates a 2D teardrop mask shape with a controllable maximum angle from vertical.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable, Masks (2D), FDM Optimized
// See Also: corner_profile(), edge_profile(), face_profile()
//
// Usage: As Module
// mask2d_teardrop(r|d=, [angle], [excess]) [ATTACHMENTS];
// Usage: As Function
@ -428,10 +422,9 @@ module mask2d_teardrop(r, angle=45, excess=0.01, d, anchor=CENTER, spin=0) {
}
// Function&Module: mask2d_ogee()
// Synopsis: Creates a 2d ogee mask shape.
// Synopsis: Creates a 2D ogee mask shape.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable, Masks (2D)
// See Also: corner_profile(), edge_profile(), face_profile()
//
// Usage: As Module
// mask2d_ogee(pattern, [excess], ...) [ATTAHCMENTS];
// Usage: As Function

View File

@ -14,10 +14,13 @@
// Module: chamfer_edge_mask()
// Synopsis: Creates a shape to chamfer a 90° edge.
// Topics: Masking, Chamfers, Shapes (3D)
// See Also: chamfer_corner_mask()
// Usage:
// chamfer_edge_mask(l|h=|length=|height=, chamfer, [excess]) [ATTACHMENTS];
// Description:
// Creates a shape that can be used to chamfer a 90 degree edge.
// Creates a shape that can be used to chamfer a 90° edge.
// Difference it from the object to be chamfered. The center of
// the mask object should align exactly with the edge to be chamfered.
// Arguments:
@ -52,10 +55,13 @@ module chamfer_edge_mask(l, chamfer=1, excess=0.1, h, length, height, anchor=CEN
// Module: chamfer_corner_mask()
// Synopsis: Creates a shape to chamfer a 90° corner.
// Topics: Masking, Chamfers, Shapes (3D)
// See Also: chamfer_edge_mask()
// Usage:
// chamfer_corner_mask(chamfer) [ATTACHMENTS];
// Description:
// Creates a shape that can be used to chamfer a 90 degree corner.
// Creates a shape that can be used to chamfer a 90° corner.
// Difference it from the object to be chamfered. The center of
// the mask object should align exactly with the corner to be chamfered.
// Arguments:
@ -87,6 +93,8 @@ module chamfer_corner_mask(chamfer=1, anchor=CENTER, spin=0, orient=UP) {
// Module: chamfer_cylinder_mask()
// Synopsis: Creates a shape to chamfer the end of a cylinder.
// Topics: Masking, Chamfers, Cylinders
// Usage:
// chamfer_cylinder_mask(r|d=, chamfer, [ang], [from_end]) [ATTACHMENTS];
// Description:
@ -149,11 +157,14 @@ module chamfer_cylinder_mask(r, chamfer, d, ang=45, from_end=false, anchor=CENTE
// Section: Rounding Masks
// Module: rounding_edge_mask()
// Synopsis: Creates a shape to round a 90° edge.
// Topics: Masks, Rounding, Shapes (3D)
// See Also: rounding_angled_edge_mask(), rounding_corner_mask(), rounding_angled_corner_mask()
// Usage:
// rounding_edge_mask(l|h=|length=|height=, r|d=, [excess=]) [ATTACHMENTS];
// rounding_edge_mask(l|h=|length=|height=, r1=|d1=, r2=|d2=, [excess=]) [ATTACHMENTS];
// Description:
// Creates a shape that can be used to round a vertical 90 degree edge.
// Creates a shape that can be used to round a vertical 90° edge.
// Difference it from the object to be rounded. The center of the mask
// object should align exactly with the edge to be rounded.
// Arguments:
@ -225,10 +236,13 @@ module rounding_edge_mask(l, r, r1, r2, d, d1, d2, excess=0.1, anchor=CENTER, sp
// Module: rounding_corner_mask()
// Synopsis: Creates a shape to round 90° corners.
// Topics: Masking, Rounding, Shapes (3D)
// See Also: rounding_angled_corner_mask(), rounding_edge_mask(), rounding_angled_edge_mask()
// Usage:
// rounding_corner_mask(r|d, [excess=], [style=]) [ATTACHMENTS];
// Description:
// Creates a shape that you can use to round 90 degree corners.
// Creates a shape that you can use to round 90° corners.
// Difference it from the object to be rounded. The center of the mask
// object should align exactly with the corner to be rounded.
// Arguments:
@ -275,6 +289,9 @@ module rounding_corner_mask(r, d, style="octa", excess=0.1, anchor=CENTER, spin=
// Module: rounding_angled_edge_mask()
// Synopsis: Creates a shape to round edges of any angle.
// Topics: Masks, Rounding
// See Also: rounding_angled_corner_mask(), rounding_edge_mask(), rounding_corner_mask()
// Usage:
// rounding_angled_edge_mask(h|l=|length=|height=, r|d=, [ang=]) [ATTACHMENTS];
// rounding_angled_edge_mask(h|l=|length=|height=, r1=|d1=, r2=|d2=, [ang=]) [ATTACHMENTS];
@ -341,6 +358,9 @@ module rounding_angled_edge_mask(h, r, r1, r2, d, d1, d2, ang=90, anchor=CENTER,
// Module: rounding_angled_corner_mask()
// Synopsis: Creates a shape to round the corner of an arbitrary angle.
// Topics: Masks, Rounding, Shapes (3D)
// See Also: rounding_angled_edge_mask(), rounding_corner_mask(), rounding_edge_mask()
// Usage:
// rounding_angled_corner_mask(r|d=, [ang]) [ATTACHMENTS];
// Description:
@ -389,6 +409,9 @@ module rounding_angled_corner_mask(r, ang=90, d, anchor=CENTER, spin=0, orient=U
// Module: rounding_cylinder_mask()
// Synopsis: Creates a shape to round the end of a cylinder.
// Topics: Masking, Rounding, Cylinders
// See Also: rounding_hole_mask()
// Usage:
// rounding_cylinder_mask(r|d=, rounding);
// Description:
@ -437,6 +460,9 @@ module rounding_cylinder_mask(r, rounding, d, anchor=CENTER, spin=0, orient=UP)
// Module: rounding_hole_mask()
// Synopsis: Creates a shape to round the edge of a round hole.
// Topics: Masking, Rounding
// See Also: rounding_cylinder_mask()
// Usage:
// rounding_hole_mask(r|d, rounding, [excess]) [ATTACHMENTS];
// Description:
@ -486,10 +512,13 @@ module rounding_hole_mask(r, rounding, excess=0.1, d, anchor=CENTER, spin=0, ori
// Section: Teardrop Masking
// Module: teardrop_edge_mask()
// Synopsis: Creates a shape to round a 90° edge but limit the angle of overhang.
// Topics: Masking, Rounding, Shapes (3D), FDM Optimized
// See Also: teardrop_corner_mask()
// Usage:
// teardrop_edge_mask(l|h=|length=|height=, r|d=, [angle], [excess], [anchor], [spin], [orient]) [ATTACHMENTS];
// Description:
// Makes an apropriate 3D corner rounding mask that keeps within `angle` degrees of vertical.
// Makes an apropriate 3D edge rounding mask that keeps within `angle` degrees of vertical.
// Arguments:
// l/h/length/height = length of mask
// r = Radius of the mask rounding.
@ -525,6 +554,9 @@ module teardrop_edge_mask(l, r, angle=45, excess=0.1, d, anchor=CTR, spin=0, ori
// Module: teardrop_corner_mask()
// Synopsis: Creates a shape to round a 90° corner but limit the angle of overhang.
// Topics: Masking, Rounding, Shapes (3D), FDM Optimized
// See Also: teardrop_edge_mask()
// Usage:
// teardrop_corner_mask(r|d=, [angle], [excess], [anchor], [spin], [orient]) [ATTACHMENTS];
// Description:

View File

@ -13,6 +13,9 @@
//////////////////////////////////////////////////////////////////////
// Module: bounding_box()
// Synopsis: Creates the smallest bounding box that contains all the children.
// Topics: Mutators, Bounds, Bounding Boxes
// See Also: pointlist_bounds()
// Usage:
// bounding_box([excess],[planar]) CHILDREN;
// Description:
@ -101,7 +104,9 @@ module bounding_box(excess=0, planar=false) {
// Module: chain_hull()
//
// Synopsis: Performs the union of hull operations between consecutive pairs of children.
// Topics: Mutators
// See Also: hull()
// Usage:
// chain_hull() CHILDREN;
//
@ -149,6 +154,9 @@ module chain_hull()
// Module: path_extrude2d()
// Synopsis: Extrudes 2D children along a 2D path.
// Topics: Mutators, Extrusion
// See Also: path_sweep(), path_extrude()
// Usage:
// path_extrude2d(path, [caps=], [closed=], [s=], [convexity=]) 2D-CHILDREN;
// Description:
@ -262,6 +270,9 @@ module path_extrude2d(path, caps=false, closed=false, s, convexity=10) {
// Module: cylindrical_extrude()
// Synopsis: Extrudes 2D children outwards around a cylinder.
// Topics: Mutators, Extrusion, Rotation
// See Also: heightfield(), cylindrical_heightfield(), cyl()
// Usage:
// cylindrical_extrude(ir|id=, or|od=, [size=], [convexity=], [spin=], [orient=]) 2D-CHILDREN;
// Description:
@ -321,6 +332,9 @@ module cylindrical_extrude(ir, or, od, id, size=1000, convexity=10, spin=0, orie
// Module: extrude_from_to()
// Extrudes 2D children between two points in 3D space.
// Topics: Extrusion, Mutators
// See Also: path_sweep(), path_extrude2d()
// Usage:
// extrude_from_to(pt1, pt2, [convexity=], [twist=], [scale=], [slices=]) 2D-CHILDREN;
// Description:
@ -359,10 +373,12 @@ module extrude_from_to(pt1, pt2, convexity, twist, scale, slices) {
// Module: path_extrude()
// Synopsis: Extrudes 2D children along a 3D path.
// Topics: Paths, Extrusion, Mutators
// See Also: path_sweep(), path_extrude2d()
// Usage: path_extrude(path, [convexity], [clipsize]) 2D-CHILDREN;
// Description:
// Extrudes 2D children along a 3D path. This may be slow and can have problems with twisting.
// See Also: path_sweep()
// Arguments:
// path = Array of points for the bezier path to extrude along.
// convexity = Maximum number of walls a ray can pass through.
@ -418,6 +434,9 @@ module path_extrude(path, convexity=10, clipsize=100) {
//////////////////////////////////////////////////////////////////////
// Module: minkowski_difference()
// Synopsis: Removes diff shapes from base shape surface.
// Topics: Mutators
// See Also: offset3d()
// Usage:
// minkowski_difference() { BASE; DIFF1; DIFF2; ... }
// Description:
@ -454,6 +473,9 @@ module minkowski_difference(planar=false) {
// Module: offset3d()
// Synopsis: Expands or contracts the surface of a 3D object.
// Topics: Mutators
// See Also: minkowski_difference(), round3d()
// Usage:
// offset3d(r, [size], [convexity]) CHILDREN;
// Description:
@ -493,6 +515,9 @@ module offset3d(r, size=100, convexity=10) {
// Module: round3d()
// Synopsis: Rounds arbitrary 3d objects.
// Topics: Rounding, Mutators
// See Also: offset3d(), minkowski_difference()
// Usage:
// round3d(r) CHILDREN;
// round3d(or) CHILDREN;

View File

@ -12,6 +12,9 @@
// Section: Planar Cutting
// Function&Module: half_of()
// Synopsis: Masks half of an object at a cut plane.
// Topics: Partitions, Masking
// See Also: back_half(), front_half(), left_half(), right_half(), top_half(), bottom_half()
//
// Usage: as module
// half_of(v, [cp], [s], [planar]) CHILDREN;
@ -118,6 +121,9 @@ function half_of(p, v=UP, cp) =
// Function&Module: left_half()
// Synopsis: Masks the right half of an object along the Y-Z plane, leaving the left half.
// Topics: Partitions, Masking
// See Also: back_half(), front_half(), right_half(), top_half(), bottom_half(), half_of()
//
// Usage: as module
// left_half([s], [x]) CHILDREN;
@ -161,6 +167,9 @@ function left_half(p,x=0) = half_of(p, LEFT, [x,0,0]);
// Function&Module: right_half()
// Synopsis: Masks the left half of an object along the Y-Z plane, leaving the right half.
// Topics: Partitions, Masking
// See Also: back_half(), front_half(), left_half(), top_half(), bottom_half(), half_of()
//
// Usage: as module
// right_half([s=], [x=]) CHILDREN;
@ -202,6 +211,9 @@ function right_half(p,x=0) = half_of(p, RIGHT, [x,0,0]);
// Function&Module: front_half()
// Synopsis: Masks the back half of an object along the X-Z plane, leaving the front half.
// Topics: Partitions, Masking
// See Also: back_half(), left_half(), right_half(), top_half(), bottom_half(), half_of()
//
// Usage:
// front_half([s], [y]) CHILDREN;
@ -244,6 +256,9 @@ function front_half(p,y=0) = half_of(p, FRONT, [0,y,0]);
// Function&Module: back_half()
// Synopsis: Masks the front half of an object along the X-Z plane, leaving the back half.
// Topics: Partitions, Masking
// See Also: front_half(), left_half(), right_half(), top_half(), bottom_half(), half_of()
//
// Usage:
// back_half([s], [y]) CHILDREN;
@ -286,6 +301,9 @@ function back_half(p,y=0) = half_of(p, BACK, [0,y,0]);
// Function&Module: bottom_half()
// Synopsis: Masks the top half of an object along the X-Y plane, leaving the bottom half.
// Topics: Partitions, Masking
// See Also: back_half(), front_half(), left_half(), right_half(), top_half(), half_of()
//
// Usage:
// bottom_half([s], [z]) CHILDREN;
@ -320,6 +338,9 @@ function bottom_half(p,z=0) = half_of(p,BOTTOM,[0,0,z]);
// Function&Module: top_half()
// Synopsis: Masks the bottom half of an object along the X-Y plane, leaving the top half.
// Topics: Partitions, Masking
// See Also: back_half(), front_half(), left_half(), right_half(), bottom_half(), half_of()
//
// Usage: as module
// top_half([s], [z]) CHILDREN;
@ -398,6 +419,9 @@ function _partition_cutpath(l, h, cutsize, cutpath, gap) =
// Module: partition_mask()
// Synopsis: Creates a mask to remove half an object with the remaining half suitable for reassembly.
// Topics: Partitions, Masking, Paths
// See Also: partition_cut_mask(), partition()
// Usage:
// partition_mask(l, w, h, [cutsize], [cutpath], [gap], [inverse], [$slop=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
@ -448,6 +472,9 @@ module partition_mask(l=100, w=100, h=100, cutsize=10, cutpath="jigsaw", gap=0,
// Module: partition_cut_mask()
// Synopsis: Creates a mask to cut an object into two subparts that can be reassembled.
// Topics: Partitions, Masking, Paths
// See Also: partition_mask(), partition()
// Usage:
// partition_cut_mask(l, w, h, [cutsize], [cutpath], [gap], [inverse], [$slop=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
@ -491,6 +518,9 @@ module partition_cut_mask(l=100, h=100, cutsize=10, cutpath="jigsaw", gap=0, anc
// Module: partition()
// Synopsis: Cuts an object in two with matched joining edges, then separates the parts .
// Topics: Partitions, Masking, Paths
// See Also: partition_cut_mask(), partition_mask()
// Usage:
// partition(size, [spread], [cutsize], [cutpath], [gap], [spin], [$slop=]) CHILDREN;
// Description:

View File

@ -18,6 +18,9 @@
// Section: Utility Functions
// Function: is_path()
// Synopsis: Returns True if 'list' is a path.
// Topics: Paths
// See Also: is_region(), is_vnf()
// Usage:
// is_path(list, [dim], [fast])
// Description:
@ -55,6 +58,9 @@ function is_path(list, dim=[2,3], fast=false) =
&& (is_undef(dim) || in_list(len(list[0]), force_list(dim)));
// Function: is_1region()
// Synopsis: Returns true if path is a region with one component.
// Topics: Paths, Regions
// See Also: force_path()
// Usage:
// bool = is_1region(path, [name])
// Description:
@ -71,6 +77,9 @@ function is_1region(path, name="path") =
// Function: force_path()
// Synopsis: Checks that path is a region with one component.
// Topics: Paths, Regions
// See Also: is_1region()
// Usage:
// outpath = force_path(path, [name])
// Description:
@ -119,6 +128,8 @@ function _path_select(path, s1, u1, s2, u2, closed=false) =
// Function: path_merge_collinear()
// Synopsis: Removes unnecessary points from a path.
// Topics: Paths, Regions
// Description:
// Takes a path and removes unnecessary sequential collinear points.
// Usage:
@ -149,6 +160,9 @@ function path_merge_collinear(path, closed, eps=EPSILON) =
// Function: path_length()
// Synopsis: Returns the path length.
// Topics: Paths
// See Also: path_segment_lengths(), path_length_fractions()
// Usage:
// path_length(path,[closed])
// Description:
@ -169,6 +183,9 @@ function path_length(path,closed) =
// Function: path_segment_lengths()
// Synopsis: Returns a list of the lengths of segments in a path.
// Topics: Paths
// See Also: path_length(), path_length_fractions()
// Usage:
// path_segment_lengths(path,[closed])
// Description:
@ -188,6 +205,9 @@ function path_segment_lengths(path, closed) =
// Function: path_length_fractions()
// Synopsis: Returns the fractional distance of each point along the length of a path.
// Topics: Paths
// See Also: path_length(), path_segment_lengths()
// Usage:
// fracs = path_length_fractions(path, [closed]);
// Description:
@ -274,7 +294,7 @@ function _path_self_intersections(path, closed=true, eps=EPSILON) =
[isect[0], i, isect[1], j, isect[2]]
];
// Section: Resampling&mdash;changing the number of points in a path
// Section: Resampling - changing the number of points in a path
// Input `data` is a list that sums to an integer.
@ -295,6 +315,8 @@ function _sum_preserving_round(data, index=0) =
// Function: subdivide_path()
// Synopsis: Subdivides a path to produce a more finely sampled path.
// Topics: Paths, Path Subdivision
// See Also: subdivide_and_slice(), resample_path(), jittered_poly()
// Usage:
// newpath = subdivide_path(path, n|refine=|maxlen=, [method=], [closed=], [exact=]);
@ -438,6 +460,9 @@ function subdivide_path(path, n, refine, maxlen, closed=true, exact, method) =
// Function: resample_path()
// Synopsis: Returns an equidistant set of points along a path.
// Topics: Paths
// See Also: subdivide_path()
// Usage:
// newpath = resample_path(path, n|spacing=, [closed=]);
// Description:
@ -498,6 +523,9 @@ function resample_path(path, n, spacing, closed=true) =
// Section: Path Geometry
// Function: is_path_simple()
// Synopsis: Returns true if a path has no self intersections.
// Topics: Paths
// See Also: is_path()
// Usage:
// bool = is_path_simple(path, [closed], [eps]);
// Description:
@ -528,15 +556,18 @@ function is_path_simple(path, closed, eps=EPSILON) =
// Function: path_closest_point()
// Synopsis: Returns the closest place on a path to a given point.
// Topics: Paths
// See Also: point_line_distance(), line_closest_point()
// Usage:
// index_pt = path_closest_point(path, pt);
// Description:
// Finds the closest path segment, and point on that segment to the given point.
// Returns `[SEGNUM, POINT]`
// Arguments:
// path = path of any dimension or a 1-region
// pt = the point to find the closest point to
// closed =
// path = Path of any dimension or a 1-region.
// pt = The point to find the closest point to.
// closed = If true, the path is considered closed.
// Example(2D):
// path = circle(d=100,$fn=6);
// pt = [20,10];
@ -557,6 +588,9 @@ function path_closest_point(path, pt, closed=true) =
// Function: path_tangents()
// Synopsis: Returns tangent vectors for each point along a path.
// Topics: Paths
// See Also: path_normals()
// Usage:
// tangs = path_tangents(path, [closed], [uniform]);
// Description:
@ -593,6 +627,9 @@ function path_tangents(path, closed, uniform=true) =
// Function: path_normals()
// Synopsis: Returns normal vectors for each point along a path.
// Topics: Paths
// See Also: path_tangents()
// Usage:
// norms = path_normals(path, [tangents], [closed]);
// Description:
@ -635,6 +672,9 @@ function path_normals(path, tangents, closed) =
// Function: path_curvature()
// Synopsis: Returns the estimated numerical curvature of the path.
// Topics: Paths
// See Also: path_tangents(), path_normals(), path_torsion()
// Usage:
// curvs = path_curvature(path, [closed]);
// Description:
@ -660,6 +700,9 @@ function path_curvature(path, closed) =
// Function: path_torsion()
// Synopsis: Returns the estimated numerical torsion of the path.
// Topics: Paths
// See Also: path_tangents(), path_normals(), path_curvature()
// Usage:
// torsions = path_torsion(path, [closed]);
// Description:
@ -686,8 +729,9 @@ function path_torsion(path, closed=false) =
// Function: path_cut()
// Topics: Paths
// See Also: split_path_at_self_crossings()
// Synopsis: Cuts a path into subpaths at various points.
// Topics: Paths, Path Subdivision
// See Also: split_path_at_self_crossings(), path_cut_points()
// Usage:
// path_list = path_cut(path, cutdist, [closed]);
// Description:
@ -746,7 +790,9 @@ function _path_cut_getpaths(path, cutlist, closed) =
// Function: path_cut_points()
//
// Synopsis: Returns a list of cut points at a list of distances from the first point in a path.
// Topics: Paths, Path Subdivision
// See Also: path_cut(), split_path_at_self_crossings()
// Usage:
// cuts = path_cut_points(path, cutdist, [closed=], [direction=]);
//
@ -882,6 +928,9 @@ function _cut_to_seg_u_form(pathcut, path, closed) =
// Function: split_path_at_self_crossings()
// Synopsis: Split a 2D path wherever it crosses itself.
// Topics: Paths, Path Subdivision
// See Also: path_cut(), path_cut_points()
// Usage:
// paths = split_path_at_self_crossings(path, [closed], [eps]);
// Description:
@ -949,6 +998,9 @@ function _tag_self_crossing_subpaths(path, nonzero, closed=true, eps=EPSILON) =
// Function: polygon_parts()
// Synopsis: Parses a self-intersecting polygon into a list of non-intersecting polygons.
// Topics: Paths, Polygons
// See Also: split_path_at_self_crossings(), path_cut(), path_cut_points()
// Usage:
// splitpolys = polygon_parts(poly, [nonzero], [eps]);
// Description:

View File

@ -14,7 +14,11 @@ include <structs.scad>
// Section: Phillips Drive
// Module: phillips_mask()
// Usage: phillips_mask(size) [ATTACHMENTS];
// Synopsis: Creates a mask for a Philips screw drive.
// Topics: Screws, Masks
// See Also: hex_drive_mask(), phillips_depth(), phillips_diam(), torx_mask(), robertson_mask()
// Usage:
// phillips_mask(size) [ATTACHMENTS];
// Description:
// Creates a mask for creating a Phillips drive recess given the Phillips size. Each mask can
// be lowered to different depths to create different sizes of recess.
@ -82,6 +86,9 @@ module phillips_mask(size="#2", $fn=36, anchor=BOTTOM, spin=0, orient=UP) {
// Function: phillips_depth()
// Synopsis: Returns the depth a phillips recess needs to be for a given diameter.
// Topics: Screws, Masks
// See Also: phillips_mask(), hex_drive_mask(), phillips_depth(), phillips_diam(), torx_mask()
// Usage:
// depth = phillips_depth(size, d);
// Description:
@ -104,6 +111,9 @@ function phillips_depth(size, d) =
// Function: phillips_diam()
// Synopsis: Returns the diameter of a phillips recess of a given depth.
// Topics: Screws, Masks
// See Also: phillips_mask(), hex_drive_mask(), phillips_depth(), phillips_diam(), torx_mask()
// Usage:
// diam = phillips_diam(size, depth);
// Description:
@ -127,7 +137,10 @@ function phillips_diam(size, depth) =
// Section: Hex drive
// Module hex_drive_mask()
// Module: hex_drive_mask()
// Synopsis: Creates a mask for a hex drive recess.
// Topics: Screws, Masks
// See Also: phillips_mask(), hex_drive_mask(), torx_mask(), phillips_depth(), phillips_diam(), robertson_mask()
// Usage:
// hex_drive_mask(size, length, [anchor], [spin], [orient], [$slop]) [ATTACHMENTS];
// Description:
@ -147,6 +160,9 @@ function hex_drive_mask(size,length,l,h,height,anchor,spin,orient) = no_function
// Section: Torx Drive
// Module: torx_mask()
// Synopsis: Creates a mask for a torx drive recess.
// Topics: Screws, Masks
// See Also: phillips_mask(), hex_drive_mask(), torx_mask(), phillips_depth(), phillips_diam(), robertson_mask()
// Usage:
// torx_mask(size, l, [center]) [ATTACHMENTS];
// Description: Creates a torx bit tip.
@ -174,6 +190,9 @@ module torx_mask(size, l=5, center, anchor, spin=0, orient=UP) {
// Module: torx_mask2d()
// Synopsis: Creates the 2D cross section for a torx drive recess.
// Topics: Screws, Masks
// See Also: phillips_mask(), hex_drive_mask(), torx_mask(), phillips_depth(), phillips_diam(), torx_info(), robertson_mask()
// Usage:
// torx_mask2d(size);
// Description: Creates a torx bit 2D profile.
@ -215,6 +234,9 @@ module torx_mask2d(size) {
// Function: torx_info()
// Synopsis: Returns the dimensions of a torx drive.
// Topics: Screws, Masks
// See Also: phillips_mask(), hex_drive_mask(), torx_mask(), phillips_depth(), phillips_diam(), torx_info()
// Usage:
// info = torx_info(size);
// Description:
@ -263,6 +285,9 @@ function torx_info(size) =
// Function: torx_diam()
// Synopsis: Returns the diameter of a torx drive.
// Topics: Screws, Masks
// See Also: phillips_mask(), hex_drive_mask(), torx_mask(), phillips_depth(), phillips_diam(), torx_info()
// Usage:
// diam = torx_diam(size);
// Description: Get the typical outer diameter of Torx profile.
@ -272,6 +297,9 @@ function torx_diam(size) = torx_info(size)[0];
// Function: torx_depth()
// Synopsis: Returns the typical depth of a torx drive recess.
// Topics: Screws, Masks
// See Also: phillips_mask(), hex_drive_mask(), torx_mask(), phillips_depth(), phillips_diam(), torx_info()
// Usage:
// depth = torx_depth(size);
// Description: Gets typical drive hole depth.
@ -284,6 +312,9 @@ function torx_depth(size) = torx_info(size)[2];
// Section: Robertson/Square Drives
// Module: robertson_mask()
// Synopsis: Creates a mask for a Robertson/Square drive recess.
// Topics: Screws, Masks
// See Also: phillips_mask(), hex_drive_mask(), torx_mask(), phillips_depth(), phillips_diam(), torx_info(), robertson_mask()
// Usage:
// robertson_mask(size, [extra], [ang], [$slop=]);
// Description:

View File

@ -188,26 +188,28 @@ Torx values: https://www.stanleyengineeredfastening.com/-/media/web/sef/resourc
// Section: Making Screws
// Module: screw()
// Synopsis: Creates a standard screw with optional tolerances.
// Topics: Threading, Screws
// See Also: screw_hole(), shoulder_screw()
// Usage:
// screw([spec], [head], [drive], [thread=], [drive_size=], [length=|l=], [thread_len=], [undersize=], [shaft_undersize=], [head_undersize=], [tolerance=], [blunt_start=], [details=], [anchor=], [atype=], [orient=], [spin=]) [ATTACHMENTS];
// Description:
// Create a screw. See [screw and nut parameters](#section-screw-and-nut-parameters) for details on the parameters that define a screw.
// The tolerance determines the dimensions of the screw
// based on ISO and ASME standards. Screws fabricated at those dimensions will mate properly with standard hardware.
// Note that the $slop argument does not affect the size of screws: it only adjusts screw holes. This will work fine
// if you are printing both parts, but if you need to mate printed screws to metal parts you may need to adjust the size
// of the screws, which you can do with the undersize arguments.
// Create a screw. See [screw and nut parameters](#section-screw-and-nut-parameters) for details on
// the parameters that define a screw. The tolerance determines the dimensions of the screw based
// on ISO and ASME standards. Screws fabricated at those dimensions will mate properly with
// standard hardware. Note that the $slop argument does not affect the size of screws: it only
// adjusts screw holes. This will work fine if you are printing both parts, but if you need to mate
// printed screws to metal parts you may need to adjust the size of the screws, which you can do
// with the undersize arguments.
// .
// You can generate a screw specification from {{screw_info()}}, possibly create a modified version using {{struct_set()}}, and pass that in rather than giving the parameters.
// You can generate a screw specification from {{screw_info()}}, possibly create a modified version
// using {{struct_set()}}, and pass that in rather than giving the parameters.
// .
// Various anchor types refer to different parts of the screw, some
// of which are labeled below. The "screw" anchor type (the
// default) is simply the entire screw, so TOP and BOTTOM refer to
// the head end and tip respectively, and CENTER is the midpoint of
// the whole screw, including the head. The "head" anchor refers to
// the head alone. Both of these anchor types refer to the bounding
// cylinder for the specified screw part, except for hex heads,
// which anchor to a hexagonal prism.
// Various anchor types refer to different parts of the screw, some of which are labeled below. The
// "screw" anchor type (the default) is simply the entire screw, so TOP and BOTTOM refer to the head
// end and tip respectively, and CENTER is the midpoint of the whole screw, including the head. The
// "head" anchor refers to the head alone. Both of these anchor types refer to the bounding
// cylinder for the specified screw part, except for hex heads, which anchor to a hexagonal prism.
// Figure(2D,Med,VPD = 140, VPT = [18.4209, 14.9821, -3.59741], VPR = [0, 0, 0],NoAxes):
// rpos=33;
// fsize=2.5;
@ -717,6 +719,9 @@ module screw(spec, head, drive, thread, drive_size,
// Module: screw_hole()
// Synopsis: Creates a screw hole.
// Topics: Threading, Screws
// See Also: screw()
// Usage:
// screw_hole([spec], [head], [thread=], [length=|l=], [oversize=], [hole_oversize=], [teardrop=], [head_oversize], [tolerance=], [$slop=], [blunt_start=], [anchor=], [atype=], [orient=], [spin=]) [ATTACHMENTS];
// Description:
@ -971,6 +976,9 @@ module screw_hole(spec, head, thread, oversize, hole_oversize, head_oversize,
}
// Module: shoulder_screw()
// Synopsis: Creates a shoulder screw.
// Topics: Threading, Screws
// See Also: screw(), screw_hole()
// Usage:
// shoulder_screw(s, d, length, [head=], [thread_len=], [tolerance=], [head_size=], [drive=], [drive_size=], [thread=], [undersize=], [shaft_undersize=], [head_undersize=], [shoulder_undersize=],[atype=],[anchor=],[orient=],[spin=]) [ATTACHMENTS];
// Description:
@ -1381,6 +1389,9 @@ function _parse_drive(drive=undef, drive_size=undef) =
// Module: screw_head()
// Synopsis: Creates a screw head.
// Topics: Threading, Screws
// See Also: screw(), screw_hole()
// Usage:
// screw_head(screw_info, [details],[counterbore],[flat_height],[teardrop],[internal])
// Description:
@ -1481,9 +1492,11 @@ module screw_head(screw_info,details=false, counterbore=0,flat_height,teardrop=f
// Module: nut()
// Synopsis: Creates a standard nut.
// Topics: Threading, Screws
// See Also: screw(), screw_hole()
// Usage:
// nut([spec], [shape], [thickness], [nutwidth], [thread=], [tolerance=], [hole_oversize=], [bevel=], [$slop=], [anchor=], [spin=], [orient=]) [ATTACHMENTS];
// Description:
// Generates a hexagonal or square nut. See [screw and nut parameters](#section-screw-and-nut-parameters) for details on the parameters that define a nut.
// As with screws, you can give the specification in `spec` and then omit the name. The diameter is the flat-to-flat
@ -1601,6 +1614,9 @@ module nut(spec, shape, thickness, nutwidth, thread, tolerance, hole_oversize,
// Module: nut_trap_side()
// Synopsis: Creates a side nut trap mask.
// Topics: Threading, Screws
// See Also: screw(), screw_hole()
// Usage:
// nut_trap_side(trap_width, [spec], [shape], [thickness], [nutwidth=], [poke_len=], [poke_diam=], [$slop=], [anchor=], [orient=], [spin=]) [ATTACHMENTS];
// Description:
@ -1688,6 +1704,9 @@ module nut_trap_side(trap_width, spec, shape, thickness, nutwidth, anchor=BOT, o
}
// Module: nut_trap_inline()
// Synopsis: Creates an inline nut trap mask.
// Topics: Threading, Screws
// See Also: screw(), screw_hole()
// Usage:
// nut_trap_inline(length|l|heigth|h, [spec], [shape], [$slop=], [anchor=], [orient=], [spin=]) [ATTACHMENTS];
// Description:
@ -1756,6 +1775,9 @@ module nut_trap_inline(length, spec, shape, l, height, h, nutwidth, anchor, orie
// Function: screw_info()
// Synopsis: Returns the dimensions and other info for the given screw.
// Topics: Threading, Screws
// See Also: screw(), screw_hole()
// Usage:
// info = screw_info(name, [head], [drive], [thread=], [drive_size=], [oversize=], [head_oversize=])
// Description:
@ -1846,6 +1868,9 @@ function screw_info(name, head, drive, thread, drive_size, shaft_oversize, head_
// Function: nut_info()
// Synopsis: Returns the dimensions and other info for the given nut.
// Topics: Threading, Screws
// See Also: screw(), screw_hole()
// Usage:
// nut_spec = nut_info(name, [shape], [thickness=], [thread=], [width=], [hole_oversize=]);
// Description:
@ -2903,6 +2928,9 @@ function _validate_screw_spec(spec) =
// Function: thread_specification()
// Synopsis: Returns the thread geometry for a given screw.
// Topics: Threading, Screws
// See Also: screw(), screw_hole()
// Usage:
// thread_specification(screw_spec, [tolerance], [internal])
// Description:
@ -2991,6 +3019,3 @@ http://files.engineering.com/getfile.aspx?folder=76fb0d5e-1fff-4c49-87a5-0597947
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap

View File

@ -24,7 +24,6 @@ use <builtins.scad>
// Synopsis: Creates a 2D square or rectangle.
// Topics: Shapes (2D), Path Generators (2D)
// See Also: rect()
//
// Usage: As a Module
// square(size, [center], ...);
// Usage: With Attachments
@ -214,7 +213,6 @@ function rect(size=1, rounding=0, chamfer=0, atype="box", anchor=CENTER, spin=0,
// Synopsis: Creates the approximation of a circle.
// Topics: Shapes (2D), Path Generators (2D)
// See Also: ellipse(), circle_2tangents(), circle_3points()
//
// Usage: As a Module
// circle(r|d=, ...) [ATTACHMENTS];
// circle(points=) [ATTACHMENTS];
@ -319,7 +317,6 @@ module circle(r, d, points, corner, anchor=CENTER, spin=0) {
// Synopsis: Creates the approximation of an ellipse or a circle.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: circle(), circle_2tangents(), circle_3points()
// Usage: As a Module
// ellipse(r|d=, [realign=], [circum=], [uniform=], ...) [ATTACHMENTS];
// Usage: As a Function
@ -504,7 +501,6 @@ function ellipse(r, d, realign=false, circum=false, uniform=false, anchor=CENTER
// Synopsis: Creates a regular N-sided polygon.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: debug_polygon(), circle(), pentagon(), hexagon(), octagon(), ellipse(), star()
// Usage:
// regular_ngon(n, r|d=|or=|od=, [realign=]) [ATTACHMENTS];
// regular_ngon(n, ir=|id=, [realign=]) [ATTACHMENTS];
@ -645,7 +641,6 @@ module regular_ngon(n=6, r, d, or, od, ir, id, side, rounding=0, realign=false,
// Synopsis: Creates a regular pentagon.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: circle(), regular_ngon(), hexagon(), octagon(), ellipse(), star()
// Usage:
// pentagon(or|od=, [realign=], [align_tip=|align_side=]) [ATTACHMENTS];
// pentagon(ir=|id=, [realign=], [align_tip=|align_side=]) [ATTACHMENTS];
@ -705,7 +700,6 @@ module pentagon(r, d, or, od, ir, id, side, rounding=0, realign=false, align_tip
// Synopsis: Creates a regular hexagon.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: circle(), regular_ngon(), pentagon(), octagon(), ellipse(), star()
// Usage: As Module
// hexagon(r/or, [realign=], <align_tip=|align_side=>, [rounding=], ...) [ATTACHMENTS];
// hexagon(d=/od=, ...) [ATTACHMENTS];
@ -766,7 +760,6 @@ module hexagon(r, d, or, od, ir, id, side, rounding=0, realign=false, align_tip,
// Synopsis: Creates a regular octagon.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: circle(), regular_ngon(), pentagon(), hexagon(), ellipse(), star()
// Usage: As Module
// octagon(r/or, [realign=], [align_tip=|align_side=], [rounding=], ...) [ATTACHMENTS];
// octagon(d=/od=, ...) [ATTACHMENTS];
@ -826,7 +819,6 @@ module octagon(r, d, or, od, ir, id, side, rounding=0, realign=false, align_tip,
// Synopsis: Creates a right triangle.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: square(), rect(), regular_ngon(), pentagon(), hexagon(), octagon(), star()
// Usage: As Module
// right_triangle(size, [center], ...) [ATTACHMENTS];
// Usage: As Function
@ -839,13 +831,20 @@ module octagon(r, d, or, od, ir, id, side, rounding=0, realign=false, align_tip,
// ---
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
// Extra Anchors:
// hypot = Center of angled side, perpendicular to that side.
// Example(2D):
// right_triangle([40,30]);
// Example(2D): With `center=true`
// right_triangle([40,30], center=true);
// Example(2D): Anchors
// right_triangle([40,30])
// show_anchors();
// Example(2D): Standard Anchors
// right_triangle([80,30], center=true)
// show_anchors(custom=false);
// color([0.5,0.5,0.5,0.1])
// square([80,30], center=true);
// Example(2D): Named Anchors
// right_triangle([80,30], center=true)
// show_anchors(std=false);
function right_triangle(size=[1,1], center, anchor, spin=0) =
let(
size = is_num(size)? [size,size] : size,
@ -854,15 +853,21 @@ function right_triangle(size=[1,1], center, anchor, spin=0) =
assert(is_vector(size,2))
assert(min(size)>0, "Must give positive size")
let(
path = [ [size.x/2,-size.y/2], [-size.x/2,-size.y/2], [-size.x/2,size.y/2] ]
) reorient(anchor,spin, two_d=true, size=[size.x,size.y], size2=0, shift=-size.x/2, p=path);
path = [ [size.x/2,-size.y/2], [-size.x/2,-size.y/2], [-size.x/2,size.y/2] ],
anchors = [
named_anchor("hypot", CTR, unit([size.y,size.x])),
]
) reorient(anchor,spin, two_d=true, size=[size.x,size.y], anchors=anchors, p=path);
module right_triangle(size=[1,1], center, anchor, spin=0) {
size = is_num(size)? [size,size] : size;
anchor = get_anchor(anchor, center, [-1,-1], [-1,-1]);
check = assert(is_vector(size,2));
path = right_triangle(size, center=true);
attachable(anchor,spin, two_d=true, size=[size.x,size.y], size2=0, shift=-size.x/2) {
path = right_triangle(size, anchor="origin");
anchors = [
named_anchor("hypot", CTR, unit([size.y,size.x])),
];
attachable(anchor,spin, two_d=true, size=[size.x,size.y], anchors=anchors) {
polygon(path);
children();
}
@ -873,7 +878,6 @@ module right_triangle(size=[1,1], center, anchor, spin=0) {
// Synopsis: Creates a trapezoid with parallel top and bottom sides.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: rect(), square()
// Usage: As Module
// trapezoid(h, w1, w2, [shift=], [rounding=], [chamfer=], [flip=], ...) [ATTACHMENTS];
// trapezoid(h, w1, ang=, [rounding=], [chamfer=], [flip=], ...) [ATTACHMENTS];
@ -1062,7 +1066,7 @@ function trapezoid(h, w1, w2, ang, shift, chamfer=0, rounding=0, flip=false, anc
module trapezoid(h, w1, w2, ang, shift, chamfer=0, rounding=0, flip=false, anchor=CENTER, spin=0, atype="box", angle) {
path_over = trapezoid(h=h, w1=w1, w2=w2, ang=ang, shift=shift, chamfer=chamfer, rounding=rounding,
flip=flip, angle=angle,atype=atype,_return_override=true);
flip=flip, angle=angle,atype=atype,anchor="origin",_return_override=true);
path=path_over[0];
override = path_over[1];
ang = force_list(ang,2);
@ -1083,7 +1087,6 @@ module trapezoid(h, w1, w2, ang, shift, chamfer=0, rounding=0, flip=false, ancho
// Synopsis: Creates a star-shaped polygon or returns a star-shaped region.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: circle(), ellipse(), regular_ngon()
//
// Usage: As Module
// star(n, r/or, ir, [realign=], [align_tip=], [align_pit=], ...) [ATTACHMENTS];
// star(n, r/or, step=, ...) [ATTACHMENTS];
@ -1252,7 +1255,6 @@ function _path_add_jitter(path, dist=1/512, closed=true) =
// Synopsis: Creates a polygon with extra points for smoother twisted extrusions.
// Topics: Extrusions
// See Also: subdivide_path()
//
// Usage:
// jittered_poly(path, [dist]);
// Description:
@ -1281,7 +1283,6 @@ module jittered_poly(path, dist=1/512) {
// Synopsis: Creates a 2D teardrop shape.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: teardrop(), onion()
//
// Description:
// Makes a 2D teardrop shape. Useful for extruding into 3D printable holes as it limits overhang to 45 degrees. Uses "intersect" style anchoring.
// The cap_h parameter truncates the top of the teardrop. If cap_h is taller than the untruncated form then
@ -1380,7 +1381,6 @@ function teardrop2d(r, ang=45, cap_h, d, circum=false, realign=false, anchor=CEN
// Synopsis: Creates an egg-shaped 2d object.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: circle(), ellipse(), glued_circles()
//
// Usage: As Module
// egg(length, r1|d1=, r2|d2=, R|D=) [ATTACHMENTS];
// Usage: As Function
@ -1469,7 +1469,6 @@ module egg(length,r1,r2,R,d1,d2,D,anchor=CENTER, spin=0)
// Synopsis: Creates a shape of two circles joined by a curved waist.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: circle(), ellipse(), egg()
//
// Usage: As Module
// glued_circles(r/d=, [spread], [tangent], ...) [ATTACHMENTS];
// Usage: As Function
@ -1539,7 +1538,6 @@ function _superformula(theta,m1,m2,n1,n2=1,n3=1,a=1,b=1) =
// Synopsis: Creates a 2D [Superformula](https://en.wikipedia.org/wiki/Superformula) shape.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: circle(), ellipse()
//
// Usage: As Module
// supershape([step],[n=], [m1=], [m2=], [n1=], [n2=], [n3=], [a=], [b=], [r=/d=]) [ATTACHMENTS];
// Usage: As Function
@ -1622,7 +1620,6 @@ module supershape(step=0.5,n,m1=4,m2=undef,n1,n2=undef,n3=undef,a=1,b=undef, r=u
// Synopsis: Creates a constant-width shape that is not circular.
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
// See Also: regular_ngon(), pentagon(), hexagon(), octagon()
//
// Usage: As Module
// reuleaux_polygon(n, r|d=, ...) [ATTACHMENTS];
// Usage: As Function
@ -1691,7 +1688,7 @@ function reuleaux_polygon(n=3, r, d, anchor=CENTER, spin=0) =
// Module: text()
// Synopsis: Creates an attachable block of text.
// Topics: Attachments, Text
// See Also: text3d()
// See Also: text3d(), attachable()
// Usage:
// text(text, [size], [font], ...);
// Description:
@ -1730,7 +1727,6 @@ function reuleaux_polygon(n=3, r, d, anchor=CENTER, spin=0) =
// script = The script the text is in. Default: `"latin"`
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `"baseline"`
// spin = Rotate this many degrees around the Z axis. See [spin](attachments.scad#subsection-spin). Default: `0`
// See Also: attachable()
// Extra Anchors:
// "baseline" = Anchors at the baseline of the text, at the start of the string.
// str("baseline",VECTOR) = Anchors at the baseline of the text, modified by the X and Z components of the appended vector.
@ -1803,7 +1799,8 @@ module text(text, size=10, font="Helvetica", halign, valign, spacing=1.0, direct
// Module: round2d()
// Synopsis: Rounds the corners of 2d objects.
// Topics: Rounding
// See Also: shell2d(), round3d(), minkowski_difference()
// Usage:
// round2d(r) [ATTACHMENTS];
// round2d(or=) [ATTACHMENTS];
@ -1834,7 +1831,8 @@ module round2d(r, or, ir)
// Module: shell2d()
// Synopsis: Creates a shell from 2D children.
//
// Topics: Shell
// See Also: round2d(), round3d(), minkowski_difference()
// Usage:
// shell2d(thickness, [or], [ir])
// Description:

View File

@ -21,7 +21,6 @@ use <builtins.scad>
// Synopsis: Creates a cube with anchors for attaching children, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See Also: cuboid(), prismoid()
//
// Usage: As Module (as in native OpenSCAD)
// cube(size, [center]);
// Usage: With BOSL2 Attachment extensions
@ -92,7 +91,6 @@ function cube(size=1, center, anchor, spin=0, orient=UP) =
// Synopsis: Creates a cube with chamfering and roundovers, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See Also: prismoid(), rounded_prism()
//
// Usage: Standard Cubes
// cuboid(size, [anchor=], [spin=], [orient=]);
// cuboid(size, p1=, ...);
@ -571,7 +569,6 @@ function cuboid(
// Synopsis: Creates a rectangular prismoid shape with optional roundovers and chamfering, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See Also: cuboid(), rounded_prism(), trapezoid()
//
// Usage:
// prismoid(size1, size2, [h|l|height|length], [shift], [xang=], [yang=], ...) [ATTACHMENTS];
// Usage: Chamfered and/or Rounded Prismoids
@ -776,8 +773,6 @@ function prismoid(
// Synopsis: Creates an octahedron with axis-aligned points, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See Also: prismoid()
// Usage: As Module
// octahedron(size, ...) [ATTACHMENTS];
// Usage: As Function
@ -819,7 +814,6 @@ function octahedron(size=1, anchor=CENTER, spin=0, orient=UP) =
// Synopsis: Creates a rectangular tube, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See Also: tube()
//
// Usage: Typical Rectangular Tubes
// rect_tube(h, size, isize, [center], [shift]);
// rect_tube(h, size, wall=, [center=]);
@ -1093,7 +1087,6 @@ function rect_tube(
// Synopsis: Creates a 3d triangular wedge, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See also: prismoid(), rounded_prism(), pie_slice()
//
// Usage: As Module
// wedge(size, [center], ...) [ATTACHMENTS];
// Usage: As Function
@ -1111,19 +1104,35 @@ function rect_tube(
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
//
// Extra Anchors:
// hypot = Center of angled wedge face, perpendicular to that face.
// hypot_left = Left side of angled wedge face, bisecting the angle between the left side and angled faces.
// hypot_right = Right side of angled wedge face, bisecting the angle between the right side and angled faces.
//
// Example: Centered
// wedge([20, 40, 15], center=true);
// Example: *Non*-Centered
// wedge([20, 40, 15]);
// Example: Standard Connectors
// wedge([20, 40, 15]) show_anchors();
// Example: Standard Anchors
// wedge([40, 80, 30], center=true)
// show_anchors(custom=false);
// color([0.5,0.5,0.5,0.1])
// cube([40, 80, 30], center=true);
// Example: Named Anchors
// wedge([40, 80, 30], center=true)
// show_anchors(std=false);
module wedge(size=[1, 1, 1], center, anchor, spin=0, orient=UP)
{
size = scalar_vec3(size);
anchor = get_anchor(anchor, center, -[1,1,1], -[1,1,1]);
vnf = wedge(size, center=true);
attachable(anchor,spin,orient, size=size, size2=[size.x,0], shift=[0,-size.y/2]) {
vnf = wedge(size, anchor="origin");
anchors = [
named_anchor("hypot", CTR, unit([0,size.z,size.y],UP)),
named_anchor("hypot_left", [-size.x/2,0,0], unit(unit([0,size.z,size.y],UP)+LEFT)),
named_anchor("hypot_right", [size.x/2,0,0], unit(unit([0,size.z,size.y],UP)+RIGHT)),
];
attachable(anchor,spin,orient, size=size, anchors=anchors) {
if (size.z > 0) {
vnf_polyhedron(vnf);
}
@ -1144,9 +1153,14 @@ function wedge(size=[1,1,1], center, anchor, spin=0, orient=UP) =
[0,1,2], [3,5,4], [0,3,1], [1,3,4],
[1,4,2], [2,4,5], [2,5,3], [0,2,3],
],
vnf = [scale(size/2,p=pts), faces]
vnf = [scale(size/2,p=pts), faces],
anchors = [
named_anchor("hypot", CTR, unit([0,size.z,size.y],UP)),
named_anchor("hypot_left", [-size.x/2,0,0], unit(unit([0,size.z,size.y],UP)+LEFT)),
named_anchor("hypot_right", [size.x/2,0,0], unit(unit([0,size.z,size.y],UP)+RIGHT)),
]
)
reorient(anchor,spin,orient, size=size, size2=[size.x,0], shift=[0,-size.y/2], p=vnf);
reorient(anchor,spin,orient, size=size, anchors=anchors, p=vnf);
// Section: Cylinders
@ -1156,7 +1170,6 @@ function wedge(size=[1,1,1], center, anchor, spin=0, orient=UP) =
// Synopsis: Creates an attachable cylinder, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See Also: cyl()
//
// Usage: As Module (as in native OpenSCAD)
// cylinder(h, r=/d=, [center=]);
// cylinder(h, r1/d1=, r2/d2=, [center=]);
@ -1242,7 +1255,6 @@ function cylinder(h, r1, r2, center, r, d, d1, d2, anchor, spin=0, orient=UP) =
// Synopsis: Creates an attachable cylinder with roundovers and chamfering, or returns a vnf.
// Topics: Cylinders, Textures, Rounding, Chamfers
// See Also: texture(), rotate_sweep(), cylinder()
//
// Usage: Normal Cylinders
// cyl(l|h|length|height, r, [center], [circum=], [realign=]) [ATTACHMENTS];
// cyl(l|h|length|height, d=, ...) [ATTACHMENTS];
@ -1639,7 +1651,6 @@ module cyl(
// Synopsis: creates a cylinder oriented along the X axis, or returns a vnf.
// Topics: Cylinders, Textures, Rounding, Chamfers
// See Also: texture(), rotate_sweep(), cyl()
//
// Description:
// Creates an attachable cylinder with roundovers and chamfering oriented along the X axis.
//
@ -1722,10 +1733,8 @@ module xcyl(
// Synopsis: creates a cylinder oriented along the y axis, or returns a vnf.
// Topics: Cylinders, Textures, Rounding, Chamfers
// See Also: texture(), rotate_sweep(), cyl()
//
// Description:
// Creates an attachable cylinder with roundovers and chamfering oriented along the y axis.
//
// Usage: Typical
// ycyl(l|h|length|height, r|d=, [anchor=], ...) [ATTACHMENTS];
@ -1808,10 +1817,8 @@ module ycyl(
// Synopsis: creates a cylinder oriented along the Z axis, or returns a vnf.
// Topics: Cylinders, Textures, Rounding, Chamfers
// See Also: texture(), rotate_sweep(), cyl()
//
// Description:
// Creates an attachable cylinder with roundovers and chamfering oriented along the Z axis.
//
// Usage: Typical
// zcyl(l|h|length|height, r|d=, [anchor=],...) [ATTACHMENTS];
@ -1893,8 +1900,6 @@ module zcyl(
// Synopsis: Creates a cylindrical or conical tube, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See Also: rect_tube()
//
// Description:
// Makes a hollow tube that can be cylindrical or conical by specifying inner and outer dimensions or by giving one dimension and
// wall thickness.
@ -1992,7 +1997,6 @@ module tube(
// Synopsis: Creates a pie slice shape, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See Also: wedge()
//
// Description:
// Creates a pie slice shape.
//
@ -2091,7 +2095,6 @@ function pie_slice(
// Synopsis: Creates an attachable spherical object, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See Also: spheroid()
// Usage: As Module (native OpenSCAD)
// sphere(r|d=);
// Usage: Using BOSL2 attachments extensions
@ -2138,7 +2141,6 @@ function sphere(r, d, anchor=CENTER, spin=0, orient=UP) =
// Synopsis: Creates an attachable spherical object with controllable triangulation, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See Also: sphere()
//
// Usage: Typical
// spheroid(r|d, [circum], [style]) [ATTACHMENTS];
// Usage: As Function
@ -2468,6 +2470,7 @@ function spheroid(r, style="aligned", d, circum=false, anchor=CENTER, spin=0, or
// Function&Module: torus()
// Synopsis: Creates an attachable torus, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// See Also: spheroid(), cyl()
//
// Usage: As Module
// torus(r_maj|d_maj, r_min|d_min, [center], ...) [ATTACHMENTS];
@ -2609,9 +2612,8 @@ function torus(
// Function&Module: teardrop()
// Synopsis: Creates a teardrop shape, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// Topics: Shapes (3D), Attachable, VNF Generators, FDM Optimized
// See Also: onion(), teardrop2d()
//
// Description:
// Makes a teardrop shape in the XZ plane. Useful for 3D printable holes.
// Optional chamfers can be added with positive or negative distances. A positive distance
@ -2751,9 +2753,8 @@ function teardrop(h, r, ang=45, cap_h, r1, r2, d, d1, d2, cap_h1, cap_h2, chamf
// Function&Module: onion()
// Synopsis: Creates an attachable onion-like shape, or returns a vnf.
// Topics: Shapes (3D), Attachable, VNF Generators
// Topics: Shapes (3D), Attachable, VNF Generators, FDM Optimized
// See Also: teardrop(), teardrop2d()
//
// Description:
// Creates a sphere with a conical hat, to make a 3D teardrop.
//
@ -2843,7 +2844,6 @@ function onion(r, ang=45, cap_h, d, anchor=CENTER, spin=0, orient=UP) =
// Synopsis: Creates an attachable 3d text block, or returns a vnf.
// Topics: Attachments, Text
// See Also: path_text(), text()
//
// Usage:
// text3d(text, [h], [size], [font], [language=], [script=], [direction=], [atype=], [anchor=], [spin=], [orient=]);
// Description:
@ -2951,7 +2951,6 @@ function _cut_interp(pathcut, path, data) =
// Synopsis: Creates 2d or 3d text placed along a path, or returns a vnf.
// Topics: Text, Paths, Paths (2D), Paths (3D), Path Generators, Path Generators (2D)
// See Also, text(), text2d()
// Usage:
// path_text(path, text, [size], [thickness], [font], [lettersize=], [offset=], [reverse=], [normal=], [top=], [textmetrics=], [kern=])
// Description:
@ -3196,8 +3195,6 @@ module path_text(path, text, font, size, thickness, lettersize, offset=0, revers
// Module: fillet()
// Synopsis: Creates a smooth fillet between two faces, or returns a vnf.
// See Also: mask2d_roundover()
//
//
// Description:
// Creates a shape that can be unioned into a concave joint between two faces, to fillet them.
// Center this part along the concave edge to be chamfered and union it in.
@ -3278,7 +3275,6 @@ module fillet(l=1.0, r, ang=90, overlap=0.01, d, length, h, height, anchor=CENTE
// Synopsis: Generates a 3D surface from a 2D grid of values, or returns a vnf.
// Topics: Textures, Heightfield
// See Also: cylindrical_heightfield()
//
// Usage: As Module
// heightfield(data, [size], [bottom], [maxz], [xrange], [yrange], [style], [convexity], ...) [ATTACHMENTS];
// Usage: As Function
@ -3409,7 +3405,6 @@ function heightfield(data, size=[100,100], bottom=-20, maxz=100, xrange=[-1:0.04
// Synopsis: Generates a cylindrical 3d surface from a 2D grid of values, or returns a vnf.
// Topics: Extrusion, Textures, Knurling, Heightfield
// See Also: heightfield()
//
// Usage: As Function
// vnf = cylindrical_heightfield(data, l|length=|h=|height=, r|d=, [base=], [transpose=], [aspect=]);
// Usage: As Module
@ -3555,7 +3550,7 @@ module cylindrical_heightfield(
// Module: ruler()
// Synopsis: Creates a ruler.
//
// Topics: Distance
// Usage:
// ruler(length, width, [thickness=], [depth=], [labels=], [pipscale=], [maxscale=], [colors=], [alpha=], [unit=], [inch=]) [ATTACHMENTS];
// Description:

View File

@ -13,6 +13,9 @@
// Module: slider()
// Synopsis: Creates a V-groove slider.
// Topics: Parts, Sliders
// See Also: rail()
// Description:
// Creates a slider to match a V-groove rail.
// Usage:
@ -63,6 +66,9 @@ module slider(l=30, w=10, h=10, base=10, wall=5, ang=30, anchor=BOTTOM, spin=0,
// Module: rail()
// Synopsis: Creates a V-groove rail.
// Topics: Parts, Sliders
// See Also: slider()
// Description:
// Creates a V-groove rail.
// Usage:

View File

@ -12,6 +12,9 @@
// Section: Standard (UTS/ISO) Threading
// Module: threaded_rod()
// Synopsis: Creates an ISO threaded rod.
// Topics: Threading, Screws
// See Also: threaded_nut()
// Usage:
// threaded_rod(d, l|length, pitch, [internal=], ...) [ATTACHMENTS];
// Description:
@ -148,6 +151,9 @@ module threaded_rod(
// Module: threaded_nut()
// Synopsis: Creates an ISO threaded nut.
// Topics: Threading, Screws
// See Also: threaded_rod()
// Usage:
// threaded_nut(nutwidth, id, h|height|thickness, pitch,...) [ATTACHMENTS];
// Description:
@ -261,6 +267,9 @@ module threaded_nut(
// Module: trapezoidal_threaded_rod()
// Synopsis: Creates a trapezoidal threaded rod.
// Topics: Threading, Screws
// See Also: trapezoidal_threaded_nut()
// Usage:
// trapezoidal_threaded_rod(d, l|length, pitch, [thread_angle], [thread_depth], [internal=], ...) [ATTACHMENTS];
// Description:
@ -409,13 +418,16 @@ module trapezoidal_threaded_rod(
// Module: trapezoidal_threaded_nut()
// Synopsis: Creates a trapezoidal threaded nut.
// Topics: Threading, Screws
// See Also: trapezoidal_threaded_rod()
// Usage:
// trapezoidal_threaded_nut(nutwidth, id, h|height|thickness, pitch, [thread_angle], [thread_depth], ...) [ATTACHMENTS];
// Description:
// Constructs a hex nut or square nut for a symmetric trapzoidal threaded rod.
// By default produces the nominal dimensions
// for metric trapezoidal threads: a thread angle of 30 degrees and a depth set to half the pitch.
// You can also specify your own trapezoid parameters. For ACME threads see acme_threaded_nut().
// Constructs a hex nut or square nut for a symmetric trapzoidal threaded rod. By default produces
// the nominal dimensions for metric trapezoidal threads: a thread angle of 30 degrees and a depth
// set to half the pitch. You can also specify your own trapezoid parameters. For ACME threads see
// acme_threaded_nut().
// Arguments:
// nutwidth = flat to flat width of nut
// id = diameter of threaded rod to screw onto.
@ -527,6 +539,9 @@ module trapezoidal_threaded_nut(
// Module: acme_threaded_rod()
// Synopsis: Creates an ACME threaded rod.
// Topics: Threading, Screws
// See Also: acme_threaded_nut()
// Usage:
// acme_threaded_rod(d, l|length, tpi|pitch=, [internal=], ...) [ATTACHMENTS];
// Description:
@ -618,6 +633,9 @@ module acme_threaded_rod(
// Module: acme_threaded_nut()
// Synopsis: Creates an ACME threaded nut.
// Topics: Threading, Screws
// See Also: acme_threaded_rod()
// Usage:
// acme_threaded_nut(nutwidth, id, h|height|thickness, tpi|pitch=, [shape=], ...) [ATTACHMENTS];
// Description:
@ -719,6 +737,9 @@ module acme_threaded_nut(
// Section: Pipe Threading
// Module: npt_threaded_rod()
// Synopsis: Creates NPT pipe threading.
// Topics: Threading, Screws
// See Also: acme_threaded_rod()
// Usage:
// npt_threaded_rod(size, [internal=], ...) [ATTACHMENTS];
// Description:
@ -838,6 +859,9 @@ module npt_threaded_rod(
// Section: Buttress Threading
// Module: buttress_threaded_rod()
// Synopsis: Creates a buttress-threaded rod.
// Topics: Threading, Screws
// See Also: buttress_threaded_nut()
// Usage:
// buttress_threaded_rod(d, l|length, pitch, [internal=], ...) [ATTACHMENTS];
// Description:
@ -935,6 +959,9 @@ module buttress_threaded_rod(
// Module: buttress_threaded_nut()
// Synopsis: Creates a buttress-threaded nut.
// Topics: Threading, Screws
// See Also: buttress_threaded_rod()
// Usage:
// buttress_threaded_nut(nutwidth, id, h|height|thickness, pitch, ...) [ATTACHMENTS];
// Description:
@ -1032,10 +1059,14 @@ module buttress_threaded_nut(
// Section: Square Threading
// Module: square_threaded_rod()
// Synopsis: Creates a square-threaded rod.
// Topics: Threading, Screws
// See Also: square_threaded_nut()
// Usage:
// square_threaded_rod(d, l|length, pitch, [internal=], ...) [ATTACHMENTS];
// Description:
// Constructs a square profile threaded screw rod. The greatest advantage of square threads is that they have the least friction and a much higher intrinsic efficiency than trapezoidal threads.
// Constructs a square profile threaded screw rod. The greatest advantage of square threads is
// that they have the least friction and a much higher intrinsic efficiency than trapezoidal threads.
// They produce no radial load on the nut. However, square threads cannot carry as much load as trapezoidal threads.
// Arguments:
// d = Outer diameter of threaded rod.
@ -1123,6 +1154,9 @@ module square_threaded_rod(
// Module: square_threaded_nut()
// Synopsis: Creates a square-threaded nut.
// Topics: Threading, Screws
// See Also: square_threaded_rod()
// Usage:
// square_threaded_nut(nutwidth, id, h|height|thickness, pitch, ...) [ATTACHMENTS];
// Description:
@ -1218,6 +1252,8 @@ module square_threaded_nut(
// Section: Ball Screws
// Module: ball_screw_rod()
// Synopsis: Creates a ball screw rod.
// Topics: Threading, Screws
// Usage:
// ball_screw_rod(d, l|length, pitch, [ball_diam], [ball_arc], [internal=], ...) [ATTACHMENTS];
// Description:
@ -1320,6 +1356,9 @@ module ball_screw_rod(
// Section: Generic Threading
// Module: generic_threaded_rod()
// Synopsis: Creates a generic threaded rod.
// Topics: Threading, Screws
// See Also: generic_threaded_nut()
// Usage:
// generic_threaded_rod(d, l|length, pitch, profile, [internal=], ...) [ATTACHMENTS];
// Description:
@ -1646,6 +1685,9 @@ module generic_threaded_rod(
// Module: generic_threaded_nut()
// Synopsis: Creates a generic threaded nut.
// Topics: Threading, Screws
// See Also: generic_threaded_rod()
// Usage:
// generic_threaded_nut(nutwidth, id, h|height|thickness, pitch, profile, [$slop], ...) [ATTACHMENTS];
// Description:
@ -1792,6 +1834,9 @@ module _nutshape(nutwidth, h, shape, bevel1, bevel2)
// Module: thread_helix()
// Synopsis: Creates a thread helix to add to a cylinder.
// Topics: Threading, Screws
// See Also: generic_threaded_rod()
// Usage:
// thread_helix(d, pitch, [thread_depth], [flank_angle], [turns], [profile=], [left_handed=], [higbee=], [internal=]);
// Description:
@ -1939,15 +1984,13 @@ module thread_helix(
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
// Questions
// Should nut modules take d1/d2 for tapered nuts?
//
// Need explanation of what exactly the diff is between threaded_rod and helix_threads.
// Higbee is different, angle in one and length in another. Need to reconcile
// end_len = 0 default?
//
// What about blunt_start for ball screws?
// Fold in nuts
// Should default bevel be capped at 1mm or 2mm or something like that? Including/especially inner bevel on nuts
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap

View File

@ -10,6 +10,8 @@
// Module: manfrotto_rc2_plate()
// Synopsis: Creates a Manfrotto RC2 tripod quick release mount plate.
// Topics: Parts
// Usage:
// manfrotto_rc2_plate([chamfer],[anchor],[orient],[spin]) [ATTACHMENTS];
// Description:

View File

@ -23,7 +23,6 @@ function _rotpart(T) = [for(i=[0:3]) [for(j=[0:3]) j<3 || i==3 ? T[i][j] : 0]];
// Synopsis: Extends [turtle graphics](https://en.wikipedia.org/wiki/Turtle_graphics) to 3d. Generates a 3D path or returns a list of transforms.
// Topics: Shapes (3D), Path Generators (3D), Mini-Language
// See Also: turtle()
//
// Usage:
// turtle3d(commands, [state], [transforms], [full_state], [repeat])
// Description:

View File

@ -16,47 +16,51 @@ BOSL_VERSION = [2,0,652];
// Function: bosl_version()
// Synopsis: Returns the BOSL2 version as a list.
// Topics: Versioning
// See Also: bosl_version_num(), bosl_version_str(), bosl_required()
// Usage:
// ver = bosl_version();
// Topics: Versioning
// Description:
// Returns a list with three integer elements, [MAJOR,MINOR,REV],
// representing the Major, Minor, and Build Revision numbers.
// For example, version 2.1.43 will be returned as `[2,1,43]`.
// See Also: bosl_version_num(), bosl_version_str()
function bosl_version() = BOSL_VERSION;
// Function: bosl_version_num()
// Synopsis: Returns the BOSL2 version as a float.
// Topics: Versioning
// See Also: bosl_version(), bosl_version_str(), bosl_required()
// Usage:
// ver = bosl_version_num();
// Topics: Versioning
// Description:
// Returns a floating point number of the version, formatted like M.mmrrrr where M is the major version number,
// each m is a zero-padded digit of the minor version number, and each r is a zero-padded digit of the build
// revision number. For example, version 2.1.43 will be returned as `2.010043`.
// See Also: bosl_version(), bosl_version_str()
function bosl_version_num() = version_to_num(BOSL_VERSION);
// Function: bosl_version_str()
// Synopsis: Returns the BOSL2 version as a string.
// Topics: Versioning
// See Also: bosl_version(), bosl_version_num(), bosl_required()
// Usage:
// ver = bosl_version_str();
// Topics: Versioning
// Description:
// Returns a string of the version, formatted like "MAJOR.MINOR.REV".
// For example, version 2.1.43 will be returned as `"2.1.43"`.
// See Also: bosl_version(), bosl_version_num()
function bosl_version_str() = version_to_str(BOSL_VERSION);
// Module: bosl_required()
// Synopsis: Asserts that the current version of the library is at least the given version.
// Topics: Versioning
// See Also: version_to_num(), version_to_str(), version_to_list(), version_cmp()
// Usage:
// bosl_required(version);
// Topics: Versioning
// Description:
// Given a version as a list, number, or string, asserts that the currently installed BOSL library is at least the given version.
// See Also: version_to_num(), version_to_str(), version_to_list(), version_cmp()
// Arguments:
// version = version required
module bosl_required(version) {
@ -85,12 +89,13 @@ function _version_split_str(x, _i=0, _out=[], _num=0) =
// Function: version_to_list()
// Synopsis: Splits a version into a list of integer version parts.
// Topics: Versioning
// See Also: version_to_num(), version_to_str(), version_cmp(), bosl_required()
// Usage:
// ver = version_to_list(x);
// Topics: Versioning
// Description:
// Given a version string, number, or list, returns the list of version integers [MAJOR,MINOR,REVISION].
// See Also: version_to_num(), version_to_str(), version_cmp(), bosl_required()
// Arguments:
// x = version to convert
// Example:
@ -106,12 +111,13 @@ function version_to_list(version) =
// Function: version_to_str()
// Synopsis: Coerces a version into a standard version string.
// Topics: Versioning
// See Also: version_to_num(), version_to_list(), version_cmp(), bosl_required()
// Usage:
// str = version_to_str(version);
// Topics: Versioning
// Description:
// Takes a version string, number, or list, and returns the properly formatter version string for it.
// See Also: version_to_num(), version_to_list(), version_cmp(), bosl_required()
// Arguments:
// version = version to convert
// Example:
@ -125,12 +131,13 @@ function version_to_str(version) =
// Function: version_to_num()
// Synopsis: Coerces a version into a standard version float.
// Topics: Versioning
// See Also: version_cmp(), version_to_str(), version_to_list(), bosl_required()
// Usage:
// str = version_to_num(version);
// Topics: Versioning
// Description:
// Takes a version string, number, or list, and returns the properly formatter version number for it.
// See Also: version_cmp(), version_to_str(), version_to_list(), bosl_required()
// Arguments:
// version = version to convert
// Example:
@ -144,13 +151,14 @@ function version_to_num(version) =
// Function: version_cmp()
// Synopsis: Compares two versions.
// Topics: Versioning
// See Also: version_to_num(), version_to_str(), version_to_list(), bosl_required()
// Usage:
// cmp = version_cmp(a,b);
// Topics: Versioning
// Description:
// Given a pair of versions, in any combination of string, integer, or list, compares them, and returns the relative value of them.
// Returns an integer <0 if a<b. Returns 0 if a==b. Returns an integer >0 if a>b.
// See Also: version_to_num(), version_to_str(), version_to_list(), bosl_required()
// Example:
// cmp1 = version_cmp(2.010034, "2.1.33"); // Returns: >0
// cmp2 = version_cmp(2.010034, "2.1.34"); // Returns: 0

View File

@ -13,12 +13,13 @@
// Module: sparse_wall()
// Synopsis: Makes an open cross-braced rectangular wall.
// Topics: FDM Optimized, Walls
// See Also: sparse_wall(), corrugated_wall(), thinning_wall(), thinning_triangle(), narrowing_strut()
//
// Usage:
// sparse_wall(h, l, thick, [maxang=], [strut=], [max_bridge=]) [ATTACHMENTS];
//
// Topics: FDM Optimized, Walls
//
// Description:
// Makes an open rectangular strut with X-shaped cross-bracing, designed to reduce
// the need for support material in 3D printing.
@ -86,12 +87,13 @@ module sparse_wall(h=50, l=100, thick=4, maxang=30, strut=5, max_bridge=20, anch
// Module: corrugated_wall()
// Synopsis: Makes a corrugated rectangular wall.
// Topics: FDM Optimized, Walls
// See Also: sparse_wall(), corrugated_wall(), thinning_wall(), thinning_triangle(), narrowing_strut()
//
// Usage:
// corrugated_wall(h, l, thick, [strut=], [wall=]) [ATTACHMENTS];
//
// Topics: FDM Optimized, Walls
//
// Description:
// Makes a corrugated wall which relieves contraction stress while still
// providing support strength. Designed with 3D printing in mind.
@ -144,12 +146,13 @@ module corrugated_wall(h=50, l=100, thick=5, strut=5, wall=2, anchor=CENTER, spi
// Module: thinning_wall()
// Synopsis: Makes a rectangular wall with a thin middle.
// Topics: FDM Optimized, Walls
// See Also: sparse_wall(), corrugated_wall(), thinning_wall(), thinning_triangle(), narrowing_strut()
//
// Usage:
// thinning_wall(h, l, thick, [ang=], [braces=], [strut=], [wall=]) [ATTACHMENTS];
//
// Topics: FDM Optimized, Walls
//
// Description:
// Makes a rectangular wall which thins to a smaller width in the center,
// with angled supports to prevent critical overhangs.
@ -327,12 +330,13 @@ module thinning_wall(h=50, l=100, thick=5, ang=30, braces=false, strut, wall, an
// Module: thinning_triangle()
// Synopsis: Makes a triangular wall with a thin middle.
// Topics: FDM Optimized, Walls
// See Also: sparse_wall(), corrugated_wall(), thinning_wall(), thinning_triangle(), narrowing_strut()
//
// Usage:
// thinning_triangle(h, l, thick, [ang=], [strut=], [wall=], [diagonly=], [center=]) [ATTACHMENTS];
//
// Topics: FDM Optimized, Walls
//
// Description:
// Makes a triangular wall with thick edges, which thins to a smaller width in
// the center, with angled supports to prevent critical overhangs.
@ -394,12 +398,13 @@ module thinning_triangle(h=50, l=100, thick=5, ang=30, strut=5, wall=3, diagonly
// Module: narrowing_strut()
// Synopsis: Makes a strut like an extruded baseball home plate.
// Topics: FDM Optimized
// See Also: sparse_wall(), corrugated_wall(), thinning_wall(), thinning_triangle(), narrowing_strut()
//
// Usage:
// narrowing_strut(w, l, wall, [ang=]) [ATTACHMENTS];
//
// Topics: FDM Optimized
//
// Description:
// Makes a rectangular strut with the top side narrowing in a triangle.
// The shape created may be likened to an extruded home plate from baseball.

View File

@ -54,6 +54,9 @@ function _hex_offsets(n, d, lev=0, arr=[]) =
// Module: wire_bundle()
// Synopsis: Creates a wire bundle for a given number of wires.
// Topics: Wiring
// See Also: path_sweep(), path_sweep2d()
// Usage:
// wire_bundle(path, wires, [wirediam], [rounding], [wirenum=], [corner_steps=]);
// Description: