59 virtual bool Run()
override;
61 virtual const wxString
GetName()
const override {
return wxT(
"schematic_parity" ); };
74 return x->
GetReference().CmpNoCase( y->GetReference() ) < 0;
77 auto footprints = std::set<FOOTPRINT*, decltype( compare )>( compare );
85 auto ins = footprints.insert( footprint );
87 if( !ins.second && !( footprint->GetAttributes() &
FP_BOARD_ONLY ) )
90 drcItem->SetItems( footprint, *ins.first );
97 for(
unsigned ii = 0; ii < aNetlist.
GetCount(); ii++ )
102 if( footprint ==
nullptr )
107 msg.Printf(
_(
"Missing footprint %s (%s)" ),
113 drcItem->SetErrorMessage( msg );
123 msg.Printf(
_(
"Value (%s) doesn't match symbol value (%s)." ),
128 drcItem->SetErrorMessage( msg );
129 drcItem->SetItems( footprint );
137 msg.Printf(
_(
"%s doesn't match footprint given by symbol (%s)." ),
142 drcItem->SetErrorMessage( msg );
143 drcItem->SetItems( footprint );
152 bool found = ( 0 == filtercount );
154 for(
size_t jj = 0; jj < filtercount && !found; jj++ )
158 if( filterLower.Find(
':' ) == wxNOT_FOUND )
159 found = fpNameLower.Matches( filterLower );
161 found = libIdLower.Matches( filterLower );
167 msg.Printf(
_(
"%s doesn't match symbol's footprint filters (%s)." ),
172 drcItem->SetErrorMessage( msg );
173 drcItem->SetItems( footprint );
183 msg.Printf(
_(
"'%s' settings differ." ),
_(
"Do not populate" ) );
186 drcItem->SetErrorMessage( drcItem->GetErrorMessage() + wxS(
": " ) + msg );
187 drcItem->SetItems( footprint );
191 if( ( component->
GetProperties().count(
"exclude_from_bom" ) > 0 )
196 msg.Printf(
_(
"'%s' settings differ." ),
_(
"Exclude from bill of materials" ) );
199 drcItem->SetErrorMessage( drcItem->GetErrorMessage() + wxS(
": " ) + msg );
200 drcItem->SetItems( footprint );
209 if( !
pad->CanHaveNumber() )
213 const wxString& pcb_netname =
pad->GetNetname();
215 if( !pcb_netname.IsEmpty() && sch_net.
GetPinName().IsEmpty() )
218 msg.Printf(
_(
"No corresponding pin found in schematic." ) );
221 drcItem->SetErrorMessage( msg );
222 drcItem->SetItems(
pad );
225 else if( pcb_netname.IsEmpty() && !sch_net.
GetNetName().IsEmpty() )
228 msg.Printf(
_(
"Pad missing net given by schematic (%s)." ),
232 drcItem->SetErrorMessage( msg );
233 drcItem->SetItems(
pad );
237 && !( pcb_netname.starts_with(
238 wxT(
"unconnected-" ) )
239 && pcb_netname.starts_with( sch_net.
GetNetName() ) ) )
242 msg.Printf(
_(
"Pad net (%s) doesn't match net given by schematic (%s)." ),
247 drcItem->SetErrorMessage( msg );
248 drcItem->SetItems(
pad );
253 for(
unsigned jj = 0; jj < component->
GetNetCount(); ++jj )
264 if( sch_net.
GetNetName().StartsWith( wxT(
"unconnected-" ) ) )
270 msg = wxString::Format( wxT(
"%s (%s)" ),
275 msg.Printf(
_(
"No pad found for pin %s in schematic." ), msg );
278 drcItem->SetErrorMessage( msg );
279 drcItem->SetItems( footprint );
299 drcItem->SetItems( footprint );
310 if( !
reportPhase(
_(
"Checking PCB to schematic parity..." ) ) )
317 REPORT_AUX( wxT(
"No netlist provided, skipping schematic parity tests." ) );
Information pertinent to a Pcbnew printed circuit board.
const FOOTPRINTS & Footprints() const
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Used to store the component pin name to net name (and pin function) associations stored in a netlist.
const wxString & GetNetName() const
const wxString & GetPinName() const
Store all of the related footprint information found in a netlist.
const COMPONENT_NET & GetNet(unsigned aIndex) const
const wxString & GetReference() const
const wxString & GetValue() const
const std::map< wxString, wxString > & GetProperties() const
const wxArrayString & GetFootprintFilters() const
const LIB_ID & GetFPID() const
unsigned GetNetCount() const
bool GetTestFootprints() const
bool IsErrorLimitExceeded(int error_code)
NETLIST * GetSchematicNetlist() const
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
DRC_TEST_PROVIDER_SCHEMATIC_PARITY()
virtual const wxString GetName() const override
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
void testNetlist(NETLIST &aNetlist)
virtual ~DRC_TEST_PROVIDER_SCHEMATIC_PARITY()=default
Represent a DRC "provider" which runs some DRC functions over a BOARD and spits out DRC_ITEM and posi...
virtual bool reportPhase(const wxString &aStageName)
virtual void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer, DRC_CUSTOM_MARKER_HANDLER *aCustomHandler=nullptr)
wxString GetUniStringLibId() const
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
unsigned GetCount() const
COMPONENT * GetComponentByReference(const wxString &aReference)
Return a COMPONENT by aReference.
COMPONENT * GetComponent(unsigned aIndex)
Return the COMPONENT at aIndex.
@ DRCE_DUPLICATE_FOOTPRINT
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
VECTOR2< int32_t > VECTOR2I