You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

799 lines
26 KiB

14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2009-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 1992-2023 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. #ifndef BOARD_DESIGN_SETTINGS_H_
  25. #define BOARD_DESIGN_SETTINGS_H_
  26. #include <memory>
  27. #include <netclass.h>
  28. #include <project/net_settings.h>
  29. #include <board_stackup_manager/board_stackup.h>
  30. #include <drc/drc_engine.h>
  31. #include <settings/nested_settings.h>
  32. #include <widgets/ui_common.h>
  33. #include <zone_settings.h>
  34. #include <teardrop/teardrop_parameters.h>
  35. #include <router/pns_meander.h>
  36. #define DEFAULT_SILK_LINE_WIDTH 0.1
  37. #define DEFAULT_COPPER_LINE_WIDTH 0.2
  38. #define DEFAULT_EDGE_WIDTH 0.05
  39. #define DEFAULT_COURTYARD_WIDTH 0.05
  40. #define DEFAULT_LINE_WIDTH 0.10
  41. #define DEFAULT_SILK_TEXT_SIZE 1.0
  42. #define DEFAULT_COPPER_TEXT_SIZE 1.5
  43. #define DEFAULT_TEXT_SIZE 1.0
  44. #define DEFAULT_SILK_TEXT_WIDTH 0.1
  45. #define DEFAULT_COPPER_TEXT_WIDTH 0.30
  46. #define DEFAULT_TEXT_WIDTH 0.15
  47. #define DEFAULT_DIMENSION_ARROW_LENGTH 50 // mils, for legacy purposes
  48. #define DEFAULT_DIMENSION_EXTENSION_OFFSET 0.5
  49. // Board thickness, mainly for 3D view:
  50. #define DEFAULT_BOARD_THICKNESS_MM 1.6
  51. #define DEFAULT_PCB_EDGE_THICKNESS 0.15
  52. // soldermask to pad clearance. The default is 0 because usually board houses
  53. // create a clearance depending on their fab process: mask material, color, price, etc.
  54. #define DEFAULT_SOLDERMASK_EXPANSION 0.0
  55. #define DEFAULT_SOLDERMASK_TO_COPPER_CLEARANCE 0.0
  56. #define DEFAULT_SOLDERMASK_MIN_WIDTH 0.0
  57. #define DEFAULT_SOLDERPASTE_CLEARANCE 0.0
  58. #define DEFAULT_SOLDERPASTE_RATIO 0.0
  59. #define DEFAULT_CUSTOMTRACKWIDTH 0.2
  60. #define DEFAULT_CUSTOMDPAIRWIDTH 0.125
  61. #define DEFAULT_CUSTOMDPAIRGAP 0.18
  62. #define DEFAULT_CUSTOMDPAIRVIAGAP 0.18
  63. #define DEFAULT_MEANDER_SPACING 0.6
  64. #define DEFAULT_DP_MEANDER_SPACING 1.0
  65. #define DEFAULT_MINCLEARANCE 0.0 // overall min clearance
  66. #define DEFAULT_MINCONNECTION 0.0 // overall min connection width
  67. #define DEFAULT_TRACKMINWIDTH 0.0 // track width min value
  68. #define DEFAULT_VIASMINSIZE 0.5 // vias (not micro vias) min diameter
  69. #define DEFAULT_MINTHROUGHDRILL 0.3 // through holes (not micro vias) min drill diameter
  70. #define DEFAULT_MICROVIASMINSIZE 0.2 // micro vias (not vias) min diameter
  71. #define DEFAULT_MICROVIASMINDRILL 0.1 // micro vias (not vias) min drill diameter
  72. #define DEFAULT_HOLETOHOLEMIN 0.25 // minimum web thickness between two drilled holes
  73. #define DEFAULT_HOLECLEARANCE 0.25 // copper-to-hole clearance (from IPC level A)
  74. #define DEFAULT_COPPEREDGECLEARANCE 0.5 // clearance between copper items and edge cuts
  75. #define LEGACY_COPPEREDGECLEARANCE -0.01 // A flag to indicate the legacy method (based
  76. // on edge cut line thicknesses) should be used.
  77. #define DEFAULT_SILKCLEARANCE 0.0
  78. #define DEFAULT_MINRESOLVEDSPOKES 2 // Fewer resolved spokes indicates a starved thermal
  79. #define MINIMUM_ERROR_SIZE_MM 0.001 // For arc approximation
  80. #define MAXIMUM_ERROR_SIZE_MM 0.1 // For arc approximation
  81. // Min/max values used in dialogs to validate settings
  82. #define MINIMUM_LINE_WIDTH_MM 0.005 // minimal line width entered in a dialog
  83. #define MAXIMUM_LINE_WIDTH_MM 100.0 // max line width entered in a dialog
  84. /**
  85. * Container to handle a stock of specific vias each with unique diameter and drill sizes
  86. * in the #BOARD class.
  87. */
  88. struct VIA_DIMENSION
  89. {
  90. int m_Diameter; // <= 0 means use Netclass via diameter
  91. int m_Drill; // <= 0 means use Netclass via drill
  92. VIA_DIMENSION()
  93. {
  94. m_Diameter = 0;
  95. m_Drill = 0;
  96. }
  97. VIA_DIMENSION( int aDiameter, int aDrill )
  98. {
  99. m_Diameter = aDiameter;
  100. m_Drill = aDrill;
  101. }
  102. bool operator==( const VIA_DIMENSION& aOther ) const
  103. {
  104. return ( m_Diameter == aOther.m_Diameter ) && ( m_Drill == aOther.m_Drill );
  105. }
  106. bool operator!=( const VIA_DIMENSION& aOther ) const { return !operator==( aOther ); }
  107. bool operator<( const VIA_DIMENSION& aOther ) const
  108. {
  109. if( m_Diameter != aOther.m_Diameter )
  110. return m_Diameter < aOther.m_Diameter;
  111. return m_Drill < aOther.m_Drill;
  112. }
  113. };
  114. /**
  115. * Container to handle a stock of specific differential pairs each with unique track width,
  116. * gap and via gap.
  117. */
  118. struct DIFF_PAIR_DIMENSION
  119. {
  120. int m_Width; // <= 0 means use Netclass differential pair width
  121. int m_Gap; // <= 0 means use Netclass differential pair gap
  122. int m_ViaGap; // <= 0 means use Netclass differential pair via gap
  123. DIFF_PAIR_DIMENSION()
  124. {
  125. m_Width = 0;
  126. m_Gap = 0;
  127. m_ViaGap = 0;
  128. }
  129. DIFF_PAIR_DIMENSION( int aWidth, int aGap, int aViaGap )
  130. {
  131. m_Width = aWidth;
  132. m_Gap = aGap;
  133. m_ViaGap = aViaGap;
  134. }
  135. bool operator==( const DIFF_PAIR_DIMENSION& aOther ) const
  136. {
  137. return ( m_Width == aOther.m_Width )
  138. && ( m_Gap == aOther.m_Gap )
  139. && ( m_ViaGap == aOther.m_ViaGap );
  140. }
  141. bool operator!=( const DIFF_PAIR_DIMENSION& aOther ) const { return !operator==( aOther ); }
  142. bool operator<( const DIFF_PAIR_DIMENSION& aOther ) const
  143. {
  144. if( m_Width != aOther.m_Width )
  145. return m_Width < aOther.m_Width;
  146. if( m_Gap != aOther.m_Gap )
  147. return m_Gap < aOther.m_Gap;
  148. return m_ViaGap < aOther.m_ViaGap;
  149. }
  150. };
  151. enum
  152. {
  153. LAYER_CLASS_SILK = 0,
  154. LAYER_CLASS_COPPER,
  155. LAYER_CLASS_EDGES,
  156. LAYER_CLASS_COURTYARD,
  157. LAYER_CLASS_FAB,
  158. LAYER_CLASS_OTHERS,
  159. LAYER_CLASS_COUNT
  160. };
  161. struct TEXT_ITEM_INFO
  162. {
  163. wxString m_Text;
  164. bool m_Visible;
  165. int m_Layer;
  166. TEXT_ITEM_INFO( const wxString& aText, bool aVisible, int aLayer )
  167. {
  168. m_Text = aText;
  169. m_Visible = aVisible;
  170. m_Layer = aLayer;
  171. }
  172. bool operator==( const TEXT_ITEM_INFO& aOther ) const
  173. {
  174. return m_Text.IsSameAs( aOther.m_Text )
  175. && ( m_Visible == aOther.m_Visible )
  176. && ( m_Layer == aOther.m_Layer );
  177. }
  178. };
  179. // forward declaration from class_track.h
  180. enum class VIATYPE : int;
  181. // forward declarations from dimension.h
  182. enum class DIM_UNITS_FORMAT : int;
  183. enum class DIM_TEXT_POSITION : int;
  184. enum class DIM_UNITS_MODE : int;
  185. enum class DIM_PRECISION : int;
  186. class PAD;
  187. /**
  188. * Container for design settings for a #BOARD object.
  189. */
  190. class BOARD_DESIGN_SETTINGS : public NESTED_SETTINGS
  191. {
  192. public:
  193. BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath );
  194. virtual ~BOARD_DESIGN_SETTINGS();
  195. bool operator==( const BOARD_DESIGN_SETTINGS& aOther ) const;
  196. bool operator!=( const BOARD_DESIGN_SETTINGS& aOther ) const
  197. {
  198. return !operator==( aOther );
  199. }
  200. BOARD_DESIGN_SETTINGS( const BOARD_DESIGN_SETTINGS& aOther);
  201. BOARD_DESIGN_SETTINGS& operator=( const BOARD_DESIGN_SETTINGS& aOther );
  202. bool LoadFromFile( const wxString& aDirectory = "" ) override;
  203. BOARD_STACKUP& GetStackupDescriptor() { return m_stackup; }
  204. const BOARD_STACKUP& GetStackupDescriptor() const { return m_stackup; }
  205. TEARDROP_PARAMETERS_LIST* GetTeadropParamsList()
  206. {
  207. return &m_TeardropParamsList;
  208. }
  209. SEVERITY GetSeverity( int aDRCErrorCode );
  210. /**
  211. * Return true if the DRC error code's severity is SEVERITY_IGNORE.
  212. */
  213. bool Ignore( int aDRCErrorCode );
  214. ZONE_SETTINGS& GetDefaultZoneSettings()
  215. {
  216. return m_defaultZoneSettings;
  217. }
  218. void SetDefaultZoneSettings( const ZONE_SETTINGS& aSettings )
  219. {
  220. m_defaultZoneSettings = aSettings;
  221. }
  222. /**
  223. * @return the current net class name.
  224. */
  225. inline const wxString& GetCurrentNetClassName() const
  226. {
  227. return m_currentNetClassName;
  228. }
  229. /**
  230. * Return true if netclass values should be used to obtain appropriate track width.
  231. */
  232. inline bool UseNetClassTrack() const
  233. {
  234. return ( m_trackWidthIndex == 0 && !m_useCustomTrackVia );
  235. }
  236. /**
  237. * Return true if netclass values should be used to obtain appropriate via size.
  238. */
  239. inline bool UseNetClassVia() const
  240. {
  241. return ( m_viaSizeIndex == 0 && !m_useCustomTrackVia );
  242. }
  243. /**
  244. * Return true if netclass values should be used to obtain appropriate diff pair dimensions.
  245. */
  246. inline bool UseNetClassDiffPair() const
  247. {
  248. return ( m_diffPairIndex == 0 && !m_useCustomDiffPair );
  249. }
  250. /**
  251. * @return the biggest clearance value found in NetClasses list.
  252. */
  253. int GetBiggestClearanceValue() const;
  254. /**
  255. * @return the smallest clearance value found in NetClasses list.
  256. */
  257. int GetSmallestClearanceValue() const;
  258. /**
  259. * @return the current track width list index.
  260. */
  261. inline unsigned GetTrackWidthIndex() const { return m_trackWidthIndex; }
  262. /**
  263. * Set the current track width list index to \a aIndex.
  264. *
  265. * @param aIndex is the track width list index.
  266. */
  267. void SetTrackWidthIndex( unsigned aIndex );
  268. /**
  269. * @return the current track width according to the selected options
  270. * ( using the default netclass value or a preset/custom value )
  271. * the default netclass is always in m_TrackWidthList[0]
  272. */
  273. int GetCurrentTrackWidth() const;
  274. /**
  275. * Sets custom width for track (i.e. not available in netclasses or preset list).
  276. *
  277. * To have it returned with GetCurrentTrackWidth() you need to enable custom track &
  278. * via sizes with #UseCustomTrackViaSize().
  279. *
  280. * @param aWidth is the new track width.
  281. */
  282. inline void SetCustomTrackWidth( int aWidth )
  283. {
  284. m_customTrackWidth = aWidth;
  285. }
  286. /**
  287. * @return Current custom width for a track.
  288. */
  289. inline int GetCustomTrackWidth() const
  290. {
  291. return m_customTrackWidth;
  292. }
  293. /**
  294. * @return the current via size list index.
  295. */
  296. inline unsigned GetViaSizeIndex() const
  297. {
  298. return m_viaSizeIndex;
  299. }
  300. /**
  301. * Set the current via size list index to \a aIndex.
  302. *
  303. * @param aIndex is the via size list index.
  304. */
  305. void SetViaSizeIndex( unsigned aIndex );
  306. /**
  307. * @return the current via size, according to the selected options
  308. * ( using the default netclass value or a preset/custom value )
  309. * the default netclass is always in m_TrackWidthList[0]
  310. */
  311. int GetCurrentViaSize() const;
  312. /**
  313. * Set custom size for via diameter (i.e. not available in netclasses or preset list).
  314. *
  315. * To have it returned with GetCurrentViaSize() you need to enable custom track & via sizes
  316. * with #UseCustomTrackViaSize().
  317. *
  318. * @param aSize is the new drill diameter.
  319. */
  320. inline void SetCustomViaSize( int aSize )
  321. {
  322. m_customViaSize.m_Diameter = aSize;
  323. }
  324. /**
  325. * @return Current custom size for the via diameter.
  326. */
  327. inline int GetCustomViaSize() const
  328. {
  329. return m_customViaSize.m_Diameter;
  330. }
  331. /**
  332. * @return the current via size, according to the selected options
  333. * ( using the default netclass value or a preset/custom value )
  334. * the default netclass is always in m_TrackWidthList[0].
  335. */
  336. int GetCurrentViaDrill() const;
  337. /**
  338. * Sets custom size for via drill (i.e. not available in netclasses or preset list).
  339. *
  340. * To have it returned with GetCurrentViaDrill() you need to enable custom track & via
  341. * sizes with #UseCustomTrackViaSize().
  342. *
  343. * @param aDrill is the new drill size.
  344. */
  345. inline void SetCustomViaDrill( int aDrill )
  346. {
  347. m_customViaSize.m_Drill = aDrill;
  348. }
  349. /**
  350. * @return Current custom size for the via drill.
  351. */
  352. inline int GetCustomViaDrill() const
  353. {
  354. return m_customViaSize.m_Drill;
  355. }
  356. /**
  357. * Enables/disables custom track/via size settings.
  358. *
  359. * If enabled, values set with #SetCustomTrackWidth(), #SetCustomViaSize(),
  360. * and #SetCustomViaDrill() are used for newly created tracks and vias.
  361. *
  362. * @param aEnabled decides if custom settings should be used for new tracks/vias.
  363. */
  364. inline void UseCustomTrackViaSize( bool aEnabled )
  365. {
  366. m_useCustomTrackVia = aEnabled;
  367. }
  368. /**
  369. * @return True if custom sizes of tracks & vias are enabled, false otherwise.
  370. */
  371. inline bool UseCustomTrackViaSize() const
  372. {
  373. return m_useCustomTrackVia;
  374. }
  375. /**
  376. * @return the current diff pair dimension list index.
  377. */
  378. inline unsigned GetDiffPairIndex() const { return m_diffPairIndex; }
  379. /**
  380. * @param aIndex is the diff pair dimensions list index to set.
  381. */
  382. void SetDiffPairIndex( unsigned aIndex );
  383. /**
  384. * Sets custom track width for differential pairs (i.e. not available in netclasses or
  385. * preset list).
  386. *
  387. * @param aDrill is the new track wdith.
  388. */
  389. inline void SetCustomDiffPairWidth( int aWidth )
  390. {
  391. m_customDiffPair.m_Width = aWidth;
  392. }
  393. /**
  394. * @return Current custom track width for differential pairs.
  395. */
  396. inline int GetCustomDiffPairWidth()
  397. {
  398. return m_customDiffPair.m_Width;
  399. }
  400. /**
  401. * Sets custom gap for differential pairs (i.e. not available in netclasses or preset
  402. * list).
  403. * @param aGap is the new gap.
  404. */
  405. inline void SetCustomDiffPairGap( int aGap )
  406. {
  407. m_customDiffPair.m_Gap = aGap;
  408. }
  409. /**
  410. * Function GetCustomDiffPairGap
  411. * @return Current custom gap width for differential pairs.
  412. */
  413. inline int GetCustomDiffPairGap()
  414. {
  415. return m_customDiffPair.m_Gap;
  416. }
  417. /**
  418. * Sets custom via gap for differential pairs (i.e. not available in netclasses or
  419. * preset list).
  420. *
  421. * @param aGap is the new gap. Specify 0 to use the DiffPairGap for vias as well.
  422. */
  423. inline void SetCustomDiffPairViaGap( int aGap )
  424. {
  425. m_customDiffPair.m_ViaGap = aGap;
  426. }
  427. /**
  428. * @return Current custom via gap width for differential pairs.
  429. */
  430. inline int GetCustomDiffPairViaGap()
  431. {
  432. return m_customDiffPair.m_ViaGap > 0 ? m_customDiffPair.m_ViaGap : m_customDiffPair.m_Gap;
  433. }
  434. /**
  435. * Enables/disables custom differential pair dimensions.
  436. *
  437. * @param aEnabled decides if custom settings should be used for new differential pairs.
  438. */
  439. inline void UseCustomDiffPairDimensions( bool aEnabled )
  440. {
  441. m_useCustomDiffPair = aEnabled;
  442. }
  443. /**
  444. * @return True if custom sizes of diff pairs are enabled, false otherwise.
  445. */
  446. inline bool UseCustomDiffPairDimensions() const
  447. {
  448. return m_useCustomDiffPair;
  449. }
  450. /**
  451. * @return the current diff pair track width, according to the selected options
  452. * ( using the default netclass value or a preset/custom value )
  453. */
  454. int GetCurrentDiffPairWidth() const;
  455. /**
  456. * @return the current diff pair gap, according to the selected options
  457. * ( using the default netclass value or a preset/custom value )
  458. */
  459. int GetCurrentDiffPairGap() const;
  460. /**
  461. * @return the current diff pair via gap, according to the selected options
  462. * ( using the default netclass value or a preset/custom value )
  463. * the default netclass is always in m_DiffPairDimensionsList[0].
  464. */
  465. int GetCurrentDiffPairViaGap() const;
  466. /**
  467. * Return a bit-mask of all the layers that are enabled.
  468. *
  469. * @return the enabled layers in bit-mapped form.
  470. */
  471. inline LSET GetEnabledLayers() const
  472. {
  473. return m_enabledLayers;
  474. }
  475. /**
  476. * Change the bit-mask of enabled layers to \a aMask.
  477. *
  478. * @param aMask = The new bit-mask of enabled layers.
  479. */
  480. void SetEnabledLayers( LSET aMask );
  481. /**
  482. * Test whether a given layer \a aLayerId is enabled.
  483. *
  484. * @param aLayerId The layer to be tested.
  485. * @return true if the layer is enabled.
  486. */
  487. inline bool IsLayerEnabled( PCB_LAYER_ID aLayerId ) const
  488. {
  489. if( aLayerId >= 0 && aLayerId < PCB_LAYER_ID_COUNT )
  490. return m_enabledLayers[aLayerId];
  491. return false;
  492. }
  493. /**
  494. * @return the number of enabled copper layers.
  495. */
  496. inline int GetCopperLayerCount() const
  497. {
  498. return m_copperLayerCount;
  499. }
  500. /**
  501. * Set the copper layer count to \a aNewLayerCount.
  502. *
  503. * @param aNewLayerCount The new number of enabled copper layers.
  504. */
  505. void SetCopperLayerCount( int aNewLayerCount );
  506. /**
  507. * The full thickness of the board including copper and masks.
  508. * @return
  509. */
  510. inline int GetBoardThickness() const { return m_boardThickness; }
  511. inline void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
  512. /*
  513. * Return an epsilon which accounts for rounding errors, etc.
  514. *
  515. * While currently an advanced cfg, going through this API allows us to easily change
  516. * it to board-specific if so desired.
  517. */
  518. int GetDRCEpsilon() const;
  519. /**
  520. * Pad & via drills are finish size.
  521. *
  522. * Adding the hole plating thickness gives you the actual hole size.
  523. */
  524. int GetHolePlatingThickness() const;
  525. /**
  526. * Return the default graphic segment thickness from the layer class for the given layer.
  527. */
  528. int GetLineThickness( PCB_LAYER_ID aLayer ) const;
  529. /**
  530. * Return the default text size from the layer class for the given layer.
  531. */
  532. VECTOR2I GetTextSize( PCB_LAYER_ID aLayer ) const;
  533. /**
  534. * Return the default text thickness from the layer class for the given layer.
  535. */
  536. int GetTextThickness( PCB_LAYER_ID aLayer ) const;
  537. bool GetTextItalic( PCB_LAYER_ID aLayer ) const;
  538. bool GetTextUpright( PCB_LAYER_ID aLayer ) const;
  539. int GetLayerClass( PCB_LAYER_ID aLayer ) const;
  540. void SetAuxOrigin( const VECTOR2I& aOrigin ) { m_auxOrigin = aOrigin; }
  541. const VECTOR2I& GetAuxOrigin() { return m_auxOrigin; }
  542. void SetGridOrigin( const VECTOR2I& aOrigin ) { m_gridOrigin = aOrigin; }
  543. const VECTOR2I& GetGridOrigin() { return m_gridOrigin; }
  544. private:
  545. void initFromOther( const BOARD_DESIGN_SETTINGS& aOther );
  546. bool migrateSchema0to1();
  547. public:
  548. // Note: the first value in each dimensions list is the current netclass value
  549. std::vector<int> m_TrackWidthList;
  550. std::vector<VIA_DIMENSION> m_ViasDimensionsList;
  551. std::vector<DIFF_PAIR_DIMENSION> m_DiffPairDimensionsList;
  552. /** The parameters of teardrops for the different teardrop targets (via/pad, track end)
  553. * 3 set of parameters always exist: for round shapes, for rect shapes, for track ends
  554. */
  555. TEARDROP_PARAMETERS_LIST m_TeardropParamsList;
  556. PNS::MEANDER_SETTINGS m_SingleTrackMeanderSettings;
  557. PNS::MEANDER_SETTINGS m_DiffPairMeanderSettings;
  558. PNS::MEANDER_SETTINGS m_SkewMeanderSettings;
  559. VIATYPE m_CurrentViaType; ///< (VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
  560. bool m_UseConnectedTrackWidth; // use width of existing track when creating a new,
  561. // connected track
  562. bool m_TempOverrideTrackWidth; // use selected track width temporarily even when
  563. // using connected track width
  564. int m_MinClearance; // overall min clearance
  565. int m_MinConn; // overall min connection width
  566. int m_TrackMinWidth; // overall min track width
  567. int m_ViasMinAnnularWidth; // overall minimum width of the via copper ring
  568. int m_ViasMinSize; // overall vias (not micro vias) min diameter
  569. int m_MinThroughDrill; // through hole (not micro vias) min drill diameter
  570. int m_MicroViasMinSize; // micro vias min diameter
  571. int m_MicroViasMinDrill; // micro vias min drill diameter
  572. int m_CopperEdgeClearance;
  573. int m_HoleClearance; // Hole to copper clearance
  574. int m_HoleToHoleMin; // Min width of web between two drilled holes
  575. int m_SilkClearance; // Min dist between two silk items
  576. int m_MinResolvedSpokes; // Min spoke count to not be a starved thermal
  577. int m_MinSilkTextHeight; // Min text height for silkscreen layers
  578. int m_MinSilkTextThickness; // Min text thickness for silkscreen layers
  579. std::shared_ptr<DRC_ENGINE> m_DRCEngine;
  580. std::map<int, SEVERITY> m_DRCSeverities; // Map from DRCErrorCode to SEVERITY
  581. std::set<wxString> m_DrcExclusions;
  582. // When smoothing the zone's outline there's the question of external fillets (that is, those
  583. // applied to concave corners). While it seems safer to never have copper extend outside the
  584. // zone outline, 5.1.x and prior did indeed fill them so we leave the mode available.
  585. bool m_ZoneKeepExternalFillets;
  586. // Maximum error allowed when approximating circles and arcs to segments
  587. int m_MaxError;
  588. // Global mask margins:
  589. int m_SolderMaskExpansion; // Solder mask inflation around the pad or via
  590. int m_SolderMaskMinWidth; // Solder mask min width (2 areas closer than this
  591. // width are merged)
  592. int m_SolderMaskToCopperClearance; // Min distance allowed from copper to a mask
  593. // aperture of another net
  594. int m_SolderPasteMargin; // Solder paste margin absolute value
  595. double m_SolderPasteMarginRatio; // Solder mask margin ratio value of pad size
  596. // The final margin is the sum of these 2 values
  597. bool m_AllowSoldermaskBridgesInFPs;
  598. std::shared_ptr<NET_SETTINGS> m_NetSettings;
  599. // Variables used in footprint editing (default value in item/footprint creation)
  600. std::vector<TEXT_ITEM_INFO> m_DefaultFPTextItems;
  601. // Arrays of default values for the various layer classes.
  602. int m_LineThickness[ LAYER_CLASS_COUNT ];
  603. VECTOR2I m_TextSize[LAYER_CLASS_COUNT];
  604. int m_TextThickness[ LAYER_CLASS_COUNT ];
  605. bool m_TextItalic[ LAYER_CLASS_COUNT ];
  606. bool m_TextUpright[ LAYER_CLASS_COUNT ];
  607. // Default values for dimension objects
  608. DIM_UNITS_MODE m_DimensionUnitsMode;
  609. DIM_PRECISION m_DimensionPrecision; ///< Number of digits after the decimal
  610. DIM_UNITS_FORMAT m_DimensionUnitsFormat;
  611. bool m_DimensionSuppressZeroes;
  612. DIM_TEXT_POSITION m_DimensionTextPosition;
  613. bool m_DimensionKeepTextAligned;
  614. int m_DimensionArrowLength;
  615. int m_DimensionExtensionOffset;
  616. bool m_StyleFPFields;
  617. bool m_StyleFPText;
  618. bool m_StyleFPShapes;
  619. // Miscellaneous
  620. std::unique_ptr<PAD> m_Pad_Master; // A dummy pad to store all default parameters
  621. // when importing values or creating a new pad
  622. // Set to true if the board has a stackup management.
  623. // If not set a default basic stackup will be used to generate the gbrjob file.
  624. // Could be removed later, or at least always set to true
  625. bool m_HasStackup;
  626. /// Enable inclusion of stackup height in track length measurements and length tuning
  627. bool m_UseHeightForLengthCalcs;
  628. private:
  629. VECTOR2I m_auxOrigin; ///< origin for plot exports
  630. VECTOR2I m_gridOrigin; ///< origin for grid offsets
  631. // Indices into the trackWidth, viaSizes and diffPairDimensions lists.
  632. // The 0 index is always the current netclass value(s)
  633. unsigned m_trackWidthIndex;
  634. unsigned m_viaSizeIndex;
  635. unsigned m_diffPairIndex;
  636. // Custom values for track/via sizes (specified via dialog instead of netclass or lists)
  637. bool m_useCustomTrackVia;
  638. int m_customTrackWidth;
  639. VIA_DIMENSION m_customViaSize;
  640. // Custom values for differential pairs (specified via dialog instead of netclass/lists)
  641. bool m_useCustomDiffPair;
  642. DIFF_PAIR_DIMENSION m_customDiffPair;
  643. int m_copperLayerCount; ///< Number of copper layers for this design
  644. LSET m_enabledLayers; ///< Bit-mask for layer enabling
  645. int m_boardThickness; ///< Board thickness for 3D viewer
  646. /// Current net class name used to display netclass info.
  647. /// This is also the last used netclass after starting a track.
  648. wxString m_currentNetClassName;
  649. /** the description of layers stackup, for board fabrication
  650. * only physical layers are in layers stackup.
  651. * It includes not only layers enabled for the board edition, but also dielectric layers
  652. */
  653. BOARD_STACKUP m_stackup;
  654. /// The default settings that will be used for new zones
  655. ZONE_SETTINGS m_defaultZoneSettings;
  656. };
  657. #endif // BOARD_DESIGN_SETTINGS_H_