93 namespace fs = std::filesystem;
95 fs::path tmpDir = fs::temp_directory_path() /
"kicad_drc_return_path_bbox";
96 fs::create_directories( tmpDir );
98 fs::path pcbPath = tmpDir /
"ret_path.kicad_pcb";
99 fs::path druPath = tmpDir /
"ret_path.kicad_dru";
102 std::ofstream pcbOut( pcbPath );
107 std::ofstream druOut( druPath );
112 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
113 plugin.
LoadBoard( pcbPath.string(), board.get() );
114 board->BuildConnectivity();
116 NETINFO_ITEM* coveredNet = board->FindNet( wxS(
"/CHAIN_COVERED" ) );
120 NETINFO_ITEM* uncoveredNet = board->FindNet( wxS(
"/CHAIN_UNCOVERED" ) );
126 auto drcEngine = std::make_shared<DRC_ENGINE>( board.get(), &bds );
127 wxFileName ruleFile( druPath.string() );
128 drcEngine->InitEngine( ruleFile );
139 std::vector<DRC_ITEM> returnPathViolations;
141 drcEngine->SetViolationHandler(
142 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I&,
int,
146 returnPathViolations.push_back( *aItem );
156 bool coveredFlagged =
false;
157 bool uncoveredFlagged =
false;
159 for(
const DRC_ITEM& item : returnPathViolations )
161 const wxString msg = item.GetErrorMessage(
false );
163 if( msg.Find( wxS(
"COVERED" ) ) != wxNOT_FOUND
164 && msg.Find( wxS(
"UNCOVERED" ) ) == wxNOT_FOUND )
166 coveredFlagged =
true;
169 if( msg.Find( wxS(
"UNCOVERED" ) ) != wxNOT_FOUND )
170 uncoveredFlagged =
true;
174 "Return-path break wrongly reported for chain shadowed by a zone" );
176 "Return-path break missing for chain with no overlying zone" );
179 fs::remove( pcbPath, ec );
180 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")