mirror of
https://github.com/adrianschlatter/threadlib.git
synced 2025-08-02 13:28:01 +02:00
thread_specs(...): Error Msg
Added helpful error message if thread_specs(...) is unable to look up designator. Compare PR #36. closes #37
This commit is contained in:
@@ -17,9 +17,12 @@ include <THREAD_TABLE.scad>
|
|||||||
function thread_specs(designator, table=THREAD_TABLE) =
|
function thread_specs(designator, table=THREAD_TABLE) =
|
||||||
/* Returns thread specs of thread-type 'designator' as a vector of
|
/* Returns thread specs of thread-type 'designator' as a vector of
|
||||||
[pitch, Rrotation, Dsupport, section_profile] */
|
[pitch, Rrotation, Dsupport, section_profile] */
|
||||||
|
|
||||||
table[search([designator], table, num_returns_per_match=1,
|
// first lookup designator in table inside a let() statement:
|
||||||
index_col_num=0)[0]][1];
|
let (specs = table[search([designator], table, num_returns_per_match=1,
|
||||||
|
index_col_num=0)[0]][1])
|
||||||
|
// verify that we found something and return it:
|
||||||
|
assert(!is_undef(specs), str("Designator: '", designator, "' not found")) specs;
|
||||||
|
|
||||||
module thread(designator, turns, higbee_arc=20, fn=120, table=THREAD_TABLE)
|
module thread(designator, turns, higbee_arc=20, fn=120, table=THREAD_TABLE)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user