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 );
204 std::unordered_map<wxString, wxString> fpFieldsAsMap;
208 wxCHECK2( field,
continue );
210 if( field->IsReference() || field->IsValue() || field->IsComponentClass() )
213 fpFieldsAsMap[field->GetName()] = field->GetText();
217 nlohmann::ordered_map<wxString, wxString> compFields = component->
GetFields();
221 compFields.erase( wxT(
"Component Class" ) );
223 bool fieldsMatch =
true;
224 wxString mismatchDetail;
226 for(
const auto& [
name, value] : compFields )
228 auto it = fpFieldsAsMap.find(
name );
230 if( it == fpFieldsAsMap.end() )
233 mismatchDetail = wxString::Format(
_(
"Missing symbol field '%s' in footprint" ),
name );
237 if( it->second != value )
240 mismatchDetail = wxString::Format(
_(
"Field '%s' differs (PCB: '%s', Schematic: '%s')" ),
241 name, it->second, value );
246 if( !fieldsMatch && !mismatchDetail.IsEmpty() )
250 drcItem->SetErrorMessage( mismatchDetail );
251 drcItem->SetItems( footprint );
261 if( !
pad->CanHaveNumber() )
265 const wxString& pcb_netname =
pad->GetNetname();
267 if( !pcb_netname.IsEmpty() && sch_net.
GetPinName().IsEmpty() )
270 msg.Printf(
_(
"No corresponding pin found in schematic" ) );
273 drcItem->SetErrorMessage( msg );
274 drcItem->SetItems(
pad );
277 else if( pcb_netname.IsEmpty() && !sch_net.
GetNetName().IsEmpty() )
280 msg.Printf(
_(
"Pad missing net given by schematic (%s)" ),
284 drcItem->SetErrorMessage( msg );
285 drcItem->SetItems(
pad );
289 && !( pcb_netname.starts_with(
290 wxT(
"unconnected-" ) )
291 && pcb_netname.starts_with( sch_net.
GetNetName() ) )
292 && !(
pad->IsNoConnectPad()
293 && pcb_netname.starts_with( sch_net.
GetNetName() + wxT(
"_" ) ) ))
296 msg.Printf(
_(
"Pad net (%s) doesn't match net given by schematic (%s)" ),
301 drcItem->SetErrorMessage( msg );
302 drcItem->SetItems(
pad );
307 for(
unsigned jj = 0; jj < component->
GetNetCount(); ++jj )
318 if( sch_net.
GetNetName().StartsWith( wxT(
"unconnected-" ) ) )
324 msg = wxString::Format( wxT(
"%s (%s)" ),
329 msg.Printf(
_(
"No pad found for pin %s in schematic" ), msg );
332 drcItem->SetErrorMessage( msg );
333 drcItem->SetItems( footprint );
353 drcItem->SetItems( footprint );