KiCad PCB EDA Suite
dielectric_material.cpp
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) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2009-2021 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 
25 
27 #include "dielectric_material.h"
28 #include <core/arraydim.h>
29 #include <string_utils.h> // for Double2Str()
30 
31 
32 // A list of available substrate material
33 // These names are used in .gbrjob file, so they are not fully free.
34 // So do not change name with "used in .gbrjob file" comment.
35 // These names are in fact usual substrate names.
36 // However one can add and use other names for material name.
37 // DO NOT translate them, as they are proper noun
39 {
40  { NotSpecifiedPrm(), 0.0, 0.0 }, // Not specified, not in .gbrjob
41  { "FR4", 4.5, 0.02 }, // used in .gbrjob file
42  { "FR408-HR", 3.69, 0.0091 }, // used in .gbrjob file
43  { "Polyimide", 3.2, 0.004 }, // used in .gbrjob file
44  { "Kapton", 3.2, 0.004 }, // used in .gbrjob file
45  { "Polyolefin", 1.0, 0.0 }, // used in .gbrjob file
46  { "Al", 8.7, 0.001 }, // used in .gbrjob file
47  { "PTFE", 2.1, 0.0002 }, // used in .gbrjob file
48  { "Teflon", 2.1, 0.0002 }, // used in .gbrjob file
49  { "Ceramic", 1.0, 0.0 } // used in .gbrjob file
50  // Other names are free
51 };
52 
54 {
55  { NotSpecifiedPrm(), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Not specified, not in .gbrjob
56  { "Epoxy", DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Epoxy Liquid material (usual)
57  { "Liquid Ink", DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Liquid Ink Photoimageable
58  { "Dry Film", DEFAULT_EPSILON_R_SOLDERMASK, 0.0 } // Dry Film Photoimageable
59 };
60 
62 {
63  { NotSpecifiedPrm(), DEFAULT_EPSILON_R_SILKSCREEN, 0.0 }, // Not specified, not in .gbrjob
64  { "Liquid Photo", DEFAULT_EPSILON_R_SILKSCREEN, 0.0 }, // Liquid Ink Photoimageable
65  { "Direct Printing", DEFAULT_EPSILON_R_SILKSCREEN, 0.0 } // Direct Legend Printing
66 };
67 
68 
70 {
71  // return a wxString to print/display Epsilon R
72  // note: we do not want scientific notation
73  wxString txt = Double2Str( m_EpsilonR );
74  return txt;
75 }
76 
77 
79 {
80  // return a wxString to print/display Loss Tangent
81  // note: we do not want scientific notation
82  wxString txt = Double2Str( m_LossTangent );
83  return txt;
84 }
85 
86 
88 {
89  // Fills the m_substrateList with predefined params:
90  switch( aListType )
91  {
93  for( unsigned ii = 0; ii < arrayDim( substrateMaterial ); ++ii )
94  m_substrateList.push_back( substrateMaterial[ii] );
95  break;
96 
98  for( unsigned ii = 0; ii < arrayDim( solderMaskMaterial ); ++ii )
99  m_substrateList.push_back( solderMaskMaterial[ii] );
100  break;
101 
103  for( unsigned ii = 0; ii < arrayDim( silkscreenMaterial ); ++ii )
104  m_substrateList.push_back( silkscreenMaterial[ii] );
105  break;
106  }
107 }
108 
109 
111 {
112  if( aIdx >= 0 && aIdx < GetCount() )
113  return &m_substrateList[aIdx];
114 
115  return nullptr;
116 }
117 
118 
120 {
122  {
123  if( item.m_Name.CmpNoCase( aName ) == 0 )
124  return &item;
125  }
126 
127  return nullptr;
128 }
129 
130 
132 {
133  // Find a item matching aItem. The comparison is for the name case insensitive
134  int idx = 0;
135 
137  {
138 
139  if( item.m_EpsilonR == aItem->m_EpsilonR &&
140  item.m_LossTangent == aItem->m_LossTangent &&
141  item.m_Name.CmpNoCase( aItem->m_Name ) == 0 )
142  {
143  return idx;
144  }
145 
146  ++idx;
147  }
148 
149  return -1;
150 }
151 
152 
153 int DIELECTRIC_SUBSTRATE_LIST::FindSubstrate( const wxString& aName, double aEpsilonR, double aLossTg )
154 {
155  // Find a item matching parameters
156  int idx = 0;
157 
159  {
160 
161  if( item.m_EpsilonR == aEpsilonR &&
162  item.m_LossTangent == aLossTg &&
163  item.m_Name.CmpNoCase( aName ) == 0 )
164  {
165  return idx;
166  }
167 
168  ++idx;
169  }
170 
171  return -1;
172 }
DIELECTRIC_SUBSTRATE * GetSubstrate(int aIdx)
#define DEFAULT_EPSILON_R_SOLDERMASK
static DIELECTRIC_SUBSTRATE solderMaskMaterial[]
std::vector< DIELECTRIC_SUBSTRATE > m_substrateList
< The list of available substrates. It contains at least predefined substrates
static DIELECTRIC_SUBSTRATE substrateMaterial[]
wxString NotSpecifiedPrm()
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
#define DEFAULT_EPSILON_R_SILKSCREEN
DIELECTRIC_SUBSTRATE_LIST(DL_MATERIAL_LIST_TYPE aListType)
int FindSubstrate(DIELECTRIC_SUBSTRATE *aItem)
Find a item in list similar to aItem.
std::string Double2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 We want to avoid scientific ...
static DIELECTRIC_SUBSTRATE silkscreenMaterial[]