(WIP) Teardrop: use a specific attribute in .kicad_pcb file to identify teardrops

the new attribute is:
"(attr (teardrop type padvia)))" or "(attr (teardrop (type track_end)))"
However (Work in Progress) writing this attribute in file is temporarily disabled.
This commit is contained in:
jean-pierre charras 2022-04-03 18:31:53 +02:00
parent 61be5854d7
commit 5c7a79e287
3 changed files with 75 additions and 2 deletions

View File

@ -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

View File

@ -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" );
}
}

View File

@ -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() )