diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 422896c6c9..dce98b1adf 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -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 @@ -1375,7 +1375,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, @@ -1539,7 +1539,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(); @@ -2588,7 +2590,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; diff --git a/pcbnew/pcb_parser.h b/pcbnew/pcb_parser.h index df97b450a2..66ab78aca3 100644 --- a/pcbnew/pcb_parser.h +++ b/pcbnew/pcb_parser.h @@ -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();