39 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
41 board->BuildConnectivity();
45 if( net->GetNetCode() > 0 ) net->SetNetChain( wxS(
"Signal1") );
48 std::map<int, std::vector<PAD*>> netPads;
49 for(
FOOTPRINT* fp : board->Footprints() )
50 for(
PAD*
pad : fp->Pads() )
51 if(
pad->GetNetCode() > 0 ) netPads[
pad->GetNetCode() ].push_back(
pad );
53 for(
auto& [code, pads] : netPads )
55 if( pads.size() >= 2 )
63 NETINFO_ITEM* n1 = board->FindNet( wxS(
"Net-(R1-Pad1)" ) );
67 long long extraLen = 0, extraDelay = 0;
72 long long net1TrackLen = 0;
73 bool havePoint =
false;
long long minX = 0, maxX = 0;
75 if(
auto tr =
dynamic_cast<PCB_TRACK*
>( bi ) )
78 net1TrackLen += ( tr->GetStart() - tr->GetEnd() ).EuclideanNorm();
79 long long sx = tr->GetStart().x;
long long ex = tr->GetEnd().x;
80 if( !havePoint ) { minX = std::min( sx, ex ); maxX = std::max( sx, ex ); havePoint =
true; }
81 else { minX = std::min( minX, std::min( sx, ex ) ); maxX = std::max( maxX, std::max( sx, ex ) ); }
83 long long net1Span = havePoint ? ( maxX - minX ) : 0;
84 BOOST_CHECK( net1Span > 0 );
85 BOOST_CHECK( net1TrackLen >= net1Span );
103 long long totalCopper = net1TrackLen + extraLen;
104 long long expectedCopper = 25 *
MM;
105 long long padSpacing = 30 *
MM;
106 BOOST_CHECK_MESSAGE( totalCopper >= expectedCopper,
107 "RoutedTotal=" << totalCopper <<
" expected>=" << expectedCopper
108 <<
" net1Track=" << net1TrackLen <<
" extra=" << extraLen );
109 BOOST_CHECK( totalCopper < padSpacing );
112 long long bridging = 0;
113 for(
FOOTPRINT* fp : board->Footprints() )
115 std::map<int, PAD*> chainPads;
116 for(
PAD*
pad : fp->Pads() )
122 if( chainPads.size() == 2 )
124 auto it = chainPads.begin();
125 PAD* p1 = it->second; ++it;
PAD* p2 = it->second;
129 BOOST_CHECK( bridging > 0 );
132 long long fullChain = totalCopper + bridging;
133 long long tol = 1 *
MM;
134 BOOST_CHECK_MESSAGE( fullChain >= padSpacing && fullChain < padSpacing + tol,
135 "FullChain=" << fullChain <<
" padSpacing=" << padSpacing
136 <<
" copper=" << totalCopper <<
" bridging=" << bridging );
BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr) override
Load information from some input file format that this PCB_IO implementation knows about into either ...