42 std::shared_ptr<RC_ITEMS_PROVIDER> aMarkersProvider,
43 std::shared_ptr<RC_ITEMS_PROVIDER> aRatsnestProvider,
44 std::shared_ptr<RC_ITEMS_PROVIDER> aFpWarningsProvider) :
62 FILE* fp = wxFopen( aFullFileName, wxT(
"w" ) );
72 wxFileName fn(
m_board->GetFileName() );
73 fprintf( fp,
"** Drc report for %s **\n",
TO_UTF8( fn.GetFullName() ) );
81 fprintf( fp,
"\n** Found %d DRC violations **\n", count );
83 for(
int i = 0; i < count; ++i )
86 SEVERITY severity = item->GetParent()->GetSeverity();
91 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemResolver ) ) );
96 fprintf( fp,
"\n** Found %d unconnected pads **\n", count );
98 for(
int i = 0; i < count; ++i )
103 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemResolver ) ) );
108 fprintf( fp,
"\n** Found %d Footprint errors **\n", count );
110 for(
int i = 0; i < count; ++i )
115 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemResolver ) ) );
118 fprintf( fp,
"\n** Ignored checks **\n" );
120 bool hasIgnored =
false;
124 int code = item.get().GetErrorCode();
126 if( code > 0 && bds.
Ignore( code ) )
134 fprintf( fp,
" - %s\n",
TO_UTF8(
_(
"None" ) ) );
136 fprintf( fp,
"\n** End of Report **\n" );
146 std::ofstream jsonFileStream( aFullFileName.fn_str() );
154 wxFileName fn(
m_board->GetFileName() );
155 reportHead.
$schema =
"https://schemas.kicad.org/drc.v1.json";
156 reportHead.
source = fn.GetFullName();
171 auto setMarkerLocation = [&](
const std::shared_ptr<RC_ITEM>& aItem,
RC_JSON::VIOLATION& aViolation )
188 aViolation.pos = pos;
194 SEVERITY severity = item->GetParent()->GetSeverity();
197 severity = bds.
GetSeverity( item->GetErrorCode() );
200 item->GetJsonViolation( violation, &unitsProvider, severity, itemResolver );
201 setMarkerLocation( item, violation );
212 item->GetJsonViolation( violation, &unitsProvider, severity, itemResolver );
213 setMarkerLocation( item, violation );
225 item->GetJsonViolation( violation, &unitsProvider, severity, itemResolver );
226 setMarkerLocation( item, violation );
233 int code = item.get().GetErrorCode();
235 if( code > 0 && bds.
Ignore( code ) )
238 ignoredCheck.
key = item.get().GetSettingsKey();
244 nlohmann::json saveJson = nlohmann::json( reportHead );
245 jsonFileStream << std::setw( 4 ) << saveJson << std::endl;
246 jsonFileStream.flush();
247 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.
bool Ignore(int aDRCErrorCode) const
Return true if the DRC error code's severity is RPT_SEVERITY_ERROR.
SEVERITY GetSeverity(int aDRCErrorCode) const
Return the severity of a given DRC error code.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Implements the RC_ITEM_RESOLVER interface to resolve PCB items by their KIID.
Information pertinent to a Pcbnew printed circuit board.
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
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
static wxString StripMarkup(const wxString &aValue)
Flatten [label](url) markup, keeping just the label.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
VECTOR2I GetPosition() const override
const EDA_IU_SCALE & GetIuScale() const
EDA_UNITS GetUserUnits() const
bool IsValidLayer(int aLayerId)
Test whether a given integer is a valid layer index, i.e.
This file contains miscellaneous commonly used macros and functions.
KICOMMON_API double ToUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Convert aValue in internal units to the appropriate user units defined by aUnit.
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 formatSeverities(int aSeverities)
Convert a severity mask to a human-readable comma-separated string.
wxString GetISO8601CurrentDateTime()
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
std::vector< wxString > included_severities
std::vector< VIOLATION > unconnected_items
std::vector< IGNORED_CHECK > ignored_checks
std::vector< VIOLATION > violations
std::vector< VIOLATION > schematic_parity
wxString coordinate_units
VECTOR2< int32_t > VECTOR2I