lmXuu_info() bugfix. ball_bearing_info() bugfix.

This commit is contained in:
Revar Desmera 2022-09-20 00:48:34 -07:00
parent 75dfe87c51
commit 0a1abb78ef
3 changed files with 31 additions and 40 deletions

View file

@ -223,7 +223,7 @@ function ball_bearing_info(trade_size) =
], ],
found = search([trade_size], data, 1)[0] found = search([trade_size], data, 1)[0]
) )
assert(found, str("Unsupported ball bearing trade size: ", trade_size)) assert(found!=[], str("Unsupported ball bearing trade size: ", trade_size))
select(data[found], 1, -1); select(data[found], 1, -1);

View file

@ -9,6 +9,9 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
include <metric_screws.scad>
// Section: Generic Linear Bearings // Section: Generic Linear Bearings
// Module: linear_bearing_housing() // Module: linear_bearing_housing()
@ -152,27 +155,27 @@ function lmXuu_info(size) =
let( let(
data = [ data = [
// size, diam, length // size, diam, length
[ 4.0, 8.0, 12.0], [ 4, 8, 12],
[ 5.0, 10.0, 15.0], [ 5, 10, 15],
[ 6.0, 12.0, 19.0], [ 6, 12, 19],
[ 8.0, 15.0, 24.0], [ 8, 15, 24],
[ 10.0, 19.0, 29.0], [ 10, 19, 29],
[ 12.0, 21.0, 30.0], [ 12, 21, 30],
[ 13.0, 23.0, 32.0], [ 13, 23, 32],
[ 16.0, 28.0, 37.0], [ 16, 28, 37],
[ 20.0, 32.0, 42.0], [ 20, 32, 42],
[ 25.0, 40.0, 59.0], [ 25, 40, 59],
[ 30.0, 45.0, 64.0], [ 30, 45, 64],
[ 35.0, 52.0, 70.0], [ 35, 52, 70],
[ 40.0, 60.0, 80.0], [ 40, 60, 80],
[ 50.0, 80.0, 100.0], [ 50, 80, 100],
[ 60.0, 90.0, 110.0], [ 60, 90, 110],
[ 80.0, 120.0, 140.0], [ 80, 120, 140],
[100.0, 150.0, 175.0], [100, 150, 175],
], ],
found = search([size], data, 1)[0] found = search([size], data, 1)[0]
) )
assert(found, str("Unsupported lmXuu linear bearing size: ", size)) assert(found!=[], str("Unsupported lmXuu linear bearing size: ", size))
select(data[found], 1, -1); select(data[found], 1, -1);

View file

@ -2,27 +2,15 @@ include <../std.scad>
include <../linear_bearings.scad> include <../linear_bearings.scad>
module test_get_lmXuu_bearing_diam() { module test_lmXuu_info() {
assert_equal(get_lmXuu_bearing_diam(4), 8); assert_equal(lmXuu_info(4), [8, 12]);
assert_equal(get_lmXuu_bearing_diam(8), 15); assert_equal(lmXuu_info(8), [15, 24]);
assert_equal(get_lmXuu_bearing_diam(10), 19); assert_equal(lmXuu_info(10), [19, 29]);
assert_equal(get_lmXuu_bearing_diam(25), 40); assert_equal(lmXuu_info(25), [40, 59]);
assert_equal(get_lmXuu_bearing_diam(50), 80); assert_equal(lmXuu_info(50), [80, 100]);
assert_equal(get_lmXuu_bearing_diam(100), 150); assert_equal(lmXuu_info(100), [150, 175]);
} }
test_get_lmXuu_bearing_diam(); test_lmXuu_info();
module test_get_lmXuu_bearing_length() { // vim: expandtab shiftwidth=4 softtabstop=4 nowrap
assert_equal(get_lmXuu_bearing_length(4), 12);
assert_equal(get_lmXuu_bearing_length(8), 24);
assert_equal(get_lmXuu_bearing_length(10), 29);
assert_equal(get_lmXuu_bearing_length(25), 59);
assert_equal(get_lmXuu_bearing_length(50), 100);
assert_equal(get_lmXuu_bearing_length(100), 175);
}
test_get_lmXuu_bearing_length();
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap