61 virtual bool Run()
override;
63 virtual const wxString
GetName()
const override
65 return wxT(
"schematic_parity" );
70 return wxT(
"Performs layout-vs-schematics integity check" );
84 return x->
GetReference().CmpNoCase( y->GetReference() ) < 0;
87 auto footprints = std::set<FOOTPRINT*, decltype( compare )>( compare );
95 auto ins = footprints.insert( footprint );
97 if( !ins.second && !( footprint->GetAttributes() &
FP_BOARD_ONLY ) )
100 drcItem->SetItems( footprint, *ins.first );
107 for(
unsigned ii = 0; ii < aNetlist.
GetCount(); ii++ )
112 if( footprint ==
nullptr )
117 msg.Printf(
_(
"Missing footprint %s (%s)" ),
123 drcItem->SetErrorMessage( msg );
133 msg.Printf(
_(
"Value (%s) doesn't match symbol value (%s)." ),
138 drcItem->SetErrorMessage( msg );
139 drcItem->SetItems( footprint );
147 msg.Printf(
_(
"%s doesn't match footprint given by symbol (%s)." ),
152 drcItem->SetErrorMessage( msg );
153 drcItem->SetItems( footprint );
161 bool found = ( 0 == filtercount );
163 for(
size_t jj = 0; jj < filtercount && !found; jj++ )
169 msg.Printf(
_(
"%s doesn't match symbol's footprint filters (%s)." ),
174 drcItem->SetErrorMessage( msg );
175 drcItem->SetItems( footprint );
185 msg.Printf(
_(
"'%s' settings differ." ),
_(
"Do not populate" ) );
188 drcItem->SetErrorMessage( drcItem->GetErrorMessage() + wxS(
": " ) + msg );
189 drcItem->SetItems( footprint );
193 if( ( component->
GetProperties().count(
"exclude_from_bom" ) > 0 )
198 msg.Printf(
_(
"'%s' settings differ." ),
_(
"Exclude from bill of materials" ) );
201 drcItem->SetErrorMessage( drcItem->GetErrorMessage() + wxS(
": " ) + msg );
202 drcItem->SetItems( footprint );
211 if( !
pad->CanHaveNumber() )
215 const wxString& pcb_netname =
pad->GetNetname();
217 if( !pcb_netname.IsEmpty() && sch_net.
GetPinName().IsEmpty() )
220 msg.Printf(
_(
"No corresponding pin found in schematic." ) );
223 drcItem->SetErrorMessage( msg );
224 drcItem->SetItems(
pad );
227 else if( pcb_netname.IsEmpty() && !sch_net.
GetNetName().IsEmpty() )
230 msg.Printf(
_(
"Pad missing net given by schematic (%s)." ),
234 drcItem->SetErrorMessage( msg );
235 drcItem->SetItems(
pad );
239 && !( pcb_netname.starts_with(
240 wxT(
"unconnected-" ) )
241 && pcb_netname.starts_with( sch_net.
GetNetName() ) ) )
244 msg.Printf(
_(
"Pad net (%s) doesn't match net given by schematic (%s)." ),
249 drcItem->SetErrorMessage( msg );
250 drcItem->SetItems(
pad );
255 for(
unsigned jj = 0; jj < component->
GetNetCount(); ++jj )
266 if( sch_net.
GetNetName().StartsWith( wxT(
"unconnected-" ) ) )
272 msg = wxString::Format( wxT(
"%s (%s)" ),
277 msg.Printf(
_(
"No pad found for pin %s in schematic." ), msg );
280 drcItem->SetErrorMessage( msg );
281 drcItem->SetItems( footprint );
301 drcItem->SetItems( footprint );
312 if( !
reportPhase(
_(
"Checking PCB to schematic parity..." ) ) )
319 reportAux( 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 const wxString GetDescription() const override
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
virtual ~DRC_TEST_PROVIDER_SCHEMATIC_PARITY()
void testNetlist(NETLIST &aNetlist)
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)
void reportAux(const wxString &aMsg)
virtual void reportRuleStatistics()
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