Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Richard Milewski 2023-04-01 17:35:50 -07:00
commit 4bb9db5678
22 changed files with 548 additions and 189 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

@ -646,7 +646,7 @@ 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:
@ -749,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:

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

@ -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:
@ -1143,6 +1173,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:
@ -1233,6 +1266,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

@ -118,6 +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]);
@ -155,6 +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

@ -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

@ -95,7 +95,6 @@ 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:
@ -290,7 +289,7 @@ module rounding_corner_mask(r, d, style="octa", excess=0.1, anchor=CENTER, spin=
// Module: rounding_angled_edge_mask()
// Creates a shape to round edges of any angle.
// 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:

View file

@ -15,6 +15,7 @@
// 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:
@ -105,6 +106,7 @@ 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;
//
@ -270,6 +272,7 @@ 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:
@ -331,6 +334,7 @@ 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:
@ -471,7 +475,7 @@ module minkowski_difference(planar=false) {
// Module: offset3d()
// Synopsis: Expands or contracts the surface of a 3D object.
// Topics: Mutators
// See Also: minkowski_difference()
// See Also: minkowski_difference(), round3d()
// Usage:
// offset3d(r, [size], [convexity]) CHILDREN;
// Description:
@ -513,6 +517,7 @@ 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

@ -20,6 +20,7 @@
// 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:
@ -204,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:
@ -456,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:
@ -516,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:
@ -546,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];
@ -575,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:
@ -611,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:
@ -653,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:
@ -678,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:
@ -704,8 +729,9 @@ function path_torsion(path, closed=false) =
// Function: path_cut()
// Synopsis: Cuts a path into subpaths at various points.
// Topics: Paths, Path Subdivision
// See Also: split_path_at_self_crossings()
// See Also: split_path_at_self_crossings(), path_cut_points()
// Usage:
// path_list = path_cut(path, cutdist, [closed]);
// Description:
@ -766,6 +792,7 @@ 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=]);
//
@ -903,6 +930,7 @@ 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:
@ -972,6 +1000,7 @@ 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=], [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;
@ -706,6 +708,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=], [anchor=], [atype=], [orient=], [spin=]) [ATTACHMENTS];
// Description:
@ -951,6 +956,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:
@ -1355,6 +1363,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:
@ -1455,9 +1466,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
@ -1571,6 +1584,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:
@ -1658,6 +1674,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:
@ -1726,6 +1745,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:
@ -1816,6 +1838,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:
@ -2873,6 +2898,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:
@ -2961,6 +2989,3 @@ http://files.engineering.com/getfile.aspx?folder=76fb0d5e-1fff-4c49-87a5-0597947
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap

View file

@ -1799,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];
@ -1830,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

@ -2470,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];

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:
@ -129,6 +132,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:
@ -218,6 +224,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:
@ -339,13 +348,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.
@ -433,6 +445,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:
@ -501,6 +516,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:
@ -578,6 +596,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:
@ -697,6 +718,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:
@ -778,6 +802,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:
@ -854,10 +881,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.
@ -926,6 +957,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:
@ -997,6 +1031,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:
@ -1072,6 +1108,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:
@ -1330,6 +1369,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:
@ -1451,6 +1493,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:
@ -1587,10 +1632,10 @@ 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
// 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

@ -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: