Teardrops: fixes and enhancements:
- do not allow smoothing outlines: outlines are already optimized. - do not allow settings incompatible with teardrop area (grid, thermal relief) - DIALOG_COPPER_ZONE: export zone settings to similar zones only. Fixes #11040 https://gitlab.com/kicad/code/kicad/issues/11040
This commit is contained in:
parent
c18d9b9baf
commit
3bb1fd8311
|
@ -81,6 +81,7 @@ private:
|
|||
UNIT_BINDER m_gridStyleGap;
|
||||
UNIT_BINDER m_islandThreshold;
|
||||
bool m_hideAutoGeneratedNets;
|
||||
bool m_isTeardrop;
|
||||
|
||||
std::map<wxString, int> m_netNameToNetCode;
|
||||
std::vector<NETINFO_ITEM*> m_netInfoItemList;
|
||||
|
@ -189,6 +190,26 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
|
|||
m_settings.SetupLayersList( m_layers, m_Parent,
|
||||
LSET::AllCuMask( aParent->GetBoard()->GetCopperLayerCount() ),
|
||||
false );
|
||||
m_isTeardrop = m_settings.m_TeardropType != TEARDROP_TYPE::TD_NONE;
|
||||
|
||||
switch( m_settings.m_TeardropType )
|
||||
{
|
||||
case TEARDROP_TYPE::TD_NONE:
|
||||
// standard copper zone
|
||||
break;
|
||||
|
||||
case TEARDROP_TYPE::TD_VIAPAD:
|
||||
SetTitle( _( "Teardrop on Vias/Pads Properties" ) );
|
||||
break;
|
||||
|
||||
case TEARDROP_TYPE::TD_TRACKEND:
|
||||
SetTitle( _( "Teardrop on Tracks Properties" ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
SetTitle( _( "Teardrop Properties" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
m_settingsExported = false;
|
||||
m_currentlySelectedNetcode = INVALID_NET_CODE;
|
||||
|
@ -223,6 +244,14 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
|
|||
m_cornerRadius.SetValue( m_settings.GetCornerRadius() );
|
||||
m_PriorityLevelCtrl->SetValue( m_settings.m_ZonePriority );
|
||||
|
||||
if( m_isTeardrop ) // outlines are never smoothed: they have alreay the right shape
|
||||
{
|
||||
m_cornerSmoothingChoice->SetSelection( 0 );
|
||||
m_cornerSmoothingChoice->Enable( false );
|
||||
m_cornerRadius.SetValue( 0 );
|
||||
m_cornerRadius.Enable( false );
|
||||
}
|
||||
|
||||
switch( m_settings.m_ZoneBorderDisplayStyle )
|
||||
{
|
||||
case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: m_OutlineDisplayCtrl->SetSelection( 0 ); break;
|
||||
|
@ -244,6 +273,12 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
|
|||
case ZONE_CONNECTION::FULL: m_PadInZoneOpt->SetSelection( 0 ); break;
|
||||
}
|
||||
|
||||
if( m_isTeardrop )
|
||||
{
|
||||
m_PadInZoneOpt->SetSelection( 0 );
|
||||
m_PadInZoneOpt->Enable( false );
|
||||
}
|
||||
|
||||
// Do not enable/disable antipad clearance and spoke width. They might be needed if
|
||||
// a footprint or pad overrides the zone to specify a thermal connection.
|
||||
m_antipadClearance.SetValue( m_settings.m_ThermalReliefGap );
|
||||
|
@ -270,11 +305,12 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
|
|||
// Initialize information required to display nets list
|
||||
readNetInformation();
|
||||
|
||||
switch( m_settings.m_FillMode )
|
||||
{
|
||||
case ZONE_FILL_MODE::HATCH_PATTERN: m_GridStyleCtrl->SetSelection( 1 ); break;
|
||||
default: m_GridStyleCtrl->SetSelection( 0 ); break;
|
||||
}
|
||||
if( !m_isTeardrop && m_settings.m_FillMode == ZONE_FILL_MODE::HATCH_PATTERN )
|
||||
m_GridStyleCtrl->SetSelection( 1 );
|
||||
else
|
||||
m_GridStyleCtrl->SetSelection( 0 );
|
||||
|
||||
m_GridStyleCtrl->Enable( !m_isTeardrop );
|
||||
|
||||
m_gridStyleRotation.SetUnits( EDA_UNITS::DEGREES );
|
||||
m_gridStyleRotation.SetAngleValue( m_settings.m_HatchOrientation );
|
||||
|
@ -655,6 +691,13 @@ void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event )
|
|||
if( zone->GetIsRuleArea() )
|
||||
continue;
|
||||
|
||||
// Export only to similar zones:
|
||||
// Teardrop area -> teardrop area of same type
|
||||
// copper zone -> copper zone
|
||||
// Exporting current settings to a different zone type make no sense
|
||||
if( m_settings.m_TeardropType != zone->GetTeardropAreaType() )
|
||||
continue;
|
||||
|
||||
m_settings.ExportSetting( *zone, false ); // false = partial export
|
||||
m_settingsExported = true;
|
||||
m_Parent->OnModify();
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2021 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2022 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
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef TEARDROP_TYPES_H
|
||||
#define TEARDROP_TYPES_H
|
||||
|
||||
/**
|
||||
* define the type of a teardrop: on a via or pad, or a track end
|
||||
*/
|
||||
enum class TEARDROP_TYPE
|
||||
{
|
||||
TD_NONE = 0, // Not a teardrop: just a standard zone
|
||||
TD_UNSPECIFIED, // Not specified/unknown teardrop type
|
||||
TD_VIAPAD, // a teardrop on a via or pad
|
||||
TD_TRACKEND // a teardrop on a track end
|
||||
// (when 2 tracks having different widths have a teardrop on the
|
||||
// end of the largest track)
|
||||
};
|
||||
|
||||
|
||||
#endif // ifndef TEARDROP_TYPES_H
|
|
@ -520,6 +520,8 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
|
|||
|
||||
if( GetIsRuleArea() )
|
||||
msg = _( "Rule Area" );
|
||||
else if( IsTeardropArea() )
|
||||
msg = _( "Teardrop Area" );
|
||||
else if( IsOnCopperLayer() )
|
||||
msg = _( "Copper Zone" );
|
||||
else
|
||||
|
@ -1068,6 +1070,12 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer
|
|||
const BOARD* board = GetBoard();
|
||||
int maxError = ARC_HIGH_DEF;
|
||||
bool keepExternalFillets = false;
|
||||
bool smooth_requested = m_cornerSmoothingType == ZONE_SETTINGS::SMOOTHING_CHAMFER
|
||||
|| m_cornerSmoothingType == ZONE_SETTINGS::SMOOTHING_FILLET;
|
||||
|
||||
if( IsTeardropArea() ) // We use teardrop shapes with no smoothing
|
||||
// these shapes are already optimized
|
||||
smooth_requested = false;
|
||||
|
||||
if( board )
|
||||
{
|
||||
|
@ -1079,6 +1087,10 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer
|
|||
|
||||
auto smooth = [&]( SHAPE_POLY_SET& aPoly )
|
||||
{
|
||||
|
||||
if( !smooth_requested )
|
||||
return;
|
||||
|
||||
switch( m_cornerSmoothingType )
|
||||
{
|
||||
case ZONE_SETTINGS::SMOOTHING_CHAMFER:
|
||||
|
@ -1107,7 +1119,7 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer
|
|||
// Should external fillets (that is, those applied to concave corners) be kept? While it
|
||||
// seems safer to never have copper extend outside the zone outline, 5.1.x and prior did
|
||||
// indeed fill them so we leave the mode available.
|
||||
if( keepExternalFillets )
|
||||
if( keepExternalFillets && smooth_requested )
|
||||
{
|
||||
withFillets = flattened;
|
||||
smooth( withFillets );
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <layer_ids.h>
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <zone_settings.h>
|
||||
#include <teardrop/teardrop_types.h>
|
||||
|
||||
|
||||
class EDA_RECT;
|
||||
|
@ -43,18 +44,6 @@ class BOARD;
|
|||
class ZONE;
|
||||
class MSG_PANEL_ITEM;
|
||||
|
||||
/**
|
||||
* define the type of a teardrop: on a via or pad, or atrack end
|
||||
*/
|
||||
enum class TEARDROP_TYPE
|
||||
{
|
||||
TD_NONE = 0, // Not a teardrop: just a standard zone
|
||||
TD_UNSPECIFIED, // Not specified/unknown teardrop type
|
||||
TD_VIAPAD, // a teardrop on a via or pad
|
||||
TD_TRACKEND // a teardrop on a track end
|
||||
// (when 2 tracks having different widths have a teardrop on the
|
||||
// end of the largest track)
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle a list of polygons defining a copper zone.
|
||||
|
|
|
@ -122,6 +122,11 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE& aSource )
|
|||
m_removeIslands = aSource.GetIslandRemovalMode();
|
||||
m_minIslandArea = aSource.GetMinIslandArea();
|
||||
|
||||
// Currently, the teardrop area type is not really a ZONE_SETTINGS parameter,
|
||||
// but a ZONE parameter only.
|
||||
// However it can be used in dialogs
|
||||
m_TeardropType = aSource.GetTeardropAreaType();
|
||||
|
||||
m_Layers = aSource.GetLayerSet();
|
||||
|
||||
return *this;
|
||||
|
@ -155,6 +160,12 @@ void ZONE_SETTINGS::ExportSetting( ZONE& aTarget, bool aFullExport ) const
|
|||
aTarget.SetLocked( m_Locked );
|
||||
aTarget.SetIslandRemovalMode( GetIslandRemovalMode() );
|
||||
aTarget.SetMinIslandArea( GetMinIslandArea() );
|
||||
// Currently, the teardrop area type is not imported from a ZONE_SETTINGS, because
|
||||
// it is not really a ZONE_SETTINGS parameter, but a ZONE parameter only
|
||||
#if 0
|
||||
aTarget.SetTeardropAreaType( m_TeardropType );
|
||||
#endif
|
||||
|
||||
|
||||
if( aFullExport )
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <layer_ids.h>
|
||||
#include <zones.h>
|
||||
#include <geometry/eda_angle.h>
|
||||
#include <teardrop/teardrop_types.h>
|
||||
|
||||
class wxDataViewListCtrl;
|
||||
|
||||
|
@ -107,6 +108,11 @@ public:
|
|||
bool m_Zone_45_Only;
|
||||
bool m_Locked;
|
||||
|
||||
/* A zone outline can be a teardrop zone with different rules
|
||||
* priority, smoothed corners, thermal relief...
|
||||
*/
|
||||
TEARDROP_TYPE m_TeardropType;
|
||||
|
||||
private:
|
||||
int m_cornerSmoothingType; // Corner smoothing type
|
||||
unsigned int m_cornerRadius; // Corner chamfer distance / fillet radius
|
||||
|
|
Loading…
Reference in New Issue