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-2019 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 
31 #include "dielectric_material.h"
32 
33 
34 // A list of available substrate material
35 // These names are used in .gbrjob file, so they are not fully free.
36 // So do not change name with "used in .gbrjob file" comment.
37 // These names are in fact usual substrate names.
38 // However one can add and use other names for material name.
39 // DO NOT translate them, as they are proper noun
41 {
42  { NotSpecifiedPrm(), 0.0, 0.0 }, // Not specified, not in .gbrjob
43  { "FR4", 4.5, 0.02 }, // used in .gbrjob file
44  { "Polyimide", 1.0, 0.0 }, // 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  wxString txt;
73  txt.Printf( "%.1f", m_EpsilonR );
74  return txt;
75 }
76 
77 
79 {
80  // return a wxString to print/display Loss Tangent
81  wxString txt;
82  txt.Printf( "%g", 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;
136  {
137 
138  if( item.m_EpsilonR == aItem->m_EpsilonR &&
139  item.m_LossTangent == aItem->m_LossTangent &&
140  item.m_Name.CmpNoCase( aItem->m_Name ) == 0
141  )
142  return idx;
143 
144  ++idx;
145  }
146 
147  return -1;
148 }
149 
150 
151 int DIELECTRIC_SUBSTRATE_LIST::FindSubstrate( const wxString& aName, double aEpsilonR, double aLossTg )
152 {
153  // Find a item matching parameters
154  int idx = 0;
156  {
157 
158  if( item.m_EpsilonR == aEpsilonR &&
159  item.m_LossTangent == aLossTg &&
160  item.m_Name.CmpNoCase( aName ) == 0
161  )
162  return idx;
163 
164  ++idx;
165  }
166 
167  return -1;
168 }
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 contians at least predefined substrates
static DIELECTRIC_SUBSTRATE substrateMaterial[]
wxString NotSpecifiedPrm()
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:160
#define DEFAULT_EPSILON_R_SILKSCREEN
DIELECTRIC_SUBSTRATE_LIST(DL_MATERIAL_LIST_TYPE aListType)
Ctor.
int FindSubstrate(DIELECTRIC_SUBSTRATE *aItem)
Find a item in list similar to aItem.
static DIELECTRIC_SUBSTRATE silkscreenMaterial[]