diff --git a/vitamins/magnet.scad b/vitamins/magnet.scad index 33efb00..a7b283e 100644 --- a/vitamins/magnet.scad +++ b/vitamins/magnet.scad @@ -22,10 +22,11 @@ // include <../utils/core/core.scad> -function magnet_od(type) = type[1]; //! Outer diameter -function magnet_id(type) = type[2]; //! Inside diameter if a ring -function magnet_h(type) = type[3]; //! Height -function magnet_r(type) = type[4]; //! Corner radius +function magnet_name(type) = type[1]; //! Name +function magnet_od(type) = type[2]; //! Outer diameter +function magnet_id(type) = type[3]; //! Inside diameter if a ring +function magnet_h(type) = type[4]; //! Height +function magnet_r(type) = type[5]; //! Corner radius module magnet(type) { //! Draw specified magnet od = magnet_od(type); @@ -33,7 +34,7 @@ module magnet(type) { //! Draw specified magnet h = magnet_h(type); r = magnet_r(type); - vitamin(str("magnet(", type[0], "): Magnet ", od, "mm diameter, ", h, "mm high", id ? str(", ", id, "mm bore") : "" )); + vitamin(str("magnet(", type[0], "): ", magnet_name(type), ", ", od, "mm diameter, ", h, "mm high", id ? str(", ", id, "mm bore") : "" )); or = od / 2; ir = id / 2; diff --git a/vitamins/magnets.scad b/vitamins/magnets.scad index 714d41f..3dc78b4 100644 --- a/vitamins/magnets.scad +++ b/vitamins/magnets.scad @@ -20,11 +20,12 @@ //! Cylindrical and ring magnets. // -// od, id, h, r -MAG8x4x4p2 = ["MAG8x4x4p2", 8, 4.2, 4, 0.5]; -MAG484 = ["MAG484", inch(1/4), inch(1/8), inch(1/4), 0.5]; -MAG5x8 = ["MAG5x8", 8, 0, 5, 0.5]; +// name, od, id, h, r +MAG8x4x4p2 = ["MAG8x4x4p2", "Magnet", 8, 4.2, 4, 0.5]; +MAG484 = ["MAG484", "Magnet", inch(1/4), inch(1/8), inch(1/4), 0.5]; +MAG5x8 = ["MAG5x8", "Magnet", 8, 0, 5, 0.5]; +MAGRE6x2p5 = ["MAGRE6x2p5", "Radial encoder magnet", 6, 0, 2.5, 0.5]; -magnets = [MAG8x4x4p2, MAG484, MAG5x8]; +magnets = [MAG8x4x4p2, MAG484, MAG5x8, MAGRE6x2p5]; use