fix: silently ignore Gerber X2 attribute commands (TF, TA, TO, TD)#282
Conversation
KiCad >= 8 and other modern EDA tools generate Gerber X2 files with %TF%, %TA%, %TO%, and %TD% attribute commands. These are standard metadata extensions defined by Ucamco in 2014 that don't affect rendering. gerbv already renders these files correctly, but the RS-274X parser didn't recognize the commands, causing error-level spam in the Messages pane. Add four case statements in parse_rs274x() to match these commands and log them at NOTE level instead of ERROR. The existing cleanup code already reads until the trailing '*', so the attribute data is consumed automatically. Fixes gerbv#249
|
Thank you for this patch. You've been busy it seems like. ;) I will work through your list of PRs. If they are good enough I apply them else I will leave comments. |
|
Tested on the branch. Build is clean, all four attribute types ( Code: The fix slots cleanly into the existing switch pattern. The unconditional cleanup code after the switch ( Tests: New test The NOTE vs ERROR distinction is only visible in the GUI Messages pane, not CLI output, so it can't be exercised by the automated suite — but the rendered output test is the right check here. |
Summary
KiCad >= 8 and other modern EDA tools generate Gerber X2 files containing
%TF%,%TA%,%TO%, and%TD%attribute commands. These are standard Gerber X2 metadata extensions (defined by Ucamco in 2014) that don't affect rendering — gerbv already renders these files correctly — butparse_rs274x()doesn't recognize them, causing error-level spam:This PR adds four
casestatements to match these commands and log them atGERBV_MESSAGE_NOTElevel instead ofGERBV_MESSAGE_ERROR. The existing cleanup code (lines 1853-1858) already reads until the trailing*character, so the attribute data is consumed automatically — only thecase/breakis needed.Gerber X2 Attribute Commands
%TF.<name>,<values>*%%TA.<name>,<values>*%%TO.<name>,<values>*%%TD[.<name>]*%Changes
src/gerber.c: Addcase A2I('T','F')/A2I('T','A')/A2I('T','O')/A2I('T','D')to the switch inparse_rs274x(), logging at NOTE level and breakingtest/inputs/test-gerber-x2-attributes.gbx: Minimal Gerber X2 test file with all four attribute typestest/golden/test-gerber-x2-attributes.png: Golden reference for the testtest/tests.list: Register the new testFixes #249
Test plan
cmake .. && make)./run_tests.sh) — new test passes, no regressions