Skip to content

fix: correctly apply N from FILE_FORMAT=N:M with LZ trailing suppression#278

Merged
spe-ciellt merged 2 commits intodevelopfrom
fix/file-format-lz-trailing-suppression-decimals
Feb 23, 2026
Merged

fix: correctly apply N from FILE_FORMAT=N:M with LZ trailing suppression#278
spe-ciellt merged 2 commits intodevelopfrom
fix/file-format-lz-trailing-suppression-decimals

Conversation

@spe-ciellt
Copy link
Copy Markdown
Contributor

Didn't read the whole part of the drill file format., but that is done now.
The tests are updated with new golden reference images.
Altium_file_format_inch_lz.drl was unnoticeable was affected by the error.
Ruthie_V1R0-Plated.drl, which is a new file that highlighted the problem.

There can be a problem when running the pipeline if the versions of Cairo are different when locally generating the golden file and the one in the pipeline, hopefully that should not be any problem.

@ejouellette allowed us to use the files he used to show the problem as example and as a reference for the tests.

Closes #238

When FILE_FORMAT=N:M is parsed, only M (digits after the decimal) was
stored as state->decimals, while N (digits before) was discarded.

The decimals field has a documented dual meaning: in FMT_USER with
trailing zero suppression it is the digits *before* the decimal point
(i.e. N), and in all other cases it is the digits *after* (M).

Commit 023e835 fixed omit_zeros being ignored when autod=0, but exposed
the data loss: with omit_zeros=TRAILING now set, read_double used
wantdigits=decimals=M=5 instead of the correct N=2, placing the decimal
five digits in instead of two. A coordinate like Y0297402 was parsed as
02974.02 (≈2974 in) instead of 02.97402 (≈2.97 in).

Fix: store N in a new digits_before field on drill_state_t. When
INCH,LZ or METRIC,LZ is processed with autod=0 and FMT_USER, set
decimals=digits_before so read_double gets the correct wantdigits.

Also regenerates the Altium_file_format_inch_lz golden (previously
generated with the broken wantdigits=5 parsing), and adds
 Ruthie_V1R0-Plated as a regression test for this case.
The regression test uses the drill file, but it is always great to have the complete project
so you can see it all together. The bugs sticks out like a sore thumb.
@spe-ciellt spe-ciellt self-assigned this Feb 23, 2026
@spe-ciellt spe-ciellt merged commit cf7b414 into develop Feb 23, 2026
1 check passed
@spe-ciellt spe-ciellt deleted the fix/file-format-lz-trailing-suppression-decimals branch February 23, 2026 18:18
@spe-ciellt spe-ciellt added the bug Something isn't working label Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gerbv 2.10.0 or 2.10.1 Issues with PTH NCdrill locations

1 participant