Skip to content

Turn off autodetect after FILE_FORMAT#156

Merged
ooxi merged 2 commits intogerbv:mainfrom
eyal0:autod_0
Nov 28, 2022
Merged

Turn off autodetect after FILE_FORMAT#156
ooxi merged 2 commits intogerbv:mainfrom
eyal0:autod_0

Conversation

@eyal0
Copy link
Copy Markdown
Collaborator

@eyal0 eyal0 commented Nov 28, 2022

This fixes #155

Add Altium-style test files with the `FILE_FORMAT` statement and the
`INCH` statement, in both orders.  The order should not matter.
The `FILE_FORMAT` comment sets the number of digits before and after
the decimal.  If there is a following `INCH,TZ` command, we need to
disable the auto-detection so that this won't reset the digits to the
default, which is what usually happens when `INCH,TZ` isn't followed
by a format like `0000.0000`.
@ooxi ooxi merged commit 944a4b3 into gerbv:main Nov 28, 2022
@ooxi
Copy link
Copy Markdown
Contributor

ooxi commented Nov 28, 2022

Great PR, especially first adding a test case and then fixing it

@eyal0
Copy link
Copy Markdown
Collaborator Author

eyal0 commented Nov 28, 2022

Great PR, especially first adding a test case and then fixing it

That was no accident! It allows us to see the effect of the change together with the new code. I like it that way, add a test and then add code.

@ooxi
Copy link
Copy Markdown
Contributor

ooxi commented Nov 28, 2022

That was no accident! It allows us to see the effect of the change together with the new code.

Yes I appreciate the extra effort it takes to do it this way. Makes the commits much easier to reason about :-)

rampageservices added a commit to SourceParts/gerbv that referenced this pull request Feb 21, 2026
When FILE_FORMAT=N:M sets autod=0 (commit 944a4b3, PR gerbv#156), the
subsequent INCH,LZ or METRIC,LZ line is completely ignored — not just
the decimals/number_format override (intended), but also the omit_zeros
setting (regression).

This causes coordinates with suppressed trailing zeros to be
misinterpreted, rendering drill holes at wildly incorrect positions.
Affects all Altium-exported drill files using FILE_FORMAT + INCH,LZ.

Fix: move omit_zeros assignment outside the if(state->autod) gate in
both drill_parse_header_is_inch() and drill_parse_header_is_metric().
The autod guard still correctly prevents decimals/number_format from
being overridden when FILE_FORMAT has already set them.

Fixes gerbv#174. Fixes gerbv#195.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Numeric format incorrect when reading Altium 14 NC Drill file

2 participants