76 BOOST_CHECK(
dynamic_cast<PCB_VIA_STACK*
>( gen.get() ) !=
nullptr );
84 auto board = std::make_unique<BOARD>();
113 auto path = std::filesystem::temp_directory_path() /
"via_stack_saveload_tst.kicad_pcb";
118 BOOST_REQUIRE_EQUAL( reloaded->Generators().size(), 1u );
145 auto board = std::make_unique<BOARD>();
146 board->SetCopperLayerCount( 4 );
162 std::vector<PCB_VIA*> vias;
168 vias.push_back(
static_cast<PCB_VIA*
>( item ) );
176 std::set<std::pair<int, int>> pairs;
181 BOOST_CHECK(
via->GetPosition() == origin );
182 pairs.insert( { (int)
via->TopLayer(), (int)
via->BottomLayer() } );
193 auto board = std::make_unique<BOARD>();
194 board->SetCopperLayerCount( 4 );
217 std::vector<PCB_TRACK*> traces;
224 traces.push_back(
static_cast<PCB_TRACK*
>( item ) );
228 BOOST_REQUIRE_EQUAL( traces.size(), 1u );
232 BOOST_CHECK( trace->
GetStart() == p0 );
233 BOOST_CHECK( trace->
GetEnd() == p1 );
241 auto board = std::make_unique<BOARD>();
242 board->SetCopperLayerCount( 4 );
268 std::set<VECTOR2I> positions;
273 positions.insert(
static_cast<PCB_VIA*
>( item )->GetPosition() );
286 auto board = std::make_unique<BOARD>();
287 board->SetCopperLayerCount( 4 );
312 std::set<VECTOR2I> positions;
317 positions.insert(
static_cast<PCB_VIA*
>( item )->GetPosition() );
330 auto board = std::make_unique<BOARD>();
331 board->SetCopperLayerCount( 4 );
383 auto board = std::make_unique<BOARD>();
385 board->SetCopperLayerCount( 4 );
415 via->SetLayerPair( aTop, aBottom );
418 via->SetPosition( aPos );
419 via->SetNetCode( aNet );
429 auto board = std::make_unique<BOARD>();
430 board->SetCopperLayerCount( 4 );
435 std::vector<BOARD_ITEM*> items;
454 auto board = std::make_unique<BOARD>();
455 board->SetCopperLayerCount( 4 );
460 std::vector<BOARD_ITEM*> items;
472 auto board = std::make_unique<BOARD>();
473 board->SetCopperLayerCount( 4 );
505 found =
via->GetPosition();
510 BOOST_CHECK_MESSAGE( found == last,
"the end layer via is the last hop, not the stack position" );
517 auto board = std::make_unique<BOARD>();
518 board->SetCopperLayerCount( 4 );
521 board->Add(
new NETINFO_ITEM( board.get(), wxT(
"sig" ), 1 ) );
522 board->Add(
new NETINFO_ITEM( board.get(), wxT(
"other" ), 2 ) );
528 via->SetLayerPair( aTop, aBottom );
531 via->SetNetCode( aNet );
537 preset.
m_Name = wxT(
"fanout" );
539 std::vector<PENDING_STACK_EXPANSION> pending = { {
F_Cu,
In2_Cu, 1, preset } };
540 std::set<KIID> preRoute;
548 std::vector<PENDING_STACK_EXPANSION> upward = { {
In2_Cu,
F_Cu, 1, preset } };
558 preRoute.insert( match->
m_Uuid );
567 nlohmann::json entries = nlohmann::json::array();
569 entries.push_back( { {
"name",
"HDI" }, {
"start_layer",
"F.Cu" }, {
"end_layer",
"In1.Cu" } } );
570 entries.push_back( { {
"name",
"hdi" }, {
"start_layer",
"F.Cu" }, {
"end_layer",
"In2.Cu" } } );
571 entries.push_back( { {
"name",
"Other" }, {
"start_layer",
"F.Cu" }, {
"end_layer",
"In1.Cu" } } );
573 bds.
Set(
"via_stack_presets", entries );
587 auto board = std::make_unique<BOARD>();
590 auto capped = [](
PCB_VIA* aVia )
592 aVia->Padstack().Drill().is_capped =
true;
604 BOOST_CHECK_MESSAGE( topAnchored->IsCapped(),
"capping was dropped on a stack anchored at the front" );
614 BOOST_CHECK_MESSAGE( bottomAnchored->IsCapped(),
"capping was dropped on a stack anchored at the back" );
622 auto board = std::make_unique<BOARD>();
638 BOOST_CHECK_MESSAGE( stack->GetHops()->PointCount() == 3,
639 "hop chain has " << stack->GetHops()->PointCount() <<
" points for 3 vias" );
641 BOOST_CHECK( stack->GetHops()->CPoint( 0 ) == at );
642 BOOST_CHECK( stack->GetHops()->CPoint( 1 ) == at );
643 BOOST_CHECK( stack->GetHops()->CPoint( 2 ) == offset );
650 auto board = std::make_unique<BOARD>();
651 board->SetCopperLayerCount( 4 );
654 board->Add(
new NETINFO_ITEM( board.get(), wxT(
"A" ), 1 ) );
655 board->Add(
new NETINFO_ITEM( board.get(), wxT(
"B" ), 2 ) );
665 std::vector<BOARD_ITEM*> items = { upper, lower };
688 props.
set(
"start_layer", wxString( wxS(
"Not.A.Layer" ) ) );
689 props.
set(
"end_layer", wxString( wxS(
"B.Adhes" ) ) );
717 auto board = std::make_unique<BOARD>();
718 board->SetCopperLayerCount( 4 );
721 board->Add(
new NETINFO_ITEM( board.get(), wxT(
"A" ), 1 ) );
722 board->Add(
new NETINFO_ITEM( board.get(), wxT(
"B" ), 2 ) );
747 std::vector<BOARD_ITEM*> items = { hop0, hop1, connector, offLanding, otherNet, loose, zeroLength };
748 std::vector<BOARD_ITEM*> members;
756 for(
PCB_TRACK* stray : { offLanding, otherNet, loose, zeroLength } )
758 BOOST_CHECK_MESSAGE( std::count( members.begin(), members.end(), (
BOARD_ITEM*) stray ) == 0,
759 "a trace that does not link two hops joined the stack" );
767 auto board = std::make_unique<BOARD>();
768 board->SetCopperLayerCount( 4 );
782 std::vector<BOARD_ITEM*> items;
785 items.push_back( item );
787 BOOST_REQUIRE_EQUAL( items.size(), 2u );
796 auto board = std::make_unique<BOARD>();
797 board->SetCopperLayerCount( 4 );
809 BOOST_REQUIRE_EQUAL( board->Generators().size(), 1u );
821 BOOST_CHECK(
via->GetPosition() == pos );
829 for(
PCB_TRACK* track : board->Tracks() )
834 BOOST_CHECK(
via->GetParentGroup() !=
nullptr );
858 auto countVias = [&]() ->
size_t
871 BOOST_REQUIRE_EQUAL( countVias(), 1u );
880 BOOST_REQUIRE_EQUAL( countVias(), 1u );
893 commit.
Push( wxT(
"Expand Microvia Stacks" ) );
895 BOOST_REQUIRE_EQUAL( board.
Generators().size(), 1u );
901 BOOST_CHECK( track->GetParentGroup() !=
nullptr );
911 auto board = std::make_unique<BOARD>();
912 board->SetCopperLayerCount( 4 );
931 board->BuildConnectivity();
933 std::vector<PCB_VIA*> vias;
938 vias.push_back(
static_cast<PCB_VIA*
>( item ) );
941 BOOST_REQUIRE_EQUAL( vias.size(), 2u );
943 std::vector<BOARD_CONNECTED_ITEM*> connected = board->GetConnectivity()->GetConnectedItems( vias[0] );
945 bool otherFound = std::find( connected.begin(), connected.end(),
static_cast<BOARD_CONNECTED_ITEM*
>( vias[1] ) )
948 BOOST_CHECK_MESSAGE( otherFound,
"Coaxial microvia hops sharing the inner layer must be connected." );
983 stack->
EditStart(
nullptr, &board, &commit );
984 stack->
Update(
nullptr, &board, &commit );
985 stack->
EditFinish(
nullptr, &board, &commit );
988 commit.
Push( wxT(
"Place Microvia Stack" ) );
990 BOOST_REQUIRE_EQUAL( board.
Generators().size(), 1u );
994 std::vector<PCB_VIA*> boardVias;
999 boardVias.push_back(
static_cast<PCB_VIA*
>( track ) );
1002 BOOST_REQUIRE_EQUAL( boardVias.size(), 2u );
1028 BOOST_CHECK( stack->
HitTest( pos, 0 ) );
1032 BOOST_CHECK( stack->
HitTest( around,
false, 0 ) );
1033 BOOST_CHECK( stack->
HitTest( around,
true, 0 ) );
1038 BOOST_CHECK( std::find( viewLayers.begin(), viewLayers.end(), (
int) stack->
GetLayer() ) != viewLayers.end() );
1046 auto board = std::make_unique<BOARD>();
1047 board->SetCopperLayerCount( 6 );
1064 board->Add( stack );
1085 for(
PCB_TRACK* track : board->Tracks() )
1096 auto board = std::make_unique<BOARD>();
1097 board->SetCopperLayerCount( 4 );
1114 pad->SetPosition( padPos );
1118 pad->SetNetCode( 1 );
1127 board->Add( track );
1142 board->Add( stack );
1169 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
1170 board->SetCopperLayerCount( 4 );
1173 board->Add(
new NETINFO_ITEM( board.get(), wxT(
"inner" ), 1 ) );
1183 board->Add( track );
1198 board->Add( stack );
1213 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
1214 board->SetCopperLayerCount( 4 );
1217 board->Add(
new NETINFO_ITEM( board.get(), wxT(
"sig" ), 1 ) );
1227 board->Add( track );
1233 PAD* hole =
new PAD( fp );
1243 BOOST_REQUIRE_EQUAL( hole->
GetNetCode(), 0 );
1282 auto board = std::make_unique<BOARD>();
1283 board->SetCopperLayerCount( 4 );
1295 board->Add( stack );
1303 int viasCollected = 0;
1305 for(
int i = 0; i < collector.
GetCount(); i++ )
1311 BOOST_CHECK_MESSAGE( viasCollected == 2,
"Expected both member vias in the click collection, got "
1312 << viasCollected <<
" of " << collector.
GetCount()
1313 <<
" collected items" );
1316 for(
int i = 0; i < collector.
GetCount(); i++ )
1335 mgr.
SetEnvironment( &board,
nullptr,
nullptr,
nullptr,
nullptr );
1354 BOOST_REQUIRE_EQUAL( stack->
GetItems().size(), 2u );
1363 BOOST_REQUIRE_EQUAL( stack->
GetItems().size(), 3u );
1368 BOOST_REQUIRE_EQUAL( stack->
GetItems().size(), 2u );
1370 std::vector<PCB_VIA*> boardVias;
1375 boardVias.push_back(
static_cast<PCB_VIA*
>( track ) );
1378 BOOST_CHECK_MESSAGE( boardVias.size() == 2,
1379 "Revert left " << boardVias.size() <<
" vias on the board, expected 2" );
1386 BOOST_CHECK_MESSAGE(
via->GetParentGroup() ==
static_cast<EDA_GROUP*
>( stack ),
1387 "Member via at " <<
via->GetPosition().x <<
"," <<
via->GetPosition().y
1388 <<
" lost its back-pointer to the stack after revert" );
1394 BOOST_CHECK_MESSAGE( std::find( board.
Tracks().begin(), board.
Tracks().end(), item ) != board.
Tracks().end(),
1395 "Stack holds a member that is not on the board after revert" );
1405 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
1407 board->SetCopperLayerCount( 6 );
1420 board->Add( stack );
1430 BOOST_CHECK_MESSAGE( reloaded.
GetStartLayer() ==
In1_Cu,
"Start layer lost in the properties round trip" );
1432 <<
" does not track the start layer " <<
In1_Cu
1433 <<
" after a properties round trip" );
1437 BOOST_CHECK( std::find( viewLayers.begin(), viewLayers.end(), (
int)
In1_Cu ) != viewLayers.end() );
1448 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
1450 board->SetCopperLayerCount( 4 );
1464 board->Add( stack );
1467 BOOST_REQUIRE_MESSAGE( stack->
GetItems().empty(),
"Precondition failed: the stack has members, so this test is "
1468 "not exercising a ghost" );
1470 auto path = std::filesystem::temp_directory_path() /
"via_stack_ghost_tst.kicad_pcb";
1475 BOOST_CHECK_MESSAGE( reloaded->Generators().empty(),
1476 "A member-less via stack was written to the board file; it reloads "
1477 "invisible, unpickable and on no net" );
1485 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
1487 board->SetCopperLayerCount( 4 );
1501 board->Add( stack );
1504 BOOST_REQUIRE_EQUAL( stack->
GetItems().size(), 2u );
1506 auto path = std::filesystem::temp_directory_path() /
"via_stack_netkeep_tst.kicad_pcb";
1511 BOOST_REQUIRE_EQUAL( reloaded->Generators().size(), 1u );
1516 NETINFO_ITEM* loadedNet = reloaded->FindNet( wxT(
"MICROVIA_NET" ) );
1520 "Reloaded stack reports net " << loaded->
GetNetCode() <<
", expected "
1533 for(
const wxString&
name : { wxT(
"Start Layer" ), wxT(
"End Layer" ), wxT(
"Style" ), wxT(
"Net" ),
1534 wxT(
"Pitch" ), wxT(
"Via Diameter" ), wxT(
"Via Hole" ), wxT(
"Copper-filled" ),
1535 wxT(
"Capped" ), wxT(
"Use Netclass Values" ) } )
1539 BOOST_REQUIRE_MESSAGE( prop,
"Property \"" <<
name
1540 <<
"\" is missing, so the Properties "
1541 "panel cannot show it" );
1542 BOOST_CHECK_MESSAGE( !prop->
Writeable(
nullptr ),
"Property \"" <<
name
1543 <<
"\" is editable, but editing it cannot "
1544 "rebuild the stack" );
1549 "The inherited \"Layer\" property should be masked for a via stack" );
1555 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
1557 board->SetCopperLayerCount( 6 );
1563 via->SetViaType( aType );
1564 via->SetLayerPair( aTop, aBottom );
1567 via->SetPosition( aPos );
1581 board->Add( stack );
1588 BOOST_CHECK_MESSAGE( ids.count( multiHop->
m_Uuid ) == 1,
1589 "A loose multi-hop microvia must be reported as expandable" );
1590 BOOST_CHECK_MESSAGE( ids.count( owned->
m_Uuid ) == 0,
"A via already in a stack is not expandable" );
1617 via->SetPosition( pos );
1626 std::vector<VECTOR2I> positions;
1630 if( track->Type() ==
PCB_VIA_T && !track->GetParentGroup()
1633 positions.push_back( track->GetPosition() );
1645 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
1652 return aVia->GetNetCode() == 1 ? &preset :
nullptr;
1663 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
1665 board->SetCopperLayerCount( 6 );
1671 auto addMultiHop = [&](
const VECTOR2I& aPos )
1678 via->SetPosition( aPos );
1686 BOOST_REQUIRE_EQUAL( beforeRouting.size(), 1u );
1692 std::vector<PENDING_STACK_EXPANSION> pending = { {
F_Cu,
In2_Cu, net->
GetNetCode(), preset } };
1701 BOOST_REQUIRE_EQUAL( board->Generators().size(), 1u );
1702 BOOST_CHECK_MESSAGE( board->Generators().front()->GetPosition() ==
ROUTED_POS,
1703 "The stack was built at the wrong via" );
1707 BOOST_REQUIRE_MESSAGE( loose.size() == 1,
1708 "Expected the pre-existing via to be left loose, found " << loose.size() );
1709 BOOST_CHECK_MESSAGE( loose.front() ==
PRE_ROUTE_POS,
"A via that predates the route was swallowed into a stack" );
1715 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
1717 board->SetCopperLayerCount( 6 );
1730 board->Add( stack );
1733 auto memberIds = [&]()
1738 ids.insert( item->m_Uuid );
1743 auto countVias = [&]() ->
size_t
1747 for(
PCB_TRACK* track : board->Tracks() )
1756 const std::set<KIID> before = memberIds();
1757 const size_t viasBefore = countVias();
1762 for(
int step = 0; step < 5; ++step )
1768 BOOST_CHECK_MESSAGE( memberIds() == before,
"Moving the stack replaced its members instead of moving them, so a "
1769 "drag would stage one generation of vias per motion event" );
1771 BOOST_CHECK_MESSAGE( countVias() == viasBefore,
"The board gained or lost vias while the stack was moved: "
1772 << countVias() <<
" now, " << viasBefore <<
" before" );
1786 BOOST_REQUIRE_EQUAL( board->Generators().size(), 2u );
1831 BOOST_CHECK( item->GetParentGroup() ==
static_cast<EDA_GROUP*
>( stacked ) );
1842 <<
" capping disagrees with the generator" );
1852 mgr.
SetEnvironment( &board,
nullptr,
nullptr,
nullptr,
nullptr );
1868 auto countVias = [&]() ->
size_t
1881 const size_t before = countVias();
1882 BOOST_REQUIRE_EQUAL( before, 2u );
1887 stack->
Remove(
nullptr, &board, &reverted );
1890 BOOST_CHECK_MESSAGE( countVias() == before,
1891 "Reverting the delete left " << countVias() <<
" vias, expected " << before );
1897 stack->
Remove(
nullptr, &board, &commit );
1898 commit.
Push( wxT(
"Delete Microvia Stack" ) );
1911 preset.
m_Name = wxS(
"HDI 1+N+1" );
1932 std::optional<nlohmann::json> stored = bds.
Get<nlohmann::json>(
"via_stack_presets" );
1947 nlohmann::json entries = nlohmann::json::array();
1949 entries.push_back( { {
"name",
"unknown layer" }, {
"start_layer",
"Nonsense" }, {
"end_layer",
"" } } );
1950 entries.push_back( { {
"start_layer",
"F.Cu" }, {
"end_layer",
"In1.Cu" } } );
1951 entries.push_back(
"not an object" );
1952 entries.push_back( { {
"name",
"not copper" }, {
"start_layer",
"F.SilkS" }, {
"end_layer",
"Edge.Cuts" } } );
1953 entries.push_back( { {
"name",
"still numeric" }, {
"start_layer", 0 }, {
"end_layer", 4 } } );
1955 bds.
Set(
"via_stack_presets", entries );
1963 "Preset \"" << p.
m_Name <<
"\" kept a non-copper layer" );
1971 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
1973 board->SetCopperLayerCount( 6 );
1983 board->Add( stack );
1986 BOOST_REQUIRE_EQUAL( stack->
GetItems().size(), 1u );
1991 std::set<std::pair<int, int>> pairs;
1995 BOOST_REQUIRE_EQUAL( item->Type(),
PCB_VIA_T );
1997 pairs.insert( { (int)
via->TopLayer(), (int)
via->BottomLayer() } );
2005 for(
PCB_TRACK* track : board->Tracks() )
2011 BOOST_CHECK_MESSAGE( vias == 4,
"Widening the span left " << vias <<
" vias on the board, "
2019 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
2021 board->SetCopperLayerCount( 6 );
2029 via->SetViaType( aType );
2030 via->SetLayerPair( aTop, aBottom );
2033 via->SetPosition( pos );
2044 "A selection containing a non-microvia was accepted as a stack" );
2052 BOOST_CHECK( made !=
nullptr );
2061 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
2063 board->SetCopperLayerCount( 6 );
2074 board->Add( stack );
2077 BOOST_REQUIRE_EQUAL( stack->
GetItems().size(), 3u );
2085 BOOST_CHECK_MESSAGE(
via->Padstack().Drill().is_filled.value_or(
false ),
2086 "Every hop of a stacked stack must be filled" );
2088 if(
via->Padstack().Drill().is_capped.value_or(
false ) )
2094 "A buried hop was marked capped" );
2098 BOOST_CHECK_MESSAGE( capped == 1,
"Expected exactly the outer hop to be capped, found " << capped );
2105 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
2107 board->SetCopperLayerCount( 6 );
2118 board->Add( stack );
2121 BOOST_REQUIRE_EQUAL( stack->
GetItems().size(), 2u );
2127 BOOST_CHECK_MESSAGE( !
via->Padstack().Drill().is_capped.value_or(
false ),
2128 "A wholly internal stack has no outer face to cap" );
2143 preset.
m_Name = wxT(
"buried" );
2150 BOOST_CHECK_MESSAGE( stack.
GetLayer() ==
In1_Cu,
"the stack's own layer must follow the preset's start layer" );
2154 BOOST_CHECK_MESSAGE( std::find( layers.begin(), layers.end(),
In1_Cu ) != layers.end(),
2155 "the stack must register in the view on its start layer" );
2179 auto traceWidth = [&]() ->
int
2184 return static_cast<PCB_TRACK*
>( item )->GetWidth();
2190 int placed = traceWidth();
2200 BOOST_CHECK_MESSAGE( traceWidth() == placed,
"trace width changed from " << placed <<
" to " << traceWidth()
2201 <<
" without the user touching it" );
2227 BOOST_CHECK(
copy->m_Uuid != stack->
m_Uuid );
2247 const int netclassDia =
pcbIUScale.mmToIU( 0.25 );
2248 const int netclassDrill =
pcbIUScale.mmToIU( 0.12 );
2256 board.
Add( netinfo );
2269 preset.
m_Name = wxT(
"netclass stack" );
2278 BOOST_REQUIRE_EQUAL( expanded, 1 );
2279 BOOST_REQUIRE_EQUAL( board.
Generators().size(), 1u );
2322 BOOST_CHECK_MESSAGE( stack->
GetBoardItems().size() == 2u,
"hops were destroyed, leaving an invisible stack: "
2360 std::vector<VECTOR2I> centres;
2365 centres.push_back( item->GetPosition() );
2369 auto has = [&](
const VECTOR2I& aPoint )
2371 return std::find( centres.begin(), centres.end(), aPoint ) != centres.end();
2374 BOOST_REQUIRE_EQUAL( centres.size(), 3u );
2379 BOOST_CHECK_MESSAGE( has( origin +
VECTOR2I( 0, 2 * pitch ) ),
"the new hop did not continue the chain" );
2380 BOOST_CHECK_MESSAGE( !has( origin +
VECTOR2I( 2 * pitch, 0 ) ),
"the new hop fell back onto the +X axis" );
2387 for(
bool boardFills : {
false,
true } )
2399 std::vector<BOARD_ITEM*> items;
2406 via->SetLayerPair( pair.first, pair.second );
2409 via->SetPosition( hop++ == 0 ? at :
next );
2411 items.push_back(
via );
2418 BOOST_CHECK_MESSAGE( stack->IsFilled() == boardFills,
2419 "board fill " << boardFills <<
" gave stack fill " << stack->IsFilled() );
2438 via->SetViaType( aType );
2442 via->SetPosition( aPos );
2454 preset.
m_Name = wxT(
"p" );
2459 return aVia->GetNetCode() == net->
GetNetCode() ? &preset :
nullptr;
2464 BOOST_REQUIRE_EQUAL( board.
Generators().size(), 1u );
2467 std::set<KIID> remaining;
2470 remaining.insert( track->m_Uuid );
2472 BOOST_CHECK_MESSAGE( remaining.count( throughId ),
"a through via was converted" );
2473 BOOST_CHECK_MESSAGE( remaining.count( buriedId ),
"a buried via was converted" );
2474 BOOST_CHECK_MESSAGE( !remaining.count( microId ),
"the microvia should have been expanded" );
constexpr EDA_IU_SCALE pcbIUScale
General utilities for PCB file IO for QA programs.
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
virtual void Revert() override
Revert the commit by restoring the modified items state.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
virtual bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Container for design settings for a BOARD object.
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
std::shared_ptr< NET_SETTINGS > m_NetSettings
void SetCustomTrackWidth(int aWidth)
Sets custom width for track (i.e.
std::vector< VIA_STACK_PRESET > m_ViaStackPresets
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
const GENERATORS & Generators() const
const TRACKS & Tracks() const
void SetCopperLayerCount(int aCount)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
constexpr bool Contains(const Vec &aPoint) const
An abstract base class whose derivatives may be passed to a GENERAL_COLLECTOR telling it what should ...
int GetCount() const
Return the number of objects in the list.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
A set of EDA_ITEMs (i.e., without duplicates).
std::unordered_set< EDA_ITEM * > & GetItems()
void AddItem(EDA_ITEM *aItem)
Add item to group.
void SetFlags(EDA_ITEM_FLAGS aMask)
virtual EDA_GROUP * GetParentGroup() const
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
virtual void SetParent(EDA_ITEM *aParent)
Used when the right click button is pressed, or when the select tool is in effect.
static const std::vector< KICAD_T > AllBoardItems
A scan list for all editable board items.
void Collect(BOARD_ITEM *aItem, const std::vector< KICAD_T > &aScanList, const VECTOR2I &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
static GENERATORS_MGR & Instance()
void Set(const std::string &aPath, ValueType aVal)
Stores a value into the JSON document Will throw an exception if ValueType isn't something that the l...
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
std::optional< ValueType > Get(const std::string &aPath) const
Fetches a value from within the JSON document.
virtual bool Store()
Stores the current parameters into the JSON document represented by this object Note: this doesn't do...
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
void SetuViaDiameter(int aSize)
void SetuViaDrill(int aSize)
Handle the data for a net.
void SetNetClass(const std::shared_ptr< NETCLASS > &aNetClass)
std::shared_ptr< NETCLASS > GetDefaultNetclass() const
Gets the default netclass for the project.
static constexpr PCB_LAYER_ID ALL_LAYERS
! The layer identifier to use for the single defintion on normal padstacks
void SetAttribute(PAD_ATTRIB aAttribute)
void SetShape(PCB_LAYER_ID aLayer, PAD_SHAPE aShape)
Set the new shape of this pad.
void SetDrillShape(PAD_DRILL_SHAPE aShape)
void SetPosition(const VECTOR2I &aPos) override
void SetDrillSize(const VECTOR2I &aSize)
void SetSize(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
void SetLayerSet(const LSET &aLayers) override
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
void SetPosition(const VECTOR2I &aPos) override
VECTOR2I GetPosition() const override
A set of BOARD_ITEMs (i.e., without duplicates).
static EDA_GROUP * TopLevelGroup(BOARD_ITEM *aItem, EDA_GROUP *aScope, bool isFootprintEditor)
std::unordered_set< BOARD_ITEM * > GetBoardItems() const
PCB_GROUP * DeepDuplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr, std::map< KIID, KIID > *aKIIDMap=nullptr) const
void SetEnd(const VECTOR2I &aEnd)
void SetStart(const VECTOR2I &aStart)
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
virtual void SetWidth(int aWidth)
A microvia stack: several single hop microvias, plus connecting traces for staggered stacks,...
void SetHops(const SHAPE_LINE_CHAIN &aHops)
bool Update(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void ApplyPreset(const VIA_STACK_PRESET &aPreset)
static int ExpandMultiHopMicrovias(BOARD *aBoard, BOARD_COMMIT *aCommit, const std::function< const VIA_STACK_PRESET *(PCB_VIA *)> &aMatcher=nullptr)
Replace loose microvias spanning more than one hop with stacks of single hop microvias.
void SetProperties(const STRING_ANY_MAP &aProps) override
void SetPitch(int aPitch)
static PCB_VIA_STACK * CreateFromItems(const std::vector< BOARD_ITEM * > &aItems, BOARD *aBoard, std::vector< BOARD_ITEM * > *aMembers=nullptr)
Build a stack from existing board items (microvias plus optional connecting traces).
static std::set< KIID > CollectExpandableMicrovias(BOARD *aBoard)
Ids of the vias ExpandMultiHopMicrovias would consider right now.
void EditStart(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
static int FindNetAtPosition(BOARD *aBoard, const VECTOR2I &aPosition, PCB_LAYER_ID aLayer)
Net of the copper under a point on the given layer, pads first, then tracks, then filled zones.
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
void EditFinish(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
void Remove(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
void Regenerate(BOARD *aBoard, BOARD_COMMIT *aCommit)
Rebuild the member vias (and, for a staggered stack, the connecting traces) from the current stack se...
const std::optional< SHAPE_LINE_CHAIN > & GetHops() const
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
VIA_STACK_STYLE GetStyle() const
std::vector< int > ViewGetLayers() const override
void SetFilled(bool aFilled)
void SetPresetName(const wxString &aName)
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
const wxString & GetPresetName() const
PCB_LAYER_ID GetStartLayer() const
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void SetStartLayer(PCB_LAYER_ID aLayer)
PCB_LAYER_ID GetEndLayer() const
bool GetUseNetclass() const
static bool IsSpanValid(BOARD *aBoard, PCB_LAYER_ID aStart, PCB_LAYER_ID aEnd)
True when both span ends are copper layers within the board's copper layer count.
void SetViaSize(int aSize)
void SetCapped(bool aCapped)
void SetViaDrill(int aDrill)
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
const STRING_ANY_MAP GetProperties() const override
void SetUseNetclass(bool aUse)
void SetStyle(VIA_STACK_STYLE aStyle)
void Move(const VECTOR2I &aMoveVector) override
Move this object.
void SetEndLayer(PCB_LAYER_ID aLayer)
void SetNetCode(int aNet)
PCB_LAYER_ID BottomLayer() const
const PADSTACK & Padstack() const
int GetWidth() const override
PCB_LAYER_ID TopLayer() const
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
VIATYPE GetViaType() const
virtual bool Writeable(INSPECTABLE *aObject) const
Provide class metadata.Helper macro to map type hashes to names.
static PROPERTY_MANAGER & Instance()
void Rebuild()
Rebuild the list of all registered properties.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
A name/value tuple with unique names and wxAny values.
void set(const std::string &aKey, const T &aVar)
Minimal COLLECTORS_GUIDE so GetCoverageArea() can be exercised headlessly.
bool IgnoreMicroVias() const override
bool IgnoreThroughHolePads() const override
bool IgnoreBlindBuriedVias() const override
bool IgnorePadsOnFront() const override
int Accuracy() const override
bool IgnoreFootprintsOnFront() const override
bool IgnoreFPReferences() const override
bool IgnoreTracks() const override
bool IgnoreFPTextOnFront() const override
bool IgnoreNoNets() const override
bool IsLayerVisible(PCB_LAYER_ID) const override
bool IgnoreFootprintsOnBack() const override
PCB_LAYER_ID GetPreferredLayer() const override
bool IgnoreZoneFills() const override
bool IncludeSecondary() const override
Determine if the secondary criteria or 2nd choice items should be included.
bool IgnoreThroughVias() const override
bool IgnoreFPValues() const override
double OnePixelInIU() const override
bool IgnorePadsOnBack() const override
bool IgnoreLockedItems() const override
bool IgnoreFPTextOnBack() const override
#define IGNORE_PARENT_GROUP
#define IS_NEW
New item, just created.
#define IN_EDIT
Item currently edited.
static PCB_TRACK * makeSegment(BOARD *aBoard, const VECTOR2I &aStart, const VECTOR2I &aEnd)
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
bool IsExternalCopperLayer(int aLayerId)
Test whether a layer is an external (F_Cu or B_Cu) copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
@ LEFT_RIGHT
Flip left to right (around the Y axis)
std::string GetPcbnewTestDataDir()
Utility which returns a path to the data directory where the test board files are stored.
std::unique_ptr< BOARD > ReadBoardFromFileOrStream(const std::string &aFilename, std::istream &aFallback)
Read a board from a file, or another stream, as appropriate.
void DumpBoardToFile(BOARD &board, const std::filesystem::path &aFilename)
Utility function to simply write a Board out to a file.
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
Class to handle a set of BOARD_ITEMs.
std::optional< bool > is_capped
True if the drill hole should be capped.
A named microvia stack definition, chosen while routing instead of entering the values each time.
PCB_LAYER_ID m_StartLayer
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
KIBIS top(path, &reporter)
BOOST_TEST_MESSAGE("Polyline has "<< chain.PointCount()<< " points")
BOOST_CHECK_EQUAL(result, "25.4")
BOOST_AUTO_TEST_CASE(FactoryRegistered)
static PCB_VIA * makeMicrovia(BOARD *aBoard, const VECTOR2I &aPos, PCB_LAYER_ID aTop, PCB_LAYER_ID aBottom, int aNet=0)
static std::vector< VECTOR2I > looseMicroviaPositions(BOARD *aBoard)
static PCB_TRACK * makeSegment(BOARD *aBoard, const VECTOR2I &aStart, const VECTOR2I &aEnd)
static const VECTOR2I ROUTED_POS(pcbIUScale.mmToIU(10), pcbIUScale.mmToIU(10))
static void makeSharedNetMultiHopPair(BOARD *aBoard)
static const VECTOR2I PRE_ROUTE_POS(pcbIUScale.mmToIU(50), pcbIUScale.mmToIU(50))
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
VECTOR2< int32_t > VECTOR2I