diff --git a/common/pcb.keywords b/common/pcb.keywords index 2befed63d3..b1176f04f5 100644 --- a/common/pcb.keywords +++ b/common/pcb.keywords @@ -215,6 +215,7 @@ pad_prop_fiducial_glob pad_prop_castellated pad_prop_testpoint pad_prop_heatsink +padvia private_layers property page @@ -272,6 +273,7 @@ tags target title title_block +teardrop tedit text_frame text_position_mode @@ -287,6 +289,7 @@ top_left top_right trace_width tracks +track_end trace_min trace_clearance trapezoid diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index fed461ee37..0283f20753 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -5856,7 +5856,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent ) NextTok(); zone->SetZoneName( FromUTF8() ); - // TODO: remove this hack and replace it when a suitable token is added + // TODO: remove this hack in next future, now keywords are added for teadrop attribute // If a zone name starts by "$teardrop_", set its teardrop property flag if( zone->GetZoneName().StartsWith( "$teardrop_p" ) ) zone->SetTeardropAreaType( TEARDROP_TYPE::TD_VIAPAD ); @@ -5866,9 +5866,58 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent ) NeedRIGHT(); break; + case T_attr: + for( token = NextTok(); token != T_RIGHT; token = NextTok() ) + { + if( token == T_LEFT ) + token = NextTok(); + + switch( token ) + { + case T_teardrop: + token = NextTok(); + + // Expected teardrop data (type padvia) or (type track_end) + if( token == T_LEFT ) + { + token = NextTok(); + + if( token == T_type ) + { + token = NextTok(); + + if( token == T_padvia ) + { + zone->SetTeardropAreaType( TEARDROP_TYPE::TD_VIAPAD ); + NeedRIGHT(); + } + else if( token == T_track_end ) + { + zone->SetTeardropAreaType( TEARDROP_TYPE::TD_TRACKEND ); + NeedRIGHT(); + } + else + Expecting( "padvia or track_end" ); + + NeedRIGHT(); + } + else + Expecting( "type" ); + } + else + Expecting( "(" ); + + break; + + default: + Expecting( "teardrop" ); + } + } + break; + default: Expecting( "net, layer/layers, tstamp, hatch, priority, connect_pads, min_thickness, " - "fill, polygon, filled_polygon, fill_segments, or name" ); + "fill, polygon, filled_polygon, fill_segments, attr, or name" ); } } diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp index 582c2e3ea2..b62e94e68e 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.cpp +++ b/pcbnew/plugins/kicad/pcb_plugin.cpp @@ -2092,6 +2092,27 @@ void PCB_PLUGIN::format( const ZONE* aZone, int aNestLevel ) const if( aZone->GetAssignedPriority() > 0 ) m_out->Print( aNestLevel+1, "(priority %d)\n", aZone->GetAssignedPriority() ); +// Disable teardrop keyword in file only temporarily (WIP) to avoid file format change +#if 0 + if( aZone->IsTeardropArea() ) + { + const char* td_type; + + switch( aZone->GetTeardropAreaType() ) + { + case TEARDROP_TYPE::TD_VIAPAD: // a teardrop on a via or pad + td_type = "padvia"; + break; + + default: + case TEARDROP_TYPE::TD_TRACKEND: // a teardrop on a track end + td_type = "track_end"; + break; + } + + m_out->Print( aNestLevel+1, "(attr (teardrop (type %s)))\n", td_type ); + } +#endif m_out->Print( aNestLevel+1, "(connect_pads" ); switch( aZone->GetPadConnection() )