The function simply maps the given diameter to a respective height. However, these heights depend on the head type of the respective screw and thus the returned value does not match the actual value in some cases (I didn't fully investigate which cases), e.g., for countersunk. Getting the exact height is important to me to precisely cut out clearances above screws that are "embedded" into the material of 3d prints.
It should be quite easy to add an optional parameter that describes the head type. I have added a similar function for my own needs:
function get_metric_bolt_head_type_height(size, headtype) =
let (D = headtype != "hex"?
get_metric_socket_cap_diam(size) :
get_metric_bolt_head_size(size))
let (H = headtype == "socket"?
get_metric_socket_cap_height(size) :
get_metric_bolt_head_height(size))
(
(headtype == "pan" || headtype == "round" || headtype == "button")? H*0.75 :
(headtype == "countersunk")? (D-size)/2 :
(headtype == "oval")? ((D-size)/2 + D/2/3) :
H
);
The hardest path is probably just to cut down on the code duplication between that function and the metric_bolt module.
The function simply maps the given diameter to a respective height. However, these heights depend on the head type of the respective screw and thus the returned value does not match the actual value in some cases (I didn't fully investigate which cases), e.g., for
countersunk. Getting the exact height is important to me to precisely cut out clearances above screws that are "embedded" into the material of 3d prints.It should be quite easy to add an optional parameter that describes the head type. I have added a similar function for my own needs:
The hardest path is probably just to cut down on the code duplication between that function and the
metric_boltmodule.