From 1100ccb0326c3d781511d3e6e21a5a6351f80cc2 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Wed, 5 Sep 2018 16:30:48 -0700 Subject: [PATCH] pcbnew: Set default line width for invalids Invalid graphical items that cannot be created in pcbnew may still be created by external tools. This synchronizes the pcbnew view display with the gerber output and 3d viewer line widths for these types of lines. Only filled polygons are permitted 0-width lines. Fixes: lp:1790534 * https://bugs.launchpad.net/kicad/+bug/1790534 --- pcbnew/pcb_parser.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index b2f1fed0e2..422896c6c9 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -1536,6 +1536,12 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT() NeedRIGHT(); } + // Only filled polygons may have a zero-line width + // This is not permitted in KiCad but some external tools generate invalid + // files. + if( segment->GetShape() != S_POLYGON && segment->GetWidth() == 0 ) + segment->SetWidth( Millimeter2iu( DEFAULT_LINE_WIDTH ) ); + return segment.release(); } @@ -2294,6 +2300,12 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE() NeedRIGHT(); } + // Only filled polygons may have a zero-line width + // This is not permitted in KiCad but some external tools generate invalid + // files. + if( segment->GetShape() != S_POLYGON && segment->GetWidth() == 0 ) + segment->SetWidth( Millimeter2iu( DEFAULT_LINE_WIDTH ) ); + return segment.release(); }