KiCad PCB EDA Suite
board_stackup_reporter.h File Reference
#include <eda_units.h>

Go to the source code of this file.

Functions

wxString BuildStackupReport (BOARD_STACKUP &aStackup, EDA_UNITS aUnits)
 

Function Documentation

◆ BuildStackupReport()

wxString BuildStackupReport ( BOARD_STACKUP aStackup,
EDA_UNITS  aUnits 
)

Definition at line 40 of file board_stackup_reporter.cpp.

41 {
42  // Build a ascii representation of stackup and copy it in the clipboard
43  wxString report;
44 
45  wxString txt;
46  LOCALE_IO toggle; // toggles on the C locale to write floating values, then off.
47 
48  for( const BOARD_STACKUP_ITEM* item : aStackup.GetList() )
49  {
50  // Skip stackup items useless for the current board
51  if( !item->IsEnabled() )
52  continue;
53 
54  if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC )
55  {
56  wxString sublayer_text;
57 
58  if( item->GetSublayersCount() )
59  sublayer_text.Printf( "\n sublayer \"1/%d\"", item->GetSublayersCount() );
60 
61  txt.Printf( "layer \"%s\" type \"%s\"%s",
62  item->FormatDielectricLayerName(),
63  item->GetTypeName(), sublayer_text );
64  }
65  else
66  txt.Printf( "layer \"%s\" type \"%s\"", item->GetLayerName(),
67  item->GetTypeName() );
68 
69  report << txt;
70 
71  if( item->IsColorEditable() )
72  {
73  txt.Printf( " Color \"%s\"", item->GetColor() );
74  report << txt;
75  }
76 
77  for( int idx = 0; idx < item->GetSublayersCount(); idx++ )
78  {
79  if( idx ) // not printed for the main (first) layer.
80  {
81  txt.Printf( "\n sublayer \"%d/%d\"", idx+1, item->GetSublayersCount() );
82  report << txt;
83  }
84 
85  if( item->IsThicknessEditable() )
86  {
87  txt.Printf( " Thickness %s",
88  StringFromValue( aUnits, item->GetThickness( idx ), true ) );
89  report << txt;
90 
91  if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC && item->IsThicknessLocked( idx ) )
92  {
93  txt.Printf( " Locked" );
94  report << txt;
95  }
96  }
97 
98  if( item->IsMaterialEditable() )
99  {
100  txt.Printf( " Material \"%s\"", item->GetMaterial( idx ) );
101  report << txt;
102  }
103 
104  if( item->HasEpsilonRValue() )
105  {
106  txt.Printf( " EpsilonR %s", item->FormatEpsilonR( idx ) );
107  report << txt;
108  }
109 
110  if( item->HasLossTangentValue() )
111  {
112  txt.Printf( " LossTg %s", item->FormatLossTangent( idx ) );
113  report << txt;
114  }
115  }
116 
117  report << '\n';
118  }
119 
120  // Finish and other options:
121  txt.Printf( "Finish \"%s\"", aStackup.m_FinishType );
122  report << txt;
123 
124  if( aStackup.m_HasDielectricConstrains )
125  report << " Option \"Impedance Controlled\"";
126 
127  if( aStackup.m_EdgePlating )
128  report << " Option \"Plated edges\"";
129 
130  if( aStackup.m_CastellatedPads )
131  report << " Option \"Castellated Pads\"";
132 
134  {
135  wxString conn_txt = "yes";
136 
138  conn_txt << ",bevelled";
139 
140  txt.Printf( " EdgeConnector \"%s\"", conn_txt );
141  report << txt;
142  }
143 
144  report << '\n';
145 
146  return report;
147 
148 }
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
wxString m_FinishType
The name of external copper finish.
bool m_EdgePlating
True if the edge board is plated.
BS_EDGE_CONNECTOR_CONSTRAINTS m_EdgeConnectorConstraints
If the board has edge connector cards, some constrains can be specified in job file: BS_EDGE_CONNECTO...
bool m_CastellatedPads
True if castellated pads exist.
bool m_HasDielectricConstrains
True if some layers have impedance controlled tracks or have specific constrains for micro-wave appli...
Manage one layer needed to make a physical board.
Definition: board_stackup.h:89
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:204

References BS_EDGE_CONNECTOR_BEVELLED, BS_EDGE_CONNECTOR_NONE, BS_ITEM_TYPE_DIELECTRIC, BOARD_STACKUP::GetList(), BOARD_STACKUP::m_CastellatedPads, BOARD_STACKUP::m_EdgeConnectorConstraints, BOARD_STACKUP::m_EdgePlating, BOARD_STACKUP::m_FinishType, BOARD_STACKUP::m_HasDielectricConstrains, and StringFromValue().

Referenced by PANEL_SETUP_BOARD_STACKUP::onExportToClipboard().