92 namespace fs = std::filesystem;
94 fs::path tmpDir = fs::temp_directory_path() /
"kicad_drc_return_path_bbox";
95 fs::create_directories( tmpDir );
97 fs::path pcbPath = tmpDir /
"ret_path.kicad_pcb";
98 fs::path druPath = tmpDir /
"ret_path.kicad_dru";
101 std::ofstream pcbOut( pcbPath );
106 std::ofstream druOut( druPath );
111 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
112 plugin.
LoadBoard( pcbPath.string(), board.get() );
113 board->BuildConnectivity();
115 NETINFO_ITEM* coveredNet = board->FindNet( wxS(
"/CHAIN_COVERED" ) );
119 NETINFO_ITEM* uncoveredNet = board->FindNet( wxS(
"/CHAIN_UNCOVERED" ) );
125 auto drcEngine = std::make_shared<DRC_ENGINE>( board.get(), &bds );
126 wxFileName ruleFile( druPath.string() );
127 drcEngine->InitEngine( ruleFile );
138 std::vector<DRC_ITEM> returnPathViolations;
140 drcEngine->SetViolationHandler(
141 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
145 returnPathViolations.push_back( *aItem );
155 bool coveredFlagged =
false;
156 bool uncoveredFlagged =
false;
158 for(
const DRC_ITEM& item : returnPathViolations )
160 const wxString msg = item.GetErrorMessage(
false );
162 if( msg.Find( wxS(
"COVERED" ) ) != wxNOT_FOUND
163 && msg.Find( wxS(
"UNCOVERED" ) ) == wxNOT_FOUND )
165 coveredFlagged =
true;
168 if( msg.Find( wxS(
"UNCOVERED" ) ) != wxNOT_FOUND )
169 uncoveredFlagged =
true;
173 "Return-path break wrongly reported for chain shadowed by a zone" );
175 "Return-path break missing for chain with no overlying zone" );
178 fs::remove( pcbPath, ec );
179 fs::remove( druPath, ec );
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 ...
BOOST_CHECK_EQUAL(result, "25.4")