KiCad PCB EDA Suite
Loading...
Searching...
No Matches
zone_settings.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2008-2018 Jean-Pierre Charras, [email protected]
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
29
30#pragma once
31
32#include <optional>
33#include <map>
34#include <layer_ids.h>
35#include <lset.h>
36#include <zones.h>
37#include <geometry/eda_angle.h>
39
40class PCB_BASE_FRAME;
41class wxDataViewListCtrl;
42
43
45{
46 POLYGONS = 0, // fill zone with polygons
47 HATCH_PATTERN = 1, // fill zone using a grid pattern
48 COPPER_THIEVING = 2 // fill zone with non-functional copper stamps for plating uniformity
49};
50
53{
54 DOTS = 0,
57};
58
60{
61 std::optional<VECTOR2I> hatching_offset;
62
63 bool operator==( const ZONE_LAYER_PROPERTIES& aOther ) const;
64};
65
66
75{
77 int element_size = 0; // diameter (dots) or side length (squares)
78 int gap = 0; // edge-to-edge spacing between adjacent stamps
79 // (or between crosshatch lines)
80 int line_width = 0; // line width for crosshatch only
81 bool stagger = false; // offset alternating rows by half the stride
83
84 bool operator==( const THIEVING_SETTINGS& aOther ) const
85 {
86 return pattern == aOther.pattern
87 && element_size == aOther.element_size
88 && gap == aOther.gap
89 && line_width == aOther.line_width
90 && stagger == aOther.stagger
91 && orientation == aOther.orientation;
92 }
93};
94
95
98{
102 INVISIBLE_BORDER // Disable outline drawing for very special cases
103};
104
112
120
128{
129public:
130 // the actual zone outline shape can be slightly modified (smoothed):
131 enum {
133 SMOOTHING_NONE = 0, // Zone outline is used without change
134 SMOOTHING_CHAMFER, // Zone outline is used after chamfering corners
135 SMOOTHING_FILLET, // Zone outline is used after rounding corners
136 SMOOTHING_LAST // sentinel
137 };
138
139 unsigned m_ZonePriority; // Priority (0 ... N) of the zone
140
142 int m_ZoneClearance; // Minimal clearance value
143 int m_ZoneMinThickness; // Min thickness value in filled areas
144 int m_HatchThickness; // HatchBorder thickness of lines (if 0 -> solid shape)
145 int m_HatchGap; // HatchBorder clearance between lines (0 -> solid shape)
146 EDA_ANGLE m_HatchOrientation; // HatchBorder orientation of grid lines
147 int m_HatchSmoothingLevel; // HatchBorder smoothing type, similar to corner smoothing type
148 // 0 = no smoothing, 1 = fillet, >= 2 = arc
149 double m_HatchSmoothingValue; // HatchBorder chamfer/fillet size as a ratio of hole size
150 double m_HatchHoleMinArea; // min size before holes are dropped (ratio)
151 int m_HatchBorderAlgorithm; // 0 = use min zone thickness
152
153 THIEVING_SETTINGS m_ThievingSettings; // valid when m_FillMode == COPPER_THIEVING
154
155 int m_Netcode; // Net code selection for the current zone
156
157 wxString m_Name; // Unique name for the current zone (can be blank)
158
159 LSET m_Layers; // Layers that this zone exists on
160
163 int m_BorderHatchPitch; // for hatched outlines: dist between 2 hatches
164
165 long m_ThermalReliefGap; // thickness of the gap in thermal reliefs
166 long m_ThermalReliefSpokeWidth; // thickness of the copper bridge in thermal reliefs
167
169
170 /* A zone outline can be a teardrop zone with different rules
171 * priority, smoothed corners, thermal relief...
172 */
174
175 std::map<PCB_LAYER_ID, ZONE_LAYER_PROPERTIES> m_LayerProperties;
176
177private:
178 int m_cornerSmoothingType; // Corner smoothing type
179 unsigned int m_cornerRadius; // Corner chamfer distance / fillet radius
181
182 /*
183 * Keepout zones and keepout flags.
184 * Note that DRC rules can set keepouts on zones whether they're a keepout or not.
185 */
187
194
200
202 long long int m_minIslandArea;
203
204public:
206
207 bool operator==( const ZONE_SETTINGS& aOther ) const;
208
209 bool operator!=( const ZONE_SETTINGS& aOther ) const { return !operator==( aOther ); }
210
217 ZONE_SETTINGS& operator << ( const ZONE& aSource );
218
222 static const ZONE_SETTINGS& GetDefaultSettings();
223
229 void SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aFrame, LSET aLayers );
230
239 void ExportSetting( ZONE& aTarget, bool aFullExport = true ) const;
240
252 void CopyFrom( const ZONE_SETTINGS& aOther, bool aCopyFull = true );
253
254 void SetCornerSmoothingType( int aType) { m_cornerSmoothingType = aType; }
256
257 void SetCornerRadius( int aRadius );
258 unsigned int GetCornerRadius() const { return m_cornerRadius; }
259
261 void SetPadConnection( ZONE_CONNECTION aPadConnection ) { m_padConnection = aPadConnection; }
262
271
278 bool GetIsRuleArea() const { return m_isRuleArea; }
284
285 void SetPlacementAreaEnabled( bool aEnabled ) { m_placementAreaEnabled = aEnabled; }
287 void SetPlacementAreaSource( const wxString& aSource ) { m_placementAreaSource = aSource; }
288 void SetIsRuleArea( bool aEnable ) { m_isRuleArea = aEnable; }
289 void SetDoNotAllowZoneFills( bool aEnable ) { m_keepoutDoNotAllowZoneFills = aEnable; }
290 void SetDoNotAllowVias( bool aEnable ) { m_keepoutDoNotAllowVias = aEnable; }
291 void SetDoNotAllowTracks( bool aEnable ) { m_keepoutDoNotAllowTracks = aEnable; }
292 void SetDoNotAllowPads( bool aEnable ) { m_keepoutDoNotAllowPads = aEnable; }
293 void SetDoNotAllowFootprints( bool aEnable ) { m_keepoutDoNotAllowFootprints = aEnable; }
294
297
298 long long int GetMinIslandArea() const { return m_minIslandArea; }
299 void SetMinIslandArea( long long int aArea ) { m_minIslandArea = aArea; }
300};
301
A lightweight representation of a component class.
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
ZONE_SETTINGS handles zones parameters.
bool m_keepoutDoNotAllowPads
void SetIsRuleArea(bool aEnable)
bool operator==(const ZONE_SETTINGS &aOther) const
bool operator!=(const ZONE_SETTINGS &aOther) const
unsigned int m_cornerRadius
bool GetDoNotAllowTracks() const
wxString GetPlacementAreaSource() const
EDA_ANGLE m_HatchOrientation
void SetDoNotAllowVias(bool aEnable)
bool GetDoNotAllowFootprints() const
long long int m_minIslandArea
void SetIslandRemovalMode(ISLAND_REMOVAL_MODE aRemove)
bool m_keepoutDoNotAllowTracks
bool GetDoNotAllowPads() const
double m_HatchSmoothingValue
PLACEMENT_SOURCE_T GetPlacementAreaSourceType() const
PLACEMENT_SOURCE_T m_placementAreaSourceType
void SetMinIslandArea(long long int aArea)
void ExportSetting(ZONE &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
bool GetIsRuleArea() const
bool GetDoNotAllowZoneFills() const
void SetDoNotAllowTracks(bool aEnable)
THIEVING_SETTINGS m_ThievingSettings
bool m_keepoutDoNotAllowZoneFills
bool GetDoNotAllowVias() const
wxString m_placementAreaSource
ISLAND_REMOVAL_MODE m_removeIslands
void SetPlacementAreaSource(const wxString &aSource)
double m_HatchHoleMinArea
void SetPadConnection(ZONE_CONNECTION aPadConnection)
long long int GetMinIslandArea() const
long m_ThermalReliefSpokeWidth
void SetPlacementAreaEnabled(bool aEnabled)
ZONE_CONNECTION GetPadConnection() const
TEARDROP_TYPE m_TeardropType
bool m_placementAreaEnabled
Placement rule area data.
static const ZONE_SETTINGS & GetDefaultSettings()
unsigned m_ZonePriority
void SetCornerRadius(int aRadius)
bool GetPlacementAreaEnabled() const
Accessors to parameters used in Rule Area zones:
std::map< PCB_LAYER_ID, ZONE_LAYER_PROPERTIES > m_LayerProperties
bool HasKeepoutParametersSet() const
Accessor to determine if any keepout parameters are set.
int GetCornerSmoothingType() const
ZONE_FILL_MODE m_FillMode
ZONE_CONNECTION m_padConnection
void SetDoNotAllowFootprints(bool aEnable)
void SetDoNotAllowPads(bool aEnable)
void SetCornerSmoothingType(int aType)
ZONE_SETTINGS & operator<<(const ZONE &aSource)
operator << ( const ZONE& ) was Function ImportSetting copies settings from a given zone into this ob...
void CopyFrom(const ZONE_SETTINGS &aOther, bool aCopyFull=true)
Function CopyFrom copy settings from a different ZONE_SETTINGS object.
void SetDoNotAllowZoneFills(bool aEnable)
void SetupLayersList(wxDataViewListCtrl *aList, PCB_BASE_FRAME *aFrame, LSET aLayers)
A helper routine for the various zone dialogs (copper, non-copper, keepout).
unsigned int GetCornerRadius() const
ISLAND_REMOVAL_MODE GetIslandRemovalMode() const
ZONE_BORDER_DISPLAY_STYLE m_ZoneBorderDisplayStyle
Option to show the zone area (outlines only, short hatches or full hatches.
bool m_keepoutDoNotAllowFootprints
bool m_keepoutDoNotAllowVias
void SetPlacementAreaSourceType(PLACEMENT_SOURCE_T aType)
Handle a list of polygons defining a copper zone.
Definition zone.h:74
static constexpr EDA_ANGLE ANGLE_0
Definition eda_angle.h:411
@ HATCH
Definition eda_shape.h:78
Parameters that drive copper-thieving fill generation.
EDA_ANGLE orientation
THIEVING_PATTERN pattern
bool operator==(const THIEVING_SETTINGS &aOther) const
std::optional< VECTOR2I > hatching_offset
bool operator==(const ZONE_LAYER_PROPERTIES &aOther) const
TEARDROP_TYPE
define the type of a teardrop: on a via or pad, or a track end
THIEVING_PATTERN
Shape stamped onto the grid for a copper-thieving fill.
ISLAND_REMOVAL_MODE
Whether or not to remove isolated islands from a zone.
ZONE_FILL_MODE
ZONE_BORDER_DISPLAY_STYLE
Zone border styles.
PLACEMENT_SOURCE_T
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition zones.h:47