Don't save UUIDs for teardrop zones.

They're really just a geometry cache.

Also removes writing of filled_areas_thickness,
which hasn't been supported in yonks.

Also cleans up writing of island removal strategy
(the limit is only needed in limit mode).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20717
This commit is contained in:
Jeff Young 2025-04-22 18:19:24 +01:00
parent e75076ab41
commit 1ec47a053b
5 changed files with 24 additions and 24 deletions

View File

@ -172,7 +172,7 @@ void Prettify( std::string& aSource, bool aCompactSave )
while( ++seek != aSource.end() && isalpha( *seek ) )
token += *seek;
return token == "font" || token == "stroke" || token == "fill"
return token == "font" || token == "stroke" || token == "fill" || token == "teardrop"
|| token == "offset" || token == "rotate" || token == "scale";
};

View File

@ -2541,9 +2541,10 @@ void PCB_IO_KICAD_SEXPR::format( const ZONE* aZone ) const
else
formatLayer( aZone->GetFirstLayer() );
if( !aZone->IsTeardropArea() )
KICAD_FORMAT::FormatUuid( m_out, aZone->m_Uuid );
if( !aZone->GetZoneName().empty() )
if( !aZone->GetZoneName().empty() && !aZone->IsTeardropArea() )
m_out->Print( "(name %s)", m_out->Quotew( aZone->GetZoneName() ).c_str() );
// Save the outline aux info
@ -2569,8 +2570,7 @@ void PCB_IO_KICAD_SEXPR::format( const ZONE* aZone ) const
if( aZone->IsTeardropArea() )
{
m_out->Print( "(attr (teardrop (type %s)))",
aZone->GetTeardropAreaType() == TEARDROP_TYPE::TD_VIAPAD
? "padvia"
aZone->GetTeardropAreaType() == TEARDROP_TYPE::TD_VIAPAD ? "padvia"
: "track_end" );
}
@ -2603,9 +2603,6 @@ void PCB_IO_KICAD_SEXPR::format( const ZONE* aZone ) const
m_out->Print( "(min_thickness %s)",
formatInternalUnits( aZone->GetMinThickness() ).c_str() );
// We continue to write this for 3rd-party parsers, but we no longer read it (as of V7).
m_out->Print( "(filled_areas_thickness no)" );
if( aZone->GetIsRuleArea() )
{
// Keepout settings
@ -2645,9 +2642,12 @@ void PCB_IO_KICAD_SEXPR::format( const ZONE* aZone ) const
if( aZone->GetFillMode() == ZONE_FILL_MODE::HATCH_PATTERN )
m_out->Print( "(mode hatch)" );
if( !aZone->IsTeardropArea() )
{
m_out->Print( "(thermal_gap %s) (thermal_bridge_width %s)",
formatInternalUnits( aZone->GetThermalReliefGap() ).c_str(),
formatInternalUnits( aZone->GetThermalReliefSpokeWidth() ).c_str() );
}
if( aZone->GetCornerSmoothingType() != ZONE_SETTINGS::SMOOTHING_NONE )
{
@ -2670,10 +2670,12 @@ void PCB_IO_KICAD_SEXPR::format( const ZONE* aZone ) const
m_out->Print( "(radius %s)", formatInternalUnits( aZone->GetCornerRadius() ).c_str() );
}
if( aZone->GetIslandRemovalMode() != ISLAND_REMOVAL_MODE::ALWAYS )
m_out->Print( "(island_removal_mode %d)",
static_cast<int>( aZone->GetIslandRemovalMode() ) );
if( aZone->GetIslandRemovalMode() == ISLAND_REMOVAL_MODE::AREA )
{
m_out->Print( "(island_removal_mode %d) (island_area_min %s)",
static_cast<int>( aZone->GetIslandRemovalMode() ),
m_out->Print( "(island_area_min %s)",
formatInternalUnits( aZone->GetMinIslandArea() / pcbIUScale.IU_PER_MM ).c_str() );
}

View File

@ -6872,7 +6872,10 @@ ZONE* PCB_IO_KICAD_SEXPR_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
std::map<PCB_LAYER_ID, std::vector<SEG>> legacySegs;
PCB_LAYER_ID filledLayer;
bool addedFilledPolygons = false;
bool isStrokedFill = true;
// This hasn't been supported since V6 or so, but we only stopped writing out the token
// in V10.
bool isStrokedFill = m_requiredVersion < 20250210;
std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aParent );
@ -7473,9 +7476,8 @@ ZONE* PCB_IO_KICAD_SEXPR_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
{
if( m_showLegacy5ZoneWarning )
{
wxLogWarning(
_( "Legacy zone fill strategy is not supported anymore.\nZone fills will "
"be converted on best-effort basis." ) );
wxLogWarning( _( "Legacy zone fill strategy is not supported anymore.\n"
"Zone fills will be converted on best-effort basis." ) );
m_showLegacy5ZoneWarning = false;
}

View File

@ -72,8 +72,6 @@ ZONE* TEARDROP_MANAGER::createTeardrop( TEARDROP_VARIANT aTeardropVariant,
teardrop->SetMinThickness( pcbIUScale.mmToIU( 0.0254 ) ); // The minimum zone thickness
teardrop->SetPadConnection( ZONE_CONNECTION::FULL );
teardrop->SetIsFilled( false );
teardrop->SetZoneName( aTeardropVariant == TD_TYPE_PADVIA ? MAGIC_TEARDROP_PADVIA_NAME
: MAGIC_TEARDROP_TRACK_NAME );
teardrop->SetIslandRemovalMode( ISLAND_REMOVAL_MODE::NEVER );
teardrop->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL,
pcbIUScale.mmToIU( 0.1 ), true );

View File

@ -34,8 +34,6 @@
#include <drc/drc_rtree.h>
#include "teardrop_parameters.h"
#define MAGIC_TEARDROP_PADVIA_NAME "$teardrop_padvia$"
#define MAGIC_TEARDROP_TRACK_NAME "$teardrop_track$"
// A class to store tracks grouped by layer and netcode
class TRACK_BUFFER