mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-04-06 08:15:17 +00:00
commit
fbe3eb5499
5 changed files with 21 additions and 20 deletions
|
@ -728,7 +728,6 @@ function sort(list, idx=undef) =
|
|||
// idxs3 = sortidx(lst, idx=[1,3]); // Returns: [3,0,2,1]
|
||||
function sortidx(list, idx=undef) =
|
||||
assert(is_list(list)||is_string(list), "Invalid list." )
|
||||
!is_list(list) || len(list)<=1 ? list :
|
||||
is_homogeneous(list,1)
|
||||
? let(
|
||||
size = list_shape(list[0]),
|
||||
|
|
|
@ -775,7 +775,7 @@ module zrot_copies(rots=[], cp=[0,0,0], n, sa=0, r, d, subrot=true)
|
|||
// d = diameter of circle. (Default: 2)
|
||||
// dx = diameter of ellipse on X axis. Used instead of d.
|
||||
// dy = diameter of ellipse on Y axis. Used instead of d.
|
||||
// rot = whether to rotate the copied children. (Default: false)
|
||||
// rot = whether to rotate the copied children. (Default: true)
|
||||
// sa = starting angle. (Default: 0.0)
|
||||
// ea = ending angle. Will distribute copies CCW from sa to ea. (Default: 360.0)
|
||||
//
|
||||
|
|
|
@ -416,7 +416,7 @@ Torx values: https://www.stanleyengineeredfastening.com/-/media/web/sef/resourc
|
|||
// label("2") screw("1/4-20,5/8", head="hex",orient=DOWN,atype="head", anchor=TOP,tolerance="2A"); // Standard
|
||||
// label("3") screw("1/4-20,5/8", head="hex",orient=DOWN,atype="head", anchor=TOP,tolerance="3A"); // Tight
|
||||
// }
|
||||
// Example(2D): This example shows the gap between nut and bolt at the loosest tolerance for UTS. This gap is what enables the parts to mesh without binding and is part of the definition for standard metal hardware. Note that this gap is part of the standard definition for the metal hardware, not the 3D printing adjustment provided by the $slop parameter.
|
||||
// Example(2D,NoAxes): This example shows the gap between nut and bolt at the loosest tolerance for UTS. This gap is what enables the parts to mesh without binding and is part of the definition for standard metal hardware. Note that this gap is part of the standard definition for the metal hardware, not the 3D printing adjustment provided by the $slop parameter.
|
||||
// $fn=32;
|
||||
// projection(cut=true)xrot(-90){
|
||||
// screw("1/4-20,3/8", head="hex",orient=UP,anchor=BOTTOM,tolerance="1A");
|
||||
|
@ -925,11 +925,12 @@ module screw_hole(spec, head, thread, oversize, hole_oversize, head_oversize,
|
|||
parse_int(substr(tolerance,1))
|
||||
: assert(false,str("Unknown tolerance ",tolerance, " for clearance hole"));
|
||||
tol_table = struct_val(screwspec,"system")=="UTS" ? UTS_clearance[tol_ind] : ISO_clearance[tol_ind];
|
||||
tol_gap = lookup(_nominal_diam(screwspec), tol_table);
|
||||
// If we got here, hole_oversize is undefined and oversize is undefined
|
||||
hole_oversize = downcase(tolerance)=="tap" ? -pitch
|
||||
: downcase(tolerance)=="self tap" ? -pitch*lookup(pitch,[[1,0.72],[1.5,.6]])
|
||||
: lookup(_nominal_diam(screwspec), tol_table);
|
||||
head_oversize = first_defined([head_oversize,hole_oversize]);
|
||||
: tol_gap;
|
||||
head_oversize = default(head_oversize, tol_gap);
|
||||
default_tag("remove")
|
||||
screw(spec,head=head,thread=0,shaft_undersize=-hole_oversize, head_undersize=-head_oversize,
|
||||
length=length,l=l,thread_len=thread_len, _counterbore=counterbore,
|
||||
|
@ -1677,7 +1678,7 @@ module nut_trap_side(trap_width, spec, shape, thickness, nutwidth, anchor=BOT, o
|
|||
// Example: Nut trap with child screw hole
|
||||
// nut_trap_inline(10, "#8")
|
||||
// position(TOP)screw_hole(length=10,anchor=BOT,head="flat",$fn=32);
|
||||
// Example(Med): a pipe clamp
|
||||
// Example(Med,NoAxes): a pipe clamp
|
||||
// $fa=5;$fs=0.5;
|
||||
// bardiam = 32;
|
||||
// bandwidth = 10;
|
||||
|
|
|
@ -1288,7 +1288,7 @@ function cylinder(h, r1, r2, center, l, r, d, d1, d2, anchor, spin=0, orient=UP)
|
|||
// Example: External Roundings
|
||||
// cyl(l=50, r=30, rounding1=-5, rounding2=5, $fa=1, $fs=1);
|
||||
//
|
||||
// Example: Standard Connectors
|
||||
// Example(Med): Standard Connectors
|
||||
// xdistribute(40) {
|
||||
// cyl(l=30, d=25) show_anchors();
|
||||
// cyl(l=30, d1=25, d2=10) show_anchors();
|
||||
|
@ -1755,19 +1755,16 @@ module zcyl(
|
|||
// Module: tube()
|
||||
//
|
||||
// Description:
|
||||
// Makes a hollow tube with the given outer size and wall thickness.
|
||||
//
|
||||
// Usage: Typical
|
||||
// tube(h|l, or, ir, [center], [realign=]);
|
||||
// tube(h|l, or=|od=, ir=|id=, ...);
|
||||
// tube(h|l, ir|id, wall, ...);
|
||||
// tube(h|l, or|od, wall, ...);
|
||||
// tube(h|l, ir1|id1, ir2|id2, wall, ...);
|
||||
// tube(h|l, or1|od1, or2|od2, wall, ...);
|
||||
// tube(h|l, ir1|id1, ir2|id2, or1|od1, or2|od2, [realign]);
|
||||
// Usage: Attaching Children
|
||||
// tube(...) ATTACHMENTS;
|
||||
//
|
||||
// Makes a hollow tube that can be cylindrical or conical by specifying inner and outer dimensions or by giving one dimension and
|
||||
// wall thickness.
|
||||
// Usage: Basic cylindrical tube, specifying inner and outer radius or diameter
|
||||
// tube(h|l, or, ir, [center], [realign=], [anchor=], [spin=],[orient=]) [ATTACHMENTS];
|
||||
// tube(h|l, od=, id=, ...) [ATTACHMENTS];
|
||||
// Usage: Specify wall thickness
|
||||
// tube(h|l, or|od=|ir=|id=, wall=, ...) [ATTACHMENTS];
|
||||
// Usage: Conical tubes
|
||||
// tube(h|l, ir1=|id1=, ir2=|id2=, or1=|od1=, or2=|od2=, ...) [ATTACHMENTS];
|
||||
// tube(h|l, or1=|od1=, or2=|od2=, wall=, ...) [ATTACHMENTS];
|
||||
// Arguments:
|
||||
// h / l = height of tube. Default: 1
|
||||
// or = Outer radius of tube. Default: 1
|
||||
|
|
|
@ -16,6 +16,10 @@ test_sort();
|
|||
|
||||
|
||||
module test_sortidx() {
|
||||
assert(sortidx([3]) == [0]);
|
||||
assert(sortidx([]) == []);
|
||||
assert(sortidx([[5,6,7]])==[0]);
|
||||
assert(sortidx(["abc"]) == [0]);
|
||||
lst1 = ["da","bax","eaw","cav"];
|
||||
assert(sortidx(lst1) == [1,3,0,2]);
|
||||
lst5 = [3,5,1,7];
|
||||
|
|
Loading…
Reference in a new issue