diff --git a/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp b/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp index 44daad4481..e9e487a922 100644 --- a/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp @@ -23,6 +23,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include +#include + #include #include @@ -64,8 +67,23 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName, for( const SCH_SHEET_PATH& sheet : m_schematic->Hierarchy() ) { - // Process symbol attributes + // The rtree returns items in a non-deterministic order (platform-dependent) + // Therefore we need to sort them before outputting to ensure file stability for version + // control and QA comparisons + std::vector sheetItems; + for( EDA_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) ) + sheetItems.push_back( item ); + + auto pred = []( const EDA_ITEM* item1, const EDA_ITEM* item2 ) + { + return item1->m_Uuid < item2->m_Uuid; + }; + + std::sort( sheetItems.begin(), sheetItems.end(), pred ); + + // Process symbol attributes + for( EDA_ITEM* item : sheetItems ) { SCH_SYMBOL* symbol = findNextSymbol( item, sheet ); diff --git a/qa/data/cli/basic_test/basic_test.netlist.orcadpcb2 b/qa/data/cli/basic_test/basic_test.netlist.orcadpcb2 index 73bccb7943..4af1be5e82 100644 --- a/qa/data/cli/basic_test/basic_test.netlist.orcadpcb2 +++ b/qa/data/cli/basic_test/basic_test.netlist.orcadpcb2 @@ -1,7 +1,12 @@ -( { EESchema Netlist Version 1.1 created 5/2/2023 8:59:05 PM } - ( /eaf8668d-aec7-4209-a3f9-fc7bfb5b931b Resistor_SMD:R_1206_3216Metric R1 10k +( { EESchema Netlist Version 1.1 created 2024-12-19T18:53:31+0000 } + ( /203ec3c1-122c-4087-8f6d-2a0dd0b941e6 TestPoint:TestPoint_Pad_3.0x3.0mm J1 Conn_01x01_Pin + ( 1 /VCC ) + ) + ( /2a9f5f63-d864-4898-ae3e-539c635e8f2c TestPoint:TestPoint_Pad_3.0x3.0mm J2 Conn_01x01_Pin + ( 1 /IN ) + ) + ( /789295bb-2cfb-4a2b-977f-b3831d5aa975 TestPoint:TestPoint_Pad_3.0x3.0mm J4 Conn_01x01_Pin ( 1 GND ) - ( 2 Net-(U1--) ) ) ( /8a4f4d93-4e0c-474b-8535-68c4fef6e828 Capacitor_SMD:C_1206_3216Metric C1 10u ( 1 Net-(U1-+) ) @@ -11,22 +16,13 @@ ( 1 Net-(U1--) ) ( 2 /OUT ) ) - ( /9efa520e-00e1-47a2-b8dc-bf8e2121d065 TestPoint:TestPoint_Pad_3.0x3.0mm J3 Conn_01x01_Pin - ( 1 /OUT ) - ) - ( /2a9f5f63-d864-4898-ae3e-539c635e8f2c TestPoint:TestPoint_Pad_3.0x3.0mm J2 Conn_01x01_Pin - ( 1 /IN ) - ) - ( /203ec3c1-122c-4087-8f6d-2a0dd0b941e6 TestPoint:TestPoint_Pad_3.0x3.0mm J1 Conn_01x01_Pin - ( 1 /VCC ) - ) - ( /789295bb-2cfb-4a2b-977f-b3831d5aa975 TestPoint:TestPoint_Pad_3.0x3.0mm J4 Conn_01x01_Pin - ( 1 GND ) - ) ( /985a669c-9a7f-4b74-bb4f-9487b164d3aa Resistor_SMD:R_1206_3216Metric R3 10k ( 1 /IN ) ( 2 Net-(U1-+) ) ) + ( /9efa520e-00e1-47a2-b8dc-bf8e2121d065 TestPoint:TestPoint_Pad_3.0x3.0mm J3 Conn_01x01_Pin + ( 1 /OUT ) + ) ( /b8a40376-5e4f-459f-9886-5e9ee83698cf Package_TO_SOT_SMD:SOT-23-5 U1 TLV2371DBV ( 1 /OUT ) ( 2 GND ) @@ -34,5 +30,9 @@ ( 4 Net-(U1--) ) ( 5 /VCC ) ) + ( /eaf8668d-aec7-4209-a3f9-fc7bfb5b931b Resistor_SMD:R_1206_3216Metric R1 10k + ( 1 GND ) + ( 2 Net-(U1--) ) + ) ) *