60 virtual bool Run()
override;
62 virtual const wxString
GetName()
const override
64 return wxT(
"schematic_parity" );
69 return wxT(
"Performs layout-vs-schematics integity check" );
83 return x->
GetReference().CmpNoCase( y->GetReference() ) < 0;
86 auto footprints = std::set<FOOTPRINT*, decltype( compare )>( compare );
94 auto ins = footprints.insert( footprint );
96 if( !ins.second && !( footprint->GetAttributes() &
FP_BOARD_ONLY ) )
99 drcItem->SetItems( footprint, *ins.first );
106 for(
unsigned ii = 0; ii < aNetlist.
GetCount(); ii++ )
111 if( footprint ==
nullptr )
116 msg.Printf(
_(
"Missing footprint %s (%s)" ),
122 drcItem->SetErrorMessage( msg );
132 msg.Printf(
_(
"Footprint %s value (%s) doesn't match symbol value (%s)." ),
136 std::shared_ptr<DRC_ITEM> drcItem =
138 drcItem->SetErrorMessage( msg );
139 drcItem->SetItems( footprint );
147 msg.Printf(
_(
"%s footprint (%s) doesn't match that given by symbol (%s)." ),
151 std::shared_ptr<DRC_ITEM> drcItem =
153 drcItem->SetErrorMessage( msg );
154 drcItem->SetItems( footprint );
163 msg.Printf(
_(
"'%s' settings differ." ),
_(
"Do not populate" ) );
166 drcItem->SetErrorMessage( drcItem->GetErrorMessage() + wxS(
": " ) + msg );
167 drcItem->SetItems( footprint );
171 if( ( component->
GetProperties().count(
"exclude_from_bom" ) > 0 )
176 msg.Printf(
_(
"'%s' settings differ." ),
_(
"Exclude from bill of materials" ) );
179 drcItem->SetErrorMessage( drcItem->GetErrorMessage() + wxS(
": " ) + msg );
180 drcItem->SetItems( footprint );
189 if( !
pad->CanHaveNumber() )
193 const wxString& pcb_netname =
pad->GetNetname();
195 if( !pcb_netname.IsEmpty() && sch_net.
GetPinName().IsEmpty() )
198 msg.Printf(
_(
"No corresponding pin found in schematic." ) );
201 drcItem->SetErrorMessage( msg );
202 drcItem->SetItems(
pad );
205 else if( pcb_netname.IsEmpty() && !sch_net.
GetNetName().IsEmpty() )
208 msg.Printf(
_(
"Pad missing net given by schematic (%s)." ),
212 drcItem->SetErrorMessage( msg );
213 drcItem->SetItems(
pad );
217 && !( pcb_netname.starts_with(
218 wxT(
"unconnected-" ) )
219 && pcb_netname.starts_with( sch_net.
GetNetName() ) ) )
222 msg.Printf(
_(
"Pad net (%s) doesn't match net given by schematic (%s)." ),
227 drcItem->SetErrorMessage( msg );
228 drcItem->SetItems(
pad );
233 for(
unsigned jj = 0; jj < component->
GetNetCount(); ++jj )
244 if( sch_net.
GetNetName().StartsWith( wxT(
"unconnected-" ) ) )
250 msg = wxString::Format( wxT(
"%s (%s)" ),
255 msg.Printf(
_(
"No pad found for pin %s in schematic." ), msg );
258 drcItem->SetErrorMessage( msg );
259 drcItem->SetItems( footprint );
279 drcItem->SetItems( footprint );
290 if( !
reportPhase(
_(
"Checking PCB to schematic parity..." ) ) )
297 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 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
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
@ DRCE_SCHEMATIC_PARITY_ISSUES
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy