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(); }