38 std::shared_ptr<RC_ITEMS_PROVIDER> aMarkersProvider,
39 std::shared_ptr<RC_ITEMS_PROVIDER> aRatsnestProvider,
40 std::shared_ptr<RC_ITEMS_PROVIDER> aFpWarningsProvider) :
56 FILE* fp = wxFopen( aFullFileName, wxT(
"w" ) );
61 std::map<KIID, EDA_ITEM*> itemMap;
62 m_board->FillItemMap( itemMap );
68 wxFileName fn(
m_board->GetFileName() );
69 fprintf( fp,
"** Drc report for %s **\n",
TO_UTF8( fn.GetFullName() ) );
75 fprintf( fp,
"\n** Found %d DRC violations **\n", count );
77 for(
int i = 0; i < count; ++i )
80 SEVERITY severity = item->GetParent()->GetSeverity();
85 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
90 fprintf( fp,
"\n** Found %d unconnected pads **\n", count );
92 for(
int i = 0; i < count; ++i )
97 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
102 fprintf( fp,
"\n** Found %d Footprint errors **\n", count );
104 for(
int i = 0; i < count; ++i )
109 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
113 fprintf( fp,
"\n** End of Report **\n" );
123 std::ofstream jsonFileStream( aFullFileName.fn_str() );
127 std::map<KIID, EDA_ITEM*> itemMap;
128 m_board->FillItemMap( itemMap );
132 wxFileName fn(
m_board->GetFileName() );
133 reportHead.
$schema =
"https://schemas.kicad.org/drc.v1.json";
134 reportHead.
source = fn.GetFullName();
142 SEVERITY severity = item->GetParent()->GetSeverity();
145 severity = bds.
GetSeverity( item->GetErrorCode() );
148 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
159 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
171 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
177 nlohmann::json saveJson = nlohmann::json( reportHead );
178 jsonFileStream << std::setw( 4 ) << saveJson << std::endl;
179 jsonFileStream.flush();
180 jsonFileStream.close();
constexpr EDA_IU_SCALE pcbIUScale
wxString GetMajorMinorPatchVersion()
Get the major, minor and patch version in a string major.minor.patch This is extracted by CMake from ...
Container for design settings for a BOARD object.
SEVERITY GetSeverity(int aDRCErrorCode)
Information pertinent to a Pcbnew printed circuit board.
std::shared_ptr< RC_ITEMS_PROVIDER > m_ratsnestProvider
bool WriteJsonReport(const wxString &aFullFileName)
std::shared_ptr< RC_ITEMS_PROVIDER > m_markersProvider
bool WriteTextReport(const wxString &aFullFileName)
DRC_REPORT(BOARD *aBoard, EDA_UNITS aReportUnits, std::shared_ptr< RC_ITEMS_PROVIDER > aMarkersProvider, std::shared_ptr< RC_ITEMS_PROVIDER > aRatsnestProvider, std::shared_ptr< RC_ITEMS_PROVIDER > aFpWarningsProvider)
std::shared_ptr< RC_ITEMS_PROVIDER > m_fpWarningsProvider
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
This file contains miscellaneous commonly used macros and functions.
KICOMMON_API wxString GetLabel(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
wxString GetISO8601CurrentDateTime()
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
std::vector< VIOLATION > unconnected_items
std::vector< VIOLATION > violations
std::vector< VIOLATION > schematic_parity
wxString coordinate_units