74 return x->
GetReference().CmpNoCase( y->GetReference() ) < 0;
77 auto footprints = std::set<FOOTPRINT*, decltype( compare )>( compare );
85 auto ins = footprints.insert( footprint );
87 if( !ins.second && !( footprint->GetAttributes() &
FP_BOARD_ONLY ) )
90 drcItem->SetItems( footprint, *ins.first );
97 for(
unsigned ii = 0; ii < aNetlist.
GetCount(); ii++ )
102 if( footprint ==
nullptr )
107 msg.Printf(
_(
"Missing footprint %s (%s)" ),
113 drcItem->SetErrorMessage( msg );
123 msg.Printf(
_(
"Value (%s) doesn't match symbol value (%s)" ),
128 drcItem->SetErrorMessage( msg );
129 drcItem->SetItems( footprint );
137 msg.Printf(
_(
"%s doesn't match footprint given by symbol (%s)" ),
142 drcItem->SetErrorMessage( msg );
143 drcItem->SetItems( footprint );
152 bool found = ( 0 == filtercount );
154 for(
size_t jj = 0; jj < filtercount && !found; jj++ )
158 if( filterLower.Find(
':' ) == wxNOT_FOUND )
159 found = fpNameLower.Matches( filterLower );
161 found = libIdLower.Matches( filterLower );
167 msg.Printf(
_(
"%s doesn't match symbol's footprint filters (%s)" ),
172 drcItem->SetErrorMessage( msg );
173 drcItem->SetItems( footprint );
183 msg.Printf(
_(
"'%s' settings differ" ),
_(
"Do not populate" ) );
186 drcItem->SetErrorMessage( drcItem->GetErrorMessage(
true ) + wxS(
": " ) + msg );
187 drcItem->SetItems( footprint );
191 if( ( component->
GetProperties().count(
"exclude_from_bom" ) > 0 )
196 msg.Printf(
_(
"'%s' settings differ" ),
_(
"Exclude from bill of materials" ) );
199 drcItem->SetErrorMessage( drcItem->GetErrorMessage(
true ) + wxS(
": " ) + msg );
200 drcItem->SetItems( footprint );
207 std::unordered_map<wxString, wxString> fpFieldsAsMap;
211 if( field->IsReference() || field->IsValue() || field->IsComponentClass() )
214 fpFieldsAsMap[field->GetName()] = field->GetText();
218 nlohmann::ordered_map<wxString, wxString> compFields = component->
GetFields();
222 compFields.erase( wxT(
"Component Class" ) );
224 bool fieldsMatch =
true;
225 wxString mismatchDetail;
227 for(
const auto& [
name, value] : compFields )
229 auto it = fpFieldsAsMap.find(
name );
231 if( it == fpFieldsAsMap.end() )
234 mismatchDetail = wxString::Format(
_(
"Missing symbol field '%s' in footprint" ),
name );
238 if( it->second != value )
241 mismatchDetail = wxString::Format(
_(
"Field '%s' differs (PCB: '%s', Schematic: '%s')" ),
242 name, it->second, value );
247 if( !fieldsMatch && !mismatchDetail.IsEmpty() )
251 drcItem->SetErrorMessage( mismatchDetail );
252 drcItem->SetItems( footprint );
262 if( !
pad->CanHaveNumber() )
266 const wxString& pcb_netname =
pad->GetNetname();
268 if( !pcb_netname.IsEmpty() && sch_net.
GetPinName().IsEmpty() )
271 msg.Printf(
_(
"No corresponding pin found in schematic" ) );
274 drcItem->SetErrorMessage( msg );
275 drcItem->SetItems(
pad );
278 else if( pcb_netname.IsEmpty() && !sch_net.
GetNetName().IsEmpty() )
281 msg.Printf(
_(
"Pad missing net given by schematic (%s)" ),
285 drcItem->SetErrorMessage( msg );
286 drcItem->SetItems(
pad );
290 && !( pcb_netname.starts_with(
291 wxT(
"unconnected-" ) )
292 && pcb_netname.starts_with( sch_net.
GetNetName() ) ) )
295 msg.Printf(
_(
"Pad net (%s) doesn't match net given by schematic (%s)" ),
300 drcItem->SetErrorMessage( msg );
301 drcItem->SetItems(
pad );
306 for(
unsigned jj = 0; jj < component->
GetNetCount(); ++jj )
317 if( sch_net.
GetNetName().StartsWith( wxT(
"unconnected-" ) ) )
323 msg = wxString::Format( wxT(
"%s (%s)" ),
328 msg.Printf(
_(
"No pad found for pin %s in schematic" ), msg );
331 drcItem->SetErrorMessage( msg );
332 drcItem->SetItems( footprint );
352 drcItem->SetItems( footprint );