fix error messages

This commit is contained in:
Adrian Mariano 2023-01-30 16:49:58 -05:00
parent f402c09e8f
commit 521f099fc9

View file

@ -540,7 +540,7 @@ module screw(spec, head, drive, thread, drive_size,
: _counterbore; : _counterbore;
head = struct_val(tempspec,"head"); head = struct_val(tempspec,"head");
headless = head=="none"; headless = head=="none";
flathead = starts_with(head,"flat"); flathead = is_def(head) && starts_with(head,"flat");
reset_headsize = _internal && flathead ? struct_val(tempspec,"head_size_sharp") : undef; reset_headsize = _internal && flathead ? struct_val(tempspec,"head_size_sharp") : undef;
spec=_struct_reset(tempspec,[ spec=_struct_reset(tempspec,[
["length", l], ["length", l],
@ -2624,7 +2624,7 @@ function _screw_info_metric(diam, pitch, head, thread, drive) =
[48, [72, 36]], [48, [72, 36]],
], ],
entry = struct_val(metric_socket, diam), entry = struct_val(metric_socket, diam),
dummy=assert(is_def(entry), str("Screw size M",diam," unsupported for headless screws")), dummy=assert(is_def(entry), str("Screw size M",diam," unsupported for head type \"",head,"\"")),
drive_size = drive=="hex" ? [["drive_size",entry[1]],["drive_depth",diam/2]] : drive_size = drive=="hex" ? [["drive_size",entry[1]],["drive_depth",diam/2]] :
drive=="torx" ? [["drive_size", entry[2]], ["drive_depth", entry[3]]] : drive=="torx" ? [["drive_size", entry[2]], ["drive_depth", entry[3]]] :
[] []
@ -2648,7 +2648,7 @@ function _screw_info_metric(diam, pitch, head, thread, drive) =
type = head=="pan" ? (drive=="slot" ? "pan flat" : "pan round") : head, type = head=="pan" ? (drive=="slot" ? "pan flat" : "pan round") : head,
htind = drive=="slot" ? 1 : 2, htind = drive=="slot" ? 1 : 2,
entry = struct_val(metric_pan, diam), entry = struct_val(metric_pan, diam),
dummy=assert(is_def(entry), str("Screw size M",diam," unsupported for headless screws")), dummy=assert(is_def(entry), str("Screw size M",diam," unsupported for head type \"",head,"\"")),
drive_size = drive=="phillips" ? [["drive_size", entry[3]], drive_size = drive=="phillips" ? [["drive_size", entry[3]],
//["drive_diameter", entry[4]], //["drive_diameter", entry[4]],
["drive_depth",entry[5]], ["drive_depth",entry[5]],
@ -2711,7 +2711,7 @@ function _screw_info_metric(diam, pitch, head, thread, drive) =
: drive=="torx"? metric_cheese_torx : drive=="torx"? metric_cheese_torx
: metric_cheese, : metric_cheese,
diam), diam),
dummy=assert(is_def(entry), str("Screw size M",diam," unsupported for headless screws")), dummy=assert(is_def(entry), str("Screw size M",diam," unsupported for head type \"",head,"\"")),
drive_index = drive=="phillips" ? 3 drive_index = drive=="phillips" ? 3
: drive=="hex" ? 2 : drive=="hex" ? 2
: undef, : undef,
@ -2772,7 +2772,7 @@ function _screw_info_metric(diam, pitch, head, thread, drive) =
[20, [40 , 35.7 ]] [20, [40 , 35.7 ]]
], ],
entry = struct_val(small ? metric_flat_small : metric_flat_large, diam), entry = struct_val(small ? metric_flat_small : metric_flat_large, diam),
dummy=assert(is_def(entry), str("Screw size M",diam," unsupported for headless screws")), dummy=assert(is_def(entry), str("Screw size M",diam," unsupported for head type \"",head,"\"")),
driveind = small && drive=="phillips" ? 2 driveind = small && drive=="phillips" ? 2
: !small && drive=="hex" ? 2 : !small && drive=="hex" ? 2
: !small && drive=="torx" ? 4 : !small && drive=="torx" ? 4