39#include <wx/filedlg.h>
49 if( !aLayerMask.any() )
53 if( aLayerMask[
F_Cu] && aLayerMask[
B_Cu] )
57 if( aLayerMask[
F_Cu] )
61 if( aLayerMask[
B_Cu] )
65 for(
int layer =
In1_Cu; layer <
B_Cu; ++layer )
67 if( aLayerMask[layer] )
72 wxLogDebug(
"Unhandled layer mask input when compute pad access side of ODB++ netlist file." );
78 std::map<
size_t, std::vector<ODB_NET_RECORD>>& aRecords )
84 for(
PAD*
pad : footprint->Pads() )
90 if( !net_point.
side.empty() && net_point.
side !=
"I" )
92 if(
pad->GetNetCode() == 0 )
97 net_point.
refdes = footprint->GetReference();
99 net_point.
hole =
pad->HasHole();
101 if( !net_point.
hole )
106 net_point.
smd =
pad->GetAttribute() == PAD_ATTRIB::SMD
107 ||
pad->GetAttribute() == PAD_ATTRIB::CONN;
109 net_point.
mechanical = (
pad->GetAttribute() == PAD_ATTRIB::NPTH );
137 aRecords[
pad->GetNetCode()].push_back( net_point );
148 if( ( top_layer ==
F_Cu ) && ( bottom_layer ==
B_Cu ) )
152 if( top_layer ==
F_Cu )
156 if( bottom_layer ==
B_Cu )
165 std::map<
size_t, std::vector<ODB_NET_RECORD>>& aRecords )
170 for(
auto track : aBoard->
Tracks() )
177 via->LayerPair( &top_layer, &bottom_layer );
182 if( net_point.
side !=
"I" )
185 net_point.
smd =
false;
186 net_point.
hole =
true;
214 aRecords[net->
GetNetCode()].push_back( net_point );
222 std::ostream& aStream )
224 aStream <<
"H optimize n staggered n" << std::endl;
226 for(
const auto& [key, vec] : aRecords )
231 aStream <<
"#" << std::endl <<
"#Netlist points" << std::endl <<
"#" << std::endl;
233 for(
const auto& [key, vec] : aRecords )
235 for(
const auto& net_point : vec )
237 aStream << key <<
" ";
245 <<
ODB::Data2String( net_point.y_location ) <<
" " << net_point.side <<
" ";
247 if( !net_point.hole )
253 if( net_point.soldermask == 3 )
255 else if( net_point.soldermask == 2 )
257 else if( net_point.soldermask == 1 )
259 else if( net_point.soldermask == 0 )
262 aStream << net_point.epoint <<
" " << exp;
265 aStream <<
" staggered 0 0 0";
267 if( net_point.is_via )
270 aStream << std::endl;
278 std::map<size_t, std::vector<ODB_NET_RECORD>> net_point_records;
const VECTOR2I & GetAuxOrigin()
Information pertinent to a Pcbnew printed circuit board.
const FOOTPRINTS & Footprints() const
const TRACKS & Tracks() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
LSET is a set of PCB_LAYER_IDs.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Handle the data for a net.
const wxString & GetNetname() const
void WriteNetPointRecords(std::map< size_t, std::vector< ODB_NET_RECORD > > &aRecords, std::ostream &aStream)
Writes a list of records to the given output stream.
void InitViaNetPoints(BOARD *aBoard, std::map< size_t, std::vector< ODB_NET_RECORD > > &aRecords)
std::string ComputeViaAccessSide(BOARD *aBoard, int top_layer, int bottom_layer)
void Write(std::ostream &aStream)
void InitPadNetPoints(BOARD *aBoard, std::map< size_t, std::vector< ODB_NET_RECORD > > &aRecords)
std::string ComputePadAccessSide(BOARD *aBoard, LSET aLayerMask)
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
This file is part of the common library.
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
wxString Data2String(double aVal)
wxString GenLegalNetName(const wxString &aStr)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition of file extensions used in Kicad.