25#include <wx/cmdline.h>
61 wxFileName pro( filename );
62 wxFileName brdName ( filename );
63 wxFileName schName ( filename );
64 wxFileName ruleFileName ( filename );
71 brdName.MakeAbsolute();
72 schName.MakeAbsolute();
73 ruleFileName.MakeAbsolute();
76 manager.LoadProject( pro.GetFullPath() );
80 std::string( brdName.GetFullPath().ToUTF8() ) ).release() );
88 if( wxFileExists( schName.GetFullPath() ) )
101 std::shared_ptr<DRC_ENGINE> drcEngine(
new DRC_ENGINE );
105 project.board->GetDesignSettings().m_DRCEngine = drcEngine;
107 drcEngine->SetBoard(
project.board.get() );
108 drcEngine->SetDesignSettings( &
project.board->GetDesignSettings() );
112 drcEngine->SetViolationHandler(
113 [&](
const std::shared_ptr<DRC_ITEM>& aItem,
const VECTOR2I& aPos,
int aLayer,
114 const std::function<
void(
PCB_MARKER* )>& aPathGenerator )
120 drcEngine->InitEngine(
project.rulesFilePath );
121 drcEngine->SetDebugOverlay( aDebugOverlay );
123 for(
auto provider : drcEngine->GetTestProviders() )
135 catch(
const Clipper2Lib::Clipper2Exception& e )
137 consoleLog.
Print( wxString::Format(
"Clipper exception %s occurred.", e.what() ) );
General utilities for PCB file IO for QA programs.
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
void Print(const wxString &aMessage)
Design Rule Checker object that performs all the DRC tests.
virtual SETTINGS_MANAGER & GetSettingsManager() const
PROJECT_CONTEXT loadKicadProject(const wxString &filename, std::optional< wxString > rulesFilePath)
int runDRCProto(PROJECT_CONTEXT project, std::shared_ptr< KIGFX::VIEW_OVERLAY > aDebugOverlay)
static const std::string ProjectFileExtension
static const std::string KiCadSchematicFileExtension
static const std::string DesignRulesFileExtension
static const std::string KiCadPcbFileExtension
std::unique_ptr< BOARD > ReadBoardFromFileOrStream(const std::string &aFilename, std::istream &aFallback)
Read a board from a file, or another stream, as appropriate.
PGM_BASE & Pgm()
The global program "get" accessor.
std::shared_ptr< BOARD > board
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.