Closed hannesweisbach closed 5 years ago
Hi,
looking at this code for the first time in 5 years...
I think the intent was to have two sets of functions, the first set operates on the family table and the other on the bolt table. Where "M5" is the name of a complete family of bolts of different lengths (i.e. M5x10, M5x12, etc).
_get_screw_fam(n) therefore should use a bolt name, like M5x10 to get you to the property value from the table, whereas _get_fam(n) takes the family name, i.e. M5.
Are you sure this is a working line? It seems to miss an argument to search? Nonetheless, basically this is redefining _get_screw_fam(n) as _get_fam(n).
Does _get_nut_key("M5x10") work?
Hi, sorry it me so long to get back to you :(
Yes, _get_nut_key("M5x10") works! Now I understand screw_fam, thanks!
I was about to propose that _get_nut_key() uses _get_fam() instead of _get_screw_fam(), because the key size of an M5 nut doesn't really depend on the length of the screw. But then I realized that if you have the screw family in a variable (like screw = "M5x10";), you wouldn't be able to get the key size easily :)
Thanks for your help :)
Hi!
I had an issue with _get_nut_key(). It used to return "undef". I traced the issue back to _get_screw_fam(), where the "undef" was coming from.
I have no clue about OpenSCAD, but changing _get_screw_fam() to:
function _get_screw_fam(n) = data_screw_fam[search(n)], data_screw_fam)[0]];
seemed to do the trick.
I have no idea if that is the right thing to do or not ;)
I'm willing to make a PR, if you tell me if this change is correct or rubbish ;) If it's the latter, maybe you can give me a hint of why I'm getting "undef when calling, for example:
_get_nut_key("M5")
Thanks