75 return x->
GetReference().CmpNoCase( y->GetReference() ) < 0;
78 auto footprints = std::set<FOOTPRINT*, decltype( compare )>( compare );
86 auto ins = footprints.insert( footprint );
88 if( !ins.second && !( footprint->GetAttributes() &
FP_BOARD_ONLY ) )
91 drcItem->SetItems( footprint, *ins.first );
98 for(
unsigned ii = 0; ii < aNetlist.
GetCount(); ii++ )
103 if( footprint ==
nullptr )
108 msg.Printf(
_(
"Missing footprint %s (%s)" ),
114 drcItem->SetErrorMessage( msg );
124 msg.Printf(
_(
"Value (%s) doesn't match symbol value (%s)" ),
129 drcItem->SetErrorMessage( msg );
130 drcItem->SetItems( footprint );
138 msg.Printf(
_(
"%s doesn't match footprint given by symbol (%s)" ),
143 drcItem->SetErrorMessage( msg );
144 drcItem->SetItems( footprint );
153 bool found = ( 0 == filtercount );
155 for(
size_t jj = 0; jj < filtercount && !found; jj++ )
159 if( filterLower.Find(
':' ) == wxNOT_FOUND )
160 found = fpNameLower.Matches( filterLower );
162 found = libIdLower.Matches( filterLower );
168 msg.Printf(
_(
"%s doesn't match symbol's footprint filters (%s)" ),
173 drcItem->SetErrorMessage( msg );
174 drcItem->SetItems( footprint );
184 msg.Printf(
_(
"'%s' settings differ" ),
_(
"Do not populate" ) );
187 drcItem->SetErrorMessage( drcItem->GetErrorMessage(
true ) + wxS(
": " ) + msg );
188 drcItem->SetItems( footprint );
192 if( ( component->
GetProperties().count(
"exclude_from_bom" ) > 0 )
197 msg.Printf(
_(
"'%s' settings differ" ),
_(
"Exclude from bill of materials" ) );
200 drcItem->SetErrorMessage( drcItem->GetErrorMessage(
true ) + wxS(
": " ) + msg );
201 drcItem->SetItems( footprint );
208 std::unordered_map<wxString, wxString> fpFieldsAsMap;
212 wxCHECK2( field,
continue );
214 if( field->IsReference() || field->IsValue() || field->IsComponentClass() )
217 fpFieldsAsMap[field->GetName()] = field->GetText();
221 nlohmann::ordered_map<wxString, wxString> compFields = component->
GetFields();
225 compFields.erase( wxT(
"Component Class" ) );
227 bool fieldsMatch =
true;
228 wxString mismatchDetail;
230 for(
const auto& [
name, value] : compFields )
232 auto it = fpFieldsAsMap.find(
name );
234 if( it == fpFieldsAsMap.end() )
237 mismatchDetail = wxString::Format(
_(
"Missing symbol field '%s' in footprint" ),
name );
241 if( it->second != value )
244 mismatchDetail = wxString::Format(
_(
"Field '%s' differs (PCB: '%s', Schematic: '%s')" ),
245 name, it->second, value );
250 if( !fieldsMatch && !mismatchDetail.IsEmpty() )
254 drcItem->SetErrorMessage( mismatchDetail );
255 drcItem->SetItems( footprint );
265 if( !
pad->CanHaveNumber() )
269 const wxString& pcb_netname =
pad->GetNetname();
271 if( !pcb_netname.IsEmpty() && sch_net.
GetPinName().IsEmpty() )
274 msg.Printf(
_(
"No corresponding pin found in schematic" ) );
277 drcItem->SetErrorMessage( msg );
278 drcItem->SetItems(
pad );
281 else if( pcb_netname.IsEmpty() && !sch_net.
GetNetName().IsEmpty() )
284 msg.Printf(
_(
"Pad missing net given by schematic (%s)" ),
288 drcItem->SetErrorMessage( msg );
289 drcItem->SetItems(
pad );
293 && !( pcb_netname.starts_with(
294 wxT(
"unconnected-" ) )
295 && pcb_netname.starts_with( sch_net.
GetNetName() ) ) )
298 msg.Printf(
_(
"Pad net (%s) doesn't match net given by schematic (%s)" ),
303 drcItem->SetErrorMessage( msg );
304 drcItem->SetItems(
pad );
309 for(
unsigned jj = 0; jj < component->
GetNetCount(); ++jj )
320 if( sch_net.
GetNetName().StartsWith( wxT(
"unconnected-" ) ) )
326 msg = wxString::Format( wxT(
"%s (%s)" ),
331 msg.Printf(
_(
"No pad found for pin %s in schematic" ), msg );
334 drcItem->SetErrorMessage( msg );
335 drcItem->SetItems( footprint );
355 drcItem->SetItems( footprint );