pcb_parser.cpp: allows 0 width line thickness for circles in custom shaped pads.

the commit 1100ccb032 broke DRAWSEGMENT filled circles (line width = 0) used only in custom pads.

Fixes: lp:1792791
https://bugs.launchpad.net/kicad/+bug/1792791
This commit is contained in:
jean-pierre charras 2018-09-16 15:10:48 +02:00
parent 2196959539
commit ac0c7441b4
2 changed files with 13 additions and 6 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 CERN
* Copyright (C) 2012-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -1370,7 +1370,7 @@ void PCB_PARSER::parseNETCLASS()
}
DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT()
DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT( bool aAllowCirclesZeroWidth )
{
wxCHECK_MSG( CurTok() == T_gr_arc || CurTok() == T_gr_circle || CurTok() == T_gr_curve ||
CurTok() == T_gr_line || CurTok() == T_gr_poly, NULL,
@ -1534,7 +1534,9 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT()
// 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 )
// However in custom pad shapes, zero-line width is allowed for filled circles
if( segment->GetShape() != S_POLYGON && segment->GetWidth() == 0 &&
!( segment->GetShape() == S_CIRCLE && aAllowCirclesZeroWidth ) )
segment->SetWidth( Millimeter2iu( DEFAULT_LINE_WIDTH ) );
return segment.release();
@ -2576,7 +2578,8 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent )
break;
case T_gr_circle:
dummysegm = parseDRAWSEGMENT();
dummysegm = parseDRAWSEGMENT( true ); // Circles with 0 thickness are allowed
// ( filled circles )
pad->AddPrimitive( dummysegm->GetCenter(), dummysegm->GetRadius(),
dummysegm->GetWidth() );
break;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 CERN
* Copyright (C) 2012-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -113,7 +113,11 @@ class PCB_PARSER : public PCB_LEXER
void parseNETINFO_ITEM();
void parseNETCLASS();
DRAWSEGMENT* parseDRAWSEGMENT();
/** Read a DRAWSEGMENT description.
* @param aAllowCirclesZeroWidth = true to allow items with 0 width
* Only used in custom pad shapes for filled circles.
*/
DRAWSEGMENT* parseDRAWSEGMENT( bool aAllowCirclesZeroWidth = false );
TEXTE_PCB* parseTEXTE_PCB();
DIMENSION* parseDIMENSION();