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
This commit is contained in:
Seth Hillbrand 2018-09-05 16:30:48 -07:00
parent bdcae5f593
commit 48bbde65b3
2 changed files with 13 additions and 0 deletions

View File

@ -33,6 +33,7 @@
// Some default values for the board editor and the fp editor (given in mm) // Some default values for the board editor and the fp editor (given in mm)
#define DEFAULT_TEXT_MODULE_SIZE 1.0 #define DEFAULT_TEXT_MODULE_SIZE 1.0
#define DEFAULT_GR_MODULE_THICKNESS 0.15 // given in mm #define DEFAULT_GR_MODULE_THICKNESS 0.15 // given in mm
#define DEFAULT_LINE_WIDTH 0.10
// Board thickness, mainly for 3D view: // Board thickness, mainly for 3D view:
#define DEFAULT_BOARD_THICKNESS_MM 1.6 #define DEFAULT_BOARD_THICKNESS_MM 1.6

View File

@ -1531,6 +1531,12 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT()
NeedRIGHT(); 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(); return segment.release();
} }
@ -2282,6 +2288,12 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
NeedRIGHT(); 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(); return segment.release();
} }