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 #include <core/arraydim.h>
33 
34 
35 // A list of available substrate material
36 // These names are used in .gbrjob file, so they are not fully free.
37 // So do not change name with "used in .gbrjob file" comment.
38 // These names are in fact usual substrate names.
39 // However one can add and use other names for material name.
40 // DO NOT translate them, as they are proper noun
42 {
43  { NotSpecifiedPrm(), 0.0, 0.0 }, // Not specified, not in .gbrjob
44  { "FR4", 4.5, 0.02 }, // used in .gbrjob file
45  { "FR408-HR", 3.69, 0.0091 }, // used in .gbrjob file
46  { "Polyimide", 1.0, 0.0 }, // used in .gbrjob file
47  { "Polyolefin", 1.0, 0.0 }, // used in .gbrjob file
48  { "Al", 8.7, 0.001 }, // used in .gbrjob file
49  { "PTFE", 2.1, 0.0002 }, // used in .gbrjob file
50  { "Teflon", 2.1, 0.0002 }, // used in .gbrjob file
51  { "Ceramic", 1.0, 0.0 } // used in .gbrjob file
52  // Other names are free
53 };
54 
56 {
57  { NotSpecifiedPrm(), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Not specified, not in .gbrjob
58  { "Epoxy", DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Epoxy Liquid material (usual)
59  { "Liquid Ink", DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Liquid Ink Photoimageable
60  { "Dry Film", DEFAULT_EPSILON_R_SOLDERMASK, 0.0 } // Dry Film Photoimageable
61 };
62 
64 {
65  { NotSpecifiedPrm(), DEFAULT_EPSILON_R_SILKSCREEN, 0.0 }, // Not specified, not in .gbrjob
66  { "Liquid Photo", DEFAULT_EPSILON_R_SILKSCREEN, 0.0 }, // Liquid Ink Photoimageable
67  { "Direct Printing", DEFAULT_EPSILON_R_SILKSCREEN, 0.0 } // Direct Legend Printing
68 };
69 
70 
72 {
73  // return a wxString to print/display Epsilon R
74  wxString txt;
75  txt.Printf( "%.1f", m_EpsilonR );
76  return txt;
77 }
78 
79 
81 {
82  // return a wxString to print/display Loss Tangent
83  wxString txt;
84  txt.Printf( "%g", m_LossTangent );
85  return txt;
86 }
87 
88 
90 {
91  // Fills the m_substrateList with predefined params:
92  switch( aListType )
93  {
95  for( unsigned ii = 0; ii < arrayDim( substrateMaterial ); ++ii )
96  m_substrateList.push_back( substrateMaterial[ii] );
97  break;
98 
100  for( unsigned ii = 0; ii < arrayDim( solderMaskMaterial ); ++ii )
101  m_substrateList.push_back( solderMaskMaterial[ii] );
102  break;
103 
105  for( unsigned ii = 0; ii < arrayDim( silkscreenMaterial ); ++ii )
106  m_substrateList.push_back( silkscreenMaterial[ii] );
107  break;
108  }
109 }
110 
111 
113 {
114  if( aIdx >= 0 && aIdx < GetCount() )
115  return &m_substrateList[aIdx];
116 
117  return nullptr;
118 }
119 
120 
122 {
124  {
125  if( item.m_Name.CmpNoCase( aName ) == 0 )
126  return &item;
127  }
128 
129  return nullptr;
130 }
131 
132 
134 {
135  // Find a item matching aItem. The comparison is for the name case insensitive
136  int idx = 0;
138  {
139 
140  if( item.m_EpsilonR == aItem->m_EpsilonR &&
141  item.m_LossTangent == aItem->m_LossTangent &&
142  item.m_Name.CmpNoCase( aItem->m_Name ) == 0
143  )
144  return idx;
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;
158  {
159 
160  if( item.m_EpsilonR == aEpsilonR &&
161  item.m_LossTangent == aLossTg &&
162  item.m_Name.CmpNoCase( aName ) == 0
163  )
164  return idx;
165 
166  ++idx;
167  }
168 
169  return -1;
170 }
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.
static DIELECTRIC_SUBSTRATE silkscreenMaterial[]