Added microswitch_op_tol() and microswitch_fp_max() functions.

This commit is contained in:
Chris Palmer 2021-01-24 21:44:57 +00:00
parent 5a1b06fbb9
commit 2923e35725
3 changed files with 33 additions and 12 deletions

View File

@ -1750,7 +1750,11 @@ UK 13A sockets at the moment.
---
<a name="Microswitches"></a>
## Microswitches
Used for limit switches.
Used for limit switches. Currently only the button type is supported as the lever and roller types are less accurate.
The switch is drawn with the button at the nominal operation point. This can be plus or minus `microswitch_op_tol(type)`.
When the button is released it comes out by a maximum of `microswitch_fp_max(type)` from the nominal operating point.
[vitamins/microswitches.scad](vitamins/microswitches.scad) Object definitions.
@ -1763,14 +1767,16 @@ Used for limit switches.
|:--- |:--- |
| `microswitch_body_clr(type)` | Body colour |
| `microswitch_button_clr(type)` | Button colour |
| `microswitch_button_pos(type)` | Button position |
| `microswitch_button_pos(type)` | Button position at operating point |
| `microswitch_button_t(type)` | Button thickness |
| `microswitch_button_w(type)` | Button width |
| `microswitch_fp_max(type)` | Free position maximum |
| `microswitch_hole_d(type)` | Screw hole diameter |
| `microswitch_holes(type)` | Hole positions |
| `microswitch_leg(type)` | Leg types |
| `microswitch_legs(type)` | Leg positions |
| `microswitch_length(type)` | Body length |
| `microswitch_op_tol(type)` | Operating position +/- tolerance |
| `microswitch_radius(type)` | Body corner radius |
| `microswitch_thickness(type)` | Body thickness |
| `microswitch_width(type)` | Body width |

View File

@ -18,7 +18,11 @@
//
//
//! Used for limit switches.
//! Used for limit switches. Currently only the button type is supported as the lever and roller types are less accurate.
//!
//! The switch is drawn with the button at the nominal operation point. This can be plus or minus `microswitch_op_tol(type)`.
//!
//! When the button is released it comes out by a maximum of `microswitch_fp_max(type)` from the nominal operating point.
//
include <../utils/core/core.scad>
@ -32,11 +36,13 @@ function microswitch_hole_d(type) = type[6]; //! Screw hole diameter
function microswitch_holes(type) = type[7]; //! Hole positions
function microswitch_button_w(type) = type[8]; //! Button width
function microswitch_button_t(type) = type[9]; //! Button thickness
function microswitch_button_pos(type)= type[10]; //! Button position
function microswitch_legs(type) = type[11]; //! Leg positions
function microswitch_leg(type) = type[12]; //! Leg types
function microswitch_body_clr(type) = type[13]; //! Body colour
function microswitch_button_clr(type)= type[14]; //! Button colour
function microswitch_button_pos(type)= type[10]; //! Button position at operating point
function microswitch_op_tol(type) = type[11]; //! Operating position +/- tolerance
function microswitch_fp_max(type) = type[12]; //! Free position maximum
function microswitch_legs(type) = type[13]; //! Leg positions
function microswitch_leg(type) = type[14]; //! Leg types
function microswitch_body_clr(type) = type[15]; //! Body colour
function microswitch_button_clr(type)= type[16]; //! Button colour
function microswitch_lower_extent(type) = let(leg = microswitch_leg(type)) min([for(pos = microswitch_legs(type)) pos.y - leg.y / 2]); //! How far legs extend downwards
function microswitch_right_extent(type) = let(leg = microswitch_leg(type)) max([microswitch_length(type) / 2, for(pos = microswitch_legs(type)) pos.x + leg.x / 2]); //! How far legs extend right

View File

@ -23,10 +23,19 @@
small_leg = [0.9, 3.3, 0.4, 0];
medium_leg = [0.5, 3.9, 3.2, 1.6, [0, -0.5]];
large_leg = [11.4, 0.8, 6.3, 1.8, [1.7, 0]];
small_microswitch = ["small_microswitch", "DM1-00P-110-3", 5.8, 6.5, 12.8, 0, 2, [[-3.25, -1.65], [3.25, -1.65]], 2.9, 1.2, [-1.95, 3.75], [[-5.08, -4.95], [0, -4.9], [5.08, -4.9] ], small_leg, grey(20), "white" ];
medium_microswitch = ["medium_microswitch","SS-01 or SS-5GL", 6.4, 10.2, 19.8, 1, 2.35, [[-4.8, -2.6 ], [4.7, -2.6 ]], 3.2, 2, [-2.8, 5.8 ], [[-8.05, -7.05], [0.75, -7.05], [8.05, -7.05] ], medium_leg, grey(20), "burlywood" ];
large_microswitch = ["large_microswitch", "Saia G3 low force", 10.4, 15.9, 28.0, 2, 3.1, [[-11.1, -5.15], [11.2, 5.15]], 4, 2.75,[-9.1, 9.55], [[19.7, 2.19], [19.7, -3.45], [8.3, -10.45] ], large_leg, "ivory", "white" ];
// t w l r h h b b b o f l l b b
// h i e a o o u u u p p e e o u
// i d n d l l t t t g g d t
// c t g i e e t t t t m y t
// k h t u o o o o a p t o
// n h s d p n n n l x o y c n
// e i o s p l
// s a s w t p n e r c
// n n o s l
// s s r
small_microswitch = ["small_microswitch", "DM1-00P-110-3", 5.8, 6.5, 12.8, 0, 2, [[-3.25, -1.65], [3.25, -1.65]], 2.9, 1.2, [-1.95, 3.75], 0.2, 0.55, [[-5.08, -4.95], [0, -4.9], [5.08, -4.9] ], small_leg, grey(20), "white" ];
medium_microswitch = ["medium_microswitch","SS-01 or SS-5GL", 6.4, 10.2, 19.8, 1, 2.35, [[-4.8, -2.6 ], [4.7, -2.6 ]], 3.2, 2, [-2.8, 5.8 ], 0.5, 1.00, [[-8.05, -7.05], [0.75, -7.05], [8.05, -7.05] ], medium_leg, grey(20), "burlywood" ];
large_microswitch = ["large_microswitch", "Saia G3 low force", 10.4, 15.9, 28.0, 2, 3.1, [[-11.1, -5.15], [11.2, 5.15]], 4, 2.75,[-9.1, 9.55], 0.3, 1.2, [[19.7, 2.19], [19.7, -3.45], [8.3, -10.45] ], large_leg, "ivory", "white" ]; //G3M1T1PUL
microswitches = [small_microswitch, medium_microswitch, large_microswitch];