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" ) );
240 [](
const wxString& aText )
242 return aText.IsEmpty() || aText == wxS(
"~" );
245 bool fieldsMatch =
true;
246 wxString mismatchDetail;
248 for(
const auto& [
name, value] : compFields )
250 auto it = fpFieldsAsMap.find(
name );
252 if( it == fpFieldsAsMap.end() )
255 mismatchDetail = wxString::Format(
_(
"Missing symbol field '%s' in footprint" ),
name );
259 if(
name == datasheetName && isBlank( it->second ) && isBlank( value ) )
262 if( it->second != value )
265 mismatchDetail = wxString::Format(
_(
"Field '%s' differs (PCB: '%s', Schematic: '%s')" ),
266 name, it->second, value );
271 if( !fieldsMatch && !mismatchDetail.IsEmpty() )
275 drcItem->SetErrorMessage( mismatchDetail );
276 drcItem->SetItems( footprint );
286 if( !
pad->CanHaveNumber() )
290 const wxString& pcb_netname =
pad->GetNetname();
292 if( !pcb_netname.IsEmpty() && sch_net.
GetPinName().IsEmpty() )
295 msg.Printf(
_(
"No corresponding pin found in schematic" ) );
298 drcItem->SetErrorMessage( msg );
299 drcItem->SetItems(
pad );
302 else if( pcb_netname.IsEmpty() && !sch_net.
GetNetName().IsEmpty() )
305 msg.Printf(
_(
"Pad missing net given by schematic (%s)" ),
309 drcItem->SetErrorMessage( msg );
310 drcItem->SetItems(
pad );
314 && !( pcb_netname.starts_with(
315 wxT(
"unconnected-" ) )
316 && pcb_netname.starts_with( sch_net.
GetNetName() ) )
317 && !(
pad->IsNoConnectPad()
318 && pcb_netname.starts_with( sch_net.
GetNetName() + wxT(
"_" ) ) ))
321 msg.Printf(
_(
"Pad net (%s) doesn't match net given by schematic (%s)" ),
326 drcItem->SetErrorMessage( msg );
327 drcItem->SetItems(
pad );
332 for(
unsigned jj = 0; jj < component->
GetNetCount(); ++jj )
343 if( sch_net.
GetNetName().StartsWith( wxT(
"unconnected-" ) ) )
349 msg = wxString::Format( wxT(
"%s (%s)" ),
354 msg.Printf(
_(
"No pad found for pin %s in schematic" ), msg );
357 drcItem->SetErrorMessage( msg );
358 drcItem->SetItems( footprint );
378 drcItem->SetItems( footprint );