71 return x->
GetReference().CmpNoCase( y->GetReference() ) < 0;
74 auto footprints = std::set<FOOTPRINT*, decltype( compare )>( compare );
82 auto ins = footprints.insert( footprint );
84 if( !ins.second && !( footprint->GetAttributes() &
FP_BOARD_ONLY ) )
87 drcItem->SetItems( footprint, *ins.first );
94 for(
unsigned ii = 0; ii < aNetlist.
GetCount(); ii++ )
99 if( footprint ==
nullptr )
104 msg.Printf(
_(
"Missing footprint %s (%s)" ),
110 drcItem->SetErrorMessage( msg );
120 msg.Printf(
_(
"Value (%s) doesn't match symbol value (%s)" ),
125 drcItem->SetErrorMessage( msg );
126 drcItem->SetItems( footprint );
134 msg.Printf(
_(
"%s doesn't match footprint given by symbol (%s)" ),
139 drcItem->SetErrorMessage( msg );
140 drcItem->SetItems( footprint );
149 bool found = ( 0 == filtercount );
151 for(
size_t jj = 0; jj < filtercount && !found; jj++ )
155 if( filterLower.Find(
':' ) == wxNOT_FOUND )
156 found = fpNameLower.Matches( filterLower );
158 found = libIdLower.Matches( filterLower );
164 msg.Printf(
_(
"%s doesn't match symbol's footprint filters (%s)" ),
169 drcItem->SetErrorMessage( msg );
170 drcItem->SetItems( footprint );
180 msg.Printf(
_(
"'%s' settings differ" ),
_(
"Do not populate" ) );
183 drcItem->SetErrorMessage( drcItem->GetErrorMessage(
true ) + wxS(
": " ) + msg );
184 drcItem->SetItems( footprint );
188 if( ( component->
GetProperties().count(
"exclude_from_bom" ) > 0 )
193 msg.Printf(
_(
"'%s' settings differ" ),
_(
"Exclude from bill of materials" ) );
196 drcItem->SetErrorMessage( drcItem->GetErrorMessage(
true ) + wxS(
": " ) + msg );
197 drcItem->SetItems( footprint );
201 if( ( component->
GetProperties().count(
"exclude_from_sim" ) > 0 )
206 msg.Printf(
_(
"'%s' settings differ" ),
_(
"Exclude from simulation" ) );
209 drcItem->SetErrorMessage( drcItem->GetErrorMessage(
true ) + wxS(
": " ) + msg );
210 drcItem->SetItems( footprint );
217 std::unordered_map<wxString, wxString> fpFieldsAsMap;
221 wxCHECK2( field,
continue );
223 if( field->IsReference() || field->IsValue() || field->IsComponentClass() )
226 fpFieldsAsMap[field->GetName()] = field->GetText();
230 nlohmann::ordered_map<wxString, wxString> compFields = component->
GetFields();
234 compFields.erase( wxT(
"Component Class" ) );
236 bool fieldsMatch =
true;
237 wxString mismatchDetail;
239 for(
const auto& [
name, value] : compFields )
241 auto it = fpFieldsAsMap.find(
name );
243 if( it == fpFieldsAsMap.end() )
246 mismatchDetail = wxString::Format(
_(
"Missing symbol field '%s' in footprint" ),
name );
250 if( it->second != value )
253 mismatchDetail = wxString::Format(
_(
"Field '%s' differs (PCB: '%s', Schematic: '%s')" ),
254 name, it->second, value );
259 if( !fieldsMatch && !mismatchDetail.IsEmpty() )
263 drcItem->SetErrorMessage( mismatchDetail );
264 drcItem->SetItems( footprint );
274 if( !
pad->CanHaveNumber() )
278 const wxString& pcb_netname =
pad->GetNetname();
280 if( !pcb_netname.IsEmpty() && sch_net.
GetPinName().IsEmpty() )
283 msg.Printf(
_(
"No corresponding pin found in schematic" ) );
286 drcItem->SetErrorMessage( msg );
287 drcItem->SetItems(
pad );
290 else if( pcb_netname.IsEmpty() && !sch_net.
GetNetName().IsEmpty() )
293 msg.Printf(
_(
"Pad missing net given by schematic (%s)" ),
297 drcItem->SetErrorMessage( msg );
298 drcItem->SetItems(
pad );
302 && !( pcb_netname.starts_with(
303 wxT(
"unconnected-" ) )
304 && pcb_netname.starts_with( sch_net.
GetNetName() ) )
305 && !(
pad->IsNoConnectPad()
306 && pcb_netname.starts_with( sch_net.
GetNetName() + wxT(
"_" ) ) ))
309 msg.Printf(
_(
"Pad net (%s) doesn't match net given by schematic (%s)" ),
314 drcItem->SetErrorMessage( msg );
315 drcItem->SetItems(
pad );
320 for(
unsigned jj = 0; jj < component->
GetNetCount(); ++jj )
331 if( sch_net.
GetNetName().StartsWith( wxT(
"unconnected-" ) ) )
337 msg = wxString::Format( wxT(
"%s (%s)" ),
342 msg.Printf(
_(
"No pad found for pin %s in schematic" ), msg );
345 drcItem->SetErrorMessage( msg );
346 drcItem->SetItems( footprint );
366 drcItem->SetItems( footprint );