Turn off autodetect after FILE_FORMAT#156
Merged
ooxi merged 2 commits intogerbv:mainfrom Nov 28, 2022
Merged
Conversation
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`.
Contributor
|
Great PR, especially first adding a test case and then fixing it |
This was referenced Nov 28, 2022
Collaborator
Author
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. |
Contributor
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.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes #155