27#include "wx/sstream.h"
50 auto appendProperty = [&](
const wxString& aName,
const wxString& aValue )
52 aRows.push_back( { aName, aValue } );
56 appendProperty( wxT(
"Finish" ), aStackup.
m_FinishType );
61 appendProperty( wxT(
"Impedance Controlled" ), wxT(
"yes" ) );
64 appendProperty( wxT(
"Plated edges" ), wxT(
"yes" ) );
68 wxString conn = wxT(
"yes" );
71 conn << wxT(
",bevelled" );
73 appendProperty( wxT(
"EdgeConnector" ), conn );
90 if( !item->IsEnabled() )
95 wxString sublayer_text;
97 if( item->GetSublayersCount() )
99 sublayer_text.Printf( wxT(
"\n sublayer \"1/%d\"" ),
100 item->GetSublayersCount() );
103 txt.Printf( wxT(
"layer \"%s\" type \"%s\"%s" ),
104 item->FormatDielectricLayerName(),
105 item->GetTypeName(), sublayer_text );
109 txt.Printf( wxT(
"layer \"%s\" type \"%s\"" ),
110 item->GetLayerName(),
111 item->GetTypeName() );
116 if( item->IsColorEditable() )
118 txt.Printf( wxT(
" Color \"%s\"" ), item->GetColor() );
122 for(
int idx = 0; idx < item->GetSublayersCount(); idx++ )
126 txt.Printf( wxT(
"\n sublayer \"%d/%d\"" ), idx+1, item->GetSublayersCount() );
130 if( item->IsThicknessEditable() )
132 txt.Printf( wxT(
" Thickness %s" ),
138 txt.Printf( wxT(
" Locked" ) );
143 if( item->IsMaterialEditable() )
145 txt.Printf( wxT(
" Material \"%s\"" ), item->GetMaterial( idx ) );
149 if( item->HasEpsilonRValue() )
151 txt.Printf( wxT(
" EpsilonR %s" ), item->FormatEpsilonR( idx ) );
155 if( item->HasLossTangentValue() )
157 txt.Printf( wxT(
" LossTg %s" ), item->FormatLossTangent( idx ) );
166 txt.Printf( wxT(
"Finish \"%s\"" ), aStackup.
m_FinishType );
170 report << wxT(
" Option \"Impedance Controlled\"" );
173 report << wxT(
" Option \"Plated edges\"" );
177 wxString conn_txt = wxT(
"yes" );
180 conn_txt << wxT(
",bevelled" );
182 txt.Printf( wxT(
" EdgeConnector \"%s\"" ), conn_txt );
194 std::vector<std::vector<wxString>> rows;
197 std::vector<wxString> header = { wxT(
"Layer" ), wxT(
"Type" ), wxT(
"Sublayer" ) };
201 header.push_back( wxT(
"Thickness" ) );
202 header.push_back( wxT(
"Locked" ) );
206 header.push_back( wxT(
"Material" ) );
209 header.push_back( wxT(
"Color" ) );
212 header.push_back( wxT(
"EpsilonR" ) );
215 header.push_back( wxT(
"LossTg" ) );
217 rows.push_back( header );
221 if( !item->IsEnabled() )
224 int sublayerCount = item->GetSublayersCount();
226 if( sublayerCount <= 0 )
229 for(
int idx = 0; idx < sublayerCount; idx++ )
231 const bool hasSublayerData = item->GetSublayersCount() > 0;
232 std::vector<wxString> row;
235 row.push_back( item->GetTypeName() );
238 row.push_back( wxString::Format( wxT(
"%d/%d" ), idx + 1, item->GetSublayersCount() ) );
240 row.push_back( wxEmptyString );
246 if( item->IsThicknessEditable() && hasSublayerData )
252 row.push_back( thickness );
256 row.push_back(
locked ? wxT(
"yes" ) : wxEmptyString );
261 row.push_back( ( item->IsMaterialEditable() && hasSublayerData ) ? item->GetMaterial( idx )
266 row.push_back( item->IsColorEditable() ? item->GetColor() : wxString() );
270 row.push_back( ( item->HasEpsilonRValue() && hasSublayerData ) ? item->FormatEpsilonR( idx )
276 row.push_back( ( item->HasLossTangentValue() && hasSublayerData ) ? item->FormatLossTangent( idx )
280 rows.push_back( row );
286 rows.push_back( {} );
287 rows.push_back( { wxT(
"Property" ), wxT(
"Value" ) } );
291 wxStringOutputStream os;
295 return os.GetString();
constexpr EDA_IU_SCALE pcbIUScale
@ BS_EDGE_CONNECTOR_BEVELLED
@ BS_ITEM_TYPE_DIELECTRIC
wxString BuildStackupCsv(BOARD_STACKUP &aStackup, EDA_UNITS aUnits, const STACKUP_CSV_OPTIONS &aOptions)
wxString BuildStackupReport(BOARD_STACKUP &aStackup, EDA_UNITS aUnits)
static wxString layerDisplayName(const BOARD_STACKUP_ITEM *aItem)
static void appendCsvProperties(std::vector< std::vector< wxString > > &aRows, BOARD_STACKUP &aStackup, const STACKUP_CSV_OPTIONS &aOptions)
Manage one layer needed to make a physical board.
wxString FormatDielectricLayerName() const
wxString GetLayerName() const
BOARD_STACKUP_ITEM_TYPE GetType() const
Manage layers needed to make a physical board.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
bool m_HasDielectricConstrains
True if some layers have impedance controlled tracks or have specific constrains for micro-wave appli...
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...
wxString m_FinishType
The name of external copper finish.
void WriteLines(const std::vector< std::vector< wxString > > &aRows)
Write a vector of rows to the stream.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
KICOMMON_API wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Return the string from aValue according to aUnits (inch, mm ...) for display.
Options controlling which stackup fields are included in CSV exports.