KiCad PCB EDA Suite
board_stackup_reporter.cpp File Reference
#include "wx/string.h"
#include <base_units.h>
#include "class_board_stackup.h"
#include "stackup_predefined_prms.h"
#include "board_stackup_reporter.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 39 of file board_stackup_reporter.cpp.

40 {
41  // Build a ascii representation of stackup and copy it in the clipboard
42  wxString report;
43 
44  wxString txt;
45  LOCALE_IO toggle; // toggles on the C locale to write floating values, then off.
46 
47  for( const BOARD_STACKUP_ITEM* item : aStackup.GetList() )
48  {
49  // Skip stackup items useless for the current board
50  if( !item->IsEnabled() )
51  continue;
52 
53  if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC )
54  {
55  wxString sublayer_text;
56 
57  if( item->GetSublayersCount() )
58  sublayer_text.Printf( "\n sublayer \"1/%d\"", item->GetSublayersCount() );
59 
60  txt.Printf( "layer \"%s\" type \"%s\"%s",
61  item->FormatDielectricLayerName(),
62  item->GetTypeName(), sublayer_text );
63  }
64  else
65  txt.Printf( "layer \"%s\" type \"%s\"", item->GetLayerName(),
66  item->GetTypeName() );
67 
68  report << txt;
69 
70  if( item->IsColorEditable() )
71  {
72  txt.Printf( " Color \"%s\"", item->GetColor() );
73  report << txt;
74  }
75 
76  for( int idx = 0; idx < item->GetSublayersCount(); idx++ )
77  {
78  if( idx ) // not printed for the main (first) layer.
79  {
80  txt.Printf( "\n sublayer \"%d/%d\"", idx+1, item->GetSublayersCount() );
81  report << txt;
82  }
83 
84  if( item->IsThicknessEditable() )
85  {
86  txt.Printf( " Thickness %s",
87  StringFromValue( aUnits, item->GetThickness( idx ), true, true ) );
88  report << txt;
89 
90  if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC && item->IsThicknessLocked( idx ) )
91  {
92  txt.Printf( " Locked" );
93  report << txt;
94  }
95  }
96 
97  if( item->IsMaterialEditable() )
98  {
99  txt.Printf( " Material \"%s\"", item->GetMaterial( idx ) );
100  report << txt;
101  }
102 
103  if( item->HasEpsilonRValue() )
104  {
105  txt.Printf( " EpsilonR %s", item->FormatEpsilonR( idx ) );
106  report << txt;
107  }
108 
109  if( item->HasLossTangentValue() )
110  {
111  txt.Printf( " LossTg %s", item->FormatLossTangent( idx ) );
112  report << txt;
113  }
114  }
115 
116  report << '\n';
117  }
118 
119  // Finish and other options:
120  txt.Printf( "Finish \"%s\"", aStackup.m_FinishType );
121  report << txt;
122 
123  if( aStackup.m_HasDielectricConstrains )
124  report << " Option \"Impedance Controlled\"";
125 
126  if( aStackup.m_EdgePlating )
127  report << " Option \"Plated edges\"";
128 
129  if( aStackup.m_CastellatedPads )
130  report << " Option \"Castellated Pads\"";
131 
133  {
134  wxString conn_txt = "yes";
135 
137  conn_txt << ",bevelled";
138 
139  txt.Printf( " EdgeConnector \"%s\"", conn_txt );
140  report << txt;
141  }
142 
143  report << '\n';
144 
145  return report;
146 
147 }
std::vector< BOARD_STACKUP_ITEM * > & GetList()
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:216
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 specifed in job file: BS_EDGE_CONNECTOR...
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...
this class manage one layer needed to make a physical board it can be a solder mask,...
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils, EDA_DATA_TYPE aType)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:233

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().