25#include <magic_enum.hpp>
29#include <unordered_set>
34#include <wx/tokenzr.h>
77#include <google/protobuf/any.pb.h>
78#include <api/board/board_types.pb.h>
100 void setter(
void* obj, wxAny& v )
override
104 if( !v.GetAs( &value ) )
110 wxString variantName;
115 if( !variantName.IsEmpty() )
126 footprint->
Add( newField );
134 wxAny
getter(
const void* obj )
const override
142 wxString variantName;
149 if( !variantName.IsEmpty() )
154 return wxAny(
text );
254 std::map<EDA_ITEM*, EDA_ITEM*> ptrMap;
259 if( field->IsMandatory() )
261 PCB_FIELD* existingField = GetField( field->GetId() );
262 ptrMap[field] = existingField;
263 *existingField = *field;
266 existingField->SetUuidDirect( field->m_Uuid );
267 existingField->SetParent( this );
271 PCB_FIELD* newField = static_cast<PCB_FIELD*>( field->Clone() );
272 ptrMap[field] = newField;
278 for(
PAD*
pad : aFootprint.Pads() )
280 PAD* newPad = static_cast<PAD*>( pad->Clone() );
281 ptrMap[ pad ] = newPad;
282 Add( newPad, ADD_MODE::APPEND );
286 for(
ZONE* zone : aFootprint.Zones() )
288 ZONE* newZone = static_cast<ZONE*>( zone->Clone() );
289 ptrMap[ zone ] = newZone;
290 Add( newZone, ADD_MODE::APPEND );
296 newZone->SetNetCode( -1 );
300 for(
BOARD_ITEM* item : aFootprint.GraphicalItems() )
302 BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
303 ptrMap[ item ] = newItem;
304 Add( newItem, ADD_MODE::APPEND );
310 PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
311 ptrMap[ group ] = newGroup;
312 Add( newGroup, ADD_MODE::APPEND );
320 for(
PCB_POINT* point : aFootprint.Points() )
322 PCB_POINT* newPoint = static_cast<PCB_POINT*>( point->Clone() );
323 ptrMap[ point ] = newPoint;
324 Add( newPoint, ADD_MODE::APPEND );
330 PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( ptrMap[ group ] );
332 newGroup->GetItems().clear();
334 for( EDA_ITEM* member : group->GetItems() )
336 if( ptrMap.count( member ) )
337 newGroup->AddItem( ptrMap[ member ] );
351 *
this = std::move( aFootprint );
399 std::vector<PROPERTY_BASE*> props;
403 auto getOrCreate = [&](
const wxString& aName )
409 auto prop = std::make_unique<PCB_FOOTPRINT_FIELD_PROPERTY>( aName );
413 return it->second.get();
418 if( !field->IsMandatory() )
421 if( !isFPedit && field->IsPrivate() )
424 const wxString&
name = field->GetUntranslatedName();
429 props.push_back( getOrCreate(
name ) );
432 std::vector<PCB_FIELD*> userFields;
436 if( field->IsMandatory() || ( !isFPedit && field->IsPrivate() ) )
439 userFields.push_back( field );
442 std::ranges::sort( userFields,
450 const wxString&
name = field->GetUntranslatedName();
451 props.push_back( getOrCreate(
name ) );
455 props.push_back( prop );
464 types::FootprintInstance footprint;
466 footprint.mutable_id()->set_value(
m_Uuid.AsStdString() );
467 footprint.mutable_position()->set_x_nm(
GetPosition().x );
468 footprint.mutable_position()->set_y_nm(
GetPosition().y );
471 footprint.set_locked(
IsLocked() ? kiapi::common::types::LockedState::LS_LOCKED
472 : kiapi::common::types::LockedState::LS_UNLOCKED );
475 footprint.mutable_parent()->set_value(
board->m_Uuid.AsStdString() );
482 types::FootprintAttributes* attrs = footprint.mutable_attributes();
489 attrs->set_do_not_populate(
IsDNP() );
493 attrs->set_mounting_style( types::FootprintMountingStyle::FMS_THROUGH_HOLE );
495 attrs->set_mounting_style( types::FootprintMountingStyle::FMS_SMD );
497 attrs->set_mounting_style( types::FootprintMountingStyle::FMS_UNSPECIFIED );
501 types::FootprintDesignRuleOverrides* overrides = footprint.mutable_overrides();
515 overrides->set_zone_connection(
520 footprint.set_symbol_sheet_name(
m_sheetname.ToUTF8() );
521 footprint.set_symbol_sheet_filename(
m_sheetfile.ToUTF8() );
522 footprint.set_symbol_footprint_filters(
m_filters.ToUTF8() );
528 for(
const auto& [variantName, variant] :
m_variants )
530 types::FootprintVariant* variantMsg = footprint.add_variants();
531 variantMsg->set_name( variantName.ToUTF8() );
532 variantMsg->set_do_not_populate( variant.GetDNP() );
533 variantMsg->set_exclude_from_bill_of_materials( variant.GetExcludedFromBOM() );
534 variantMsg->set_exclude_from_position_files( variant.GetExcludedFromPosFiles() );
535 variantMsg->set_exclude_from_simulation( variant.GetExcludedFromSim() );
537 for(
const auto& [fieldName, fieldValue] : variant.GetFields() )
539 variantMsg->mutable_fields()->insert( { std::string( fieldName.ToUTF8() ),
540 std::string( fieldValue.ToUTF8() ) } );
544 aContainer.PackFrom( footprint );
555 aOutput->mutable_attributes()->set_keywords(
GetKeywords().ToUTF8() );
561 types::NetTieDefinition* netTie = aOutput->add_net_ties();
562 wxStringTokenizer tokenizer(
group,
", \t\r\n", wxTOKEN_STRTOK );
564 while( tokenizer.HasMoreTokens() )
565 netTie->add_pad_number( tokenizer.GetNextToken().ToUTF8() );
571 types::JumperSettings* jumpers = aOutput->mutable_jumpers();
576 types::JumperGroup* jumperGroup = jumpers->add_groups();
578 for(
const wxString& padName :
group.GetNames() )
579 jumperGroup->add_pad_names( padName.ToUTF8() );
584 if( item->IsMandatory() )
587 google::protobuf::Any* itemMsg = aOutput->add_items();
588 item->Serialize( *itemMsg );
591 for(
const PAD* item :
Pads() )
593 google::protobuf::Any* itemMsg = aOutput->add_items();
594 item->Serialize( *itemMsg );
599 google::protobuf::Any* itemMsg = aOutput->add_items();
600 item->Serialize( *itemMsg );
605 google::protobuf::Any* itemMsg = aOutput->add_items();
606 item->Serialize( *itemMsg );
611 google::protobuf::Any* itemMsg = aOutput->add_items();
612 item->Serialize( *itemMsg );
617 google::protobuf::Any* itemMsg = aOutput->add_items();
618 types::Footprint3DModel modelMsg;
619 modelMsg.set_filename(
model.m_Filename.ToUTF8() );
623 modelMsg.set_visible(
model.m_Show );
624 modelMsg.set_opacity(
model.m_Opacity );
625 itemMsg->PackFrom( modelMsg );
643 for(
const types::NetTieDefinition& netTieMsg : aInput.net_ties() )
647 for(
const std::string&
pad : netTieMsg.pad_number() )
648 group.Append( wxString::Format( wxT(
"%s, " ),
pad ) );
657 jumperGroups.
Clear();
659 for(
const types::JumperGroup& groupMsg : aInput.jumpers().groups() )
661 std::set<wxString> padNames;
663 for(
const std::string& padName : groupMsg.pad_names() )
664 padNames.insert( wxString::FromUTF8( padName ) );
666 jumperGroups.
Add( std::move( padNames ) );
671 for(
int layerMsg : aInput.private_layers() )
676 privateLayers.
set( layer );
684 if( !field->IsMandatory() )
690 board->UncacheChildrenById(
this );
700 for(
const google::protobuf::Any& itemMsg : aInput.items() )
708 if( itemMsg.type_url() ==
"type.googleapis.com/kiapi.board.types.Footprint3DModel" )
710 types::Footprint3DModel modelMsg;
712 if( !itemMsg.UnpackTo( &modelMsg ) )
717 model.m_Filename = wxString::FromUTF8( modelMsg.filename() );
718 model.m_Show = modelMsg.visible();
719 model.m_Opacity = modelMsg.opacity();
728 wxLogTrace(
traceApi, wxString::Format( wxS(
"Attempting to unpack unknown type %s "
729 "from footprint message, skipping" ),
730 itemMsg.type_url() ) );
738 if( item && item->Deserialize( itemMsg ) )
749 types::FootprintInstance footprint;
751 if( !aContainer.UnpackTo( &footprint ) )
758 SetLocked( footprint.locked() == kiapi::common::types::LockedState::LS_LOCKED );
760 google::protobuf::Any buf;
761 types::Field mandatoryField;
763 if( footprint.has_reference_field() )
765 mandatoryField = footprint.reference_field();
767 buf.PackFrom( mandatoryField );
771 if( footprint.has_value_field() )
773 mandatoryField = footprint.value_field();
775 buf.PackFrom( mandatoryField );
779 if( footprint.has_datasheet_field() )
781 mandatoryField = footprint.datasheet_field();
783 buf.PackFrom( mandatoryField );
787 if( footprint.has_description_field() )
789 mandatoryField = footprint.description_field();
791 buf.PackFrom( mandatoryField );
797 switch( footprint.attributes().mounting_style() )
799 case types::FootprintMountingStyle::FMS_THROUGH_HOLE:
803 case types::FootprintMountingStyle::FMS_SMD:
811 SetBoardOnly( footprint.attributes().not_in_schematic() );
816 SetDNP( footprint.attributes().do_not_populate() );
822 const types::FootprintDesignRuleOverrides& overrides = footprint.overrides();
824 if( overrides.has_copper_clearance() )
829 if( overrides.has_solder_mask() && overrides.solder_mask().has_solder_mask_margin() )
834 if( overrides.has_solder_paste() )
836 const types::SolderPasteOverrides& pasteSettings = overrides.solder_paste();
838 if( pasteSettings.has_solder_paste_margin() )
843 if( pasteSettings.has_solder_paste_margin_ratio() )
852 m_sheetname = wxString::FromUTF8( footprint.symbol_sheet_name() );
853 m_sheetfile = wxString::FromUTF8( footprint.symbol_sheet_filename() );
854 m_filters = wxString::FromUTF8( footprint.symbol_footprint_filters() );
863 for(
const types::FootprintVariant& variantMsg : footprint.variants() )
865 wxString variantName = wxString::FromUTF8( variantMsg.name() );
871 variant.
SetName( variantName );
872 variant.
SetDNP( variantMsg.do_not_populate() );
877 for(
const auto& [fieldName, fieldValue] : variantMsg.fields() )
878 variant.
SetFieldValue( wxString::FromUTF8( fieldName ), wxString::FromUTF8( fieldValue ) );
889 if( field->GetId() == aFieldType )
904 if( field->GetId() == aFieldType )
914 return GetField( aFieldName ) !=
nullptr;
922 if( field->GetName() == aFieldName )
938 if( !field->IsVisible() || field->GetText().IsEmpty() )
942 aVector.push_back( field );
945 std::sort( aVector.begin(), aVector.end(),
948 return lhs->GetOrdinal() < rhs->GetOrdinal();
954 std::vector<PCB_FIELD*>& aDetached )
956 std::deque<PCB_FIELD*> updatedFieldSet;
957 std::vector<wxString> assignedFields;
964 *existingField = sourceField;
967 updatedFieldSet.push_back( existingField );
968 assignedFields.push_back( sourceField.GetName() );
973 aAdded.push_back( destField );
974 updatedFieldSet.push_back( destField );
981 if( field.IsMandatory() )
982 assignOrAdd(
const_cast<PCB_FIELD*
>( std::as_const( *this ).GetField( field.GetId() ) ), field );
984 assignOrAdd(
GetField( field.GetName() ), field );
989 if( !field->IsMandatory() && !
alg::contains( assignedFields, field->GetName() ) )
990 aDetached.push_back( field );
1001 m_fields = std::move( updatedFieldSet );
1012 ordinal = std::max( ordinal, field->GetOrdinal() + 1 );
1019 bool aStyleShapes,
bool aStyleDimensions,
bool aStyleBarcodes )
1024 field->StyleFromSettings(
board.GetDesignSettings(),
true );
1029 switch( item->Type() )
1034 item->StyleFromSettings(
board.GetDesignSettings(),
true );
1039 if( aStyleShapes && !item->IsOnCopperLayer() )
1040 item->StyleFromSettings(
board.GetDesignSettings(),
true );
1049 if( aStyleDimensions )
1050 item->StyleFromSettings(
board.GetDesignSettings(),
true );
1055 if( aStyleBarcodes )
1056 item->StyleFromSettings(
board.GetDesignSettings(),
true );
1070 std::vector< BOARD_ITEM* > item_list;
1073 item_list.push_back( field );
1076 item_list.push_back(
pad );
1079 item_list.push_back( gr_item );
1084 item_list.push_back(
group );
1088 item_list.push_back( zone );
1092 item_list.push_back( point );
1094 bool changed =
false;
1100 item->ResetUuidDirect();
1137 board->UncacheChildrenById(
this );
1145 for(
PCB_FIELD* field : aOther.m_fields )
1148 aOther.m_fields.clear();
1156 for(
PAD*
pad : aOther.Pads() )
1159 aOther.Pads().clear();
1167 for(
ZONE* item : aOther.Zones() )
1175 item->SetNetCode( -1 );
1178 aOther.Zones().clear();
1186 for(
BOARD_ITEM* item : aOther.GraphicalItems() )
1189 aOther.GraphicalItems().clear();
1200 aOther.Groups().clear();
1211 aOther.Constraints().clear();
1219 for(
PCB_POINT* point : aOther.Points() )
1222 aOther.Points().clear();
1236 aOther.m_componentClassCacheProxy->GetStaticComponentClass() );
1239 aOther.m_fields.clear();
1240 aOther.Pads().clear();
1241 aOther.Zones().clear();
1242 aOther.GraphicalItems().clear();
1243 aOther.m_initial_comments =
nullptr;
1277 board->UncacheChildrenById(
this );
1279 std::map<EDA_ITEM*, EDA_ITEM*> ptrMap;
1290 ptrMap[field] = newField;
1303 ptrMap[
pad ] = newPad;
1315 ZONE* newZone =
static_cast<ZONE*
>( zone->Clone() );
1316 ptrMap[ zone ] = newZone;
1335 ptrMap[ item ] = newItem;
1351 newGroup->
AddItem( ptrMap[ member ] );
1375 ptrMap[ point ] = newItem;
1406 *
this = *
static_cast<const FOOTPRINT*
>( aOther );
1433 if( aSheetPath.empty() )
1437 return m_path.size() >= aSheetPath.size() - 1
1438 && std::equal( aSheetPath.begin() + 1, aSheetPath.end(),
m_path.begin() );
1444 aVars->push_back( wxT(
"REFERENCE" ) );
1445 aVars->push_back( wxT(
"VALUE" ) );
1446 aVars->push_back( wxT(
"LAYER" ) );
1447 aVars->push_back( wxT(
"FOOTPRINT_LIBRARY" ) );
1448 aVars->push_back( wxT(
"FOOTPRINT_NAME" ) );
1449 aVars->push_back( wxT(
"SHORT_NET_NAME(<pad_number>)" ) );
1450 aVars->push_back( wxT(
"NET_NAME(<pad_number>)" ) );
1451 aVars->push_back( wxT(
"NET_CLASS(<pad_number>)" ) );
1452 aVars->push_back( wxT(
"PIN_NAME(<pad_number>)" ) );
1453 aVars->push_back( wxT(
"EXCLUDE_FROM_BOM" ) );
1454 aVars->push_back( wxT(
"EXCLUDE_FROM_BOARD" ) );
1455 aVars->push_back( wxT(
"EXCLUDE_FROM_SIM" ) );
1456 aVars->push_back( wxT(
"EXCLUDE_FROM_POS_FILES" ) );
1457 aVars->push_back( wxT(
"DNP" ) );
1477 wxString variant = aVariantName;
1479 if( token->IsSameAs( wxT(
"REFERENCE" ) ) )
1482 *token = reference->GetShownText( variant,
INTERNAL, aDepth + 1 );
1488 else if( token->IsSameAs( wxT(
"VALUE" ) ) )
1491 *token = value->GetShownText( variant,
INTERNAL, aDepth + 1 );
1497 else if( token->IsSameAs( wxT(
"LAYER" ) ) )
1502 else if( token->IsSameAs( wxT(
"FOOTPRINT_LIBRARY" ) ) )
1504 *token =
m_fpid.GetUniStringLibNickname();
1507 else if( token->IsSameAs( wxT(
"FOOTPRINT_NAME" ) ) )
1509 *token =
m_fpid.GetUniStringLibItemName();
1512 else if( token->StartsWith( wxT(
"SHORT_NET_NAME(" ) )
1513 || token->StartsWith( wxT(
"NET_NAME(" ) )
1514 || token->StartsWith( wxT(
"NET_CLASS(" ) )
1515 || token->StartsWith( wxT(
"PIN_NAME(" ) ) )
1517 wxString padNumber = token->AfterFirst(
'(' );
1518 padNumber = padNumber.BeforeLast(
')' );
1522 if(
pad->GetNumber() == padNumber )
1524 if( token->StartsWith( wxT(
"SHORT_NET_NAME" ) ) )
1525 *token =
pad->GetShortNetname();
1526 else if( token->StartsWith( wxT(
"NET_NAME" ) ) )
1527 *token =
pad->GetNetname();
1528 else if( token->StartsWith( wxT(
"NET_CLASS" ) ) )
1529 *token =
pad->GetNetClassName();
1531 *token =
pad->GetPinFunction();
1537 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOM" ) ) )
1539 *token = wxEmptyString;
1542 *token = wxS(
"Excluded from BOM" );
1546 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_POS_FILES" ) ) )
1548 *token = wxEmptyString;
1551 *token = wxS(
"Excluded from position files" );
1555 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOARD" ) ) )
1558 *token = wxEmptyString;
1561 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_SIM" ) ) )
1563 *token = wxEmptyString;
1566 *token = wxS(
"Excluded from simulation" );
1570 else if( token->IsSameAs( wxT(
"DNP" ) ) )
1572 *token = wxEmptyString;
1575 *token = wxS(
"DNP" );
1581 *token = field->GetShownText( variant,
INTERNAL, aDepth + 1 );
1585 else if( token->StartsWith( wxS(
"PROPERTY." ) ) )
1588 wxString propertyName = token->AfterFirst(
'.' );
1589 propertyName.Replace( wxS(
"_" ), wxS(
" " ) );
1595 if( !property || property->IsHiddenFromPropertiesManager() )
1625 return it !=
m_variants.end() ? &it->second :
nullptr;
1633 return it !=
m_variants.end() ? &it->second :
nullptr;
1639 if( aVariant.
GetName().IsEmpty()
1651 it->second = std::move( updated );
1661 if( aVariantName.IsEmpty()
1664 wxASSERT_MSG(
false, wxT(
"Variant name cannot be empty or default." ) );
1679 auto inserted =
m_variants.emplace( aVariantName, std::move( variant ) );
1680 return &inserted.first->second;
1692 if( aNewName.IsEmpty()
1703 auto existingIt =
m_variants.find( aNewName );
1705 if( existingIt !=
m_variants.end() && existingIt != it )
1708 if( it->first == aNewName )
1714 m_variants.emplace( aNewName, std::move( variant ) );
1733 return variant->
GetDNP();
1801 return field->GetText();
1825 switch( aBoardItem->
Type() )
1851 m_pads.push_back(
static_cast<PAD*
>( aBoardItem ) );
1853 m_pads.push_front(
static_cast<PAD*
>( aBoardItem ) );
1859 m_zones.push_back(
static_cast<ZONE*
>( aBoardItem ) );
1882 wxFAIL_MSG( wxT(
"FOOTPRINT::Add(): Markers go at the board level, even in the footprint editor" ) );
1886 wxFAIL_MSG( wxT(
"FOOTPRINT::Add(): Nested footprints not supported" ) );
1898 wxFAIL_MSG( wxString::Format( wxT(
"FOOTPRINT::Add(): BOARD_ITEM type (%d) not handled" ),
1899 aBoardItem->
Type() ) );
1911 board->CacheItemSubtreeById( aBoardItem );
1915 board->noteDrillModelChange( aBoardItem );
1924 switch( aBoardItem->
Type() )
1929 if( *it == aBoardItem )
1931 const wxString fieldName = ( *it )->GetUntranslatedName();
1935 for(
auto& [variantName, footprintVariant] :
m_variants )
1936 footprintVariant.RemoveFieldValue( fieldName );
1957 if( *it == aBoardItem )
1967 for(
auto it =
m_pads.begin(); it !=
m_pads.end(); ++it )
1969 if( *it ==
static_cast<PAD*
>( aBoardItem ) )
1981 if( *it ==
static_cast<ZONE*
>( aBoardItem ) )
2005 if( *it ==
static_cast<PCB_GROUP*
>( aBoardItem ) )
2015 wxFAIL_MSG( wxT(
"FOOTPRINT::Remove(): Markers go at the board level, even in the footprint editor" ) );
2019 wxFAIL_MSG( wxT(
"FOOTPRINT::Remove(): Nested footprints not supported" ) );
2025 if( *it ==
static_cast<PCB_POINT*
>( aBoardItem ) )
2035 wxFAIL_MSG( wxString::Format( wxT(
"FOOTPRINT::Remove() needs work: BOARD_ITEM type (%d) not handled" ),
2036 aBoardItem->
Type() ) );
2042 if(
board->IsItemIndexedById(
this ) )
2044 board->UncacheItemSubtreeById( aBoardItem );
2045 board->noteDrillModelChange( aBoardItem );
2048 board->IncrementTimeStamp();
2074 switch(
pad->GetProperty() )
2092 switch(
pad->GetAttribute() )
2099 if(
pad->IsOnCopperLayer() )
2127 return _(
"Through hole" );
2129 return _(
"Unspecified" );
2165 wxStringTokenizer keywordTokenizer(
GetKeywords(), wxS(
" \t\r\n" ), wxTOKEN_STRTOK );
2167 while( keywordTokenizer.HasMoreTokens() )
2188 if(
dummy.IsFlipped() )
2192 bbox.
Merge(
pad->GetBoundingBox() );
2242 std::vector<PCB_TEXT*> texts;
2243 bool isFPEdit =
board &&
board->IsFootprintHolder();
2264 texts.push_back(
static_cast<PCB_TEXT*
>( item ) );
2282 bbox.
Merge( item->GetBoundingBox() );
2288 if( field->IsReference() || field->IsValue() )
2291 texts.push_back( field );
2295 bbox.
Merge(
pad->GetBoundingBox() );
2298 bbox.
Merge( zone->GetBoundingBox() );
2301 bbox.
Merge( point->GetBoundingBox() );
2306 if( aIncludeText || noDrawItems )
2329 bool valueLayerIsVisible =
true;
2330 bool refLayerIsVisible =
true;
2340 valueLayerIsVisible =
board->IsLayerVisible( value->
GetLayer() )
2347 refLayerIsVisible =
board->IsLayerVisible( reference->
GetLayer() )
2354 if( value && ( ( value->
IsVisible() && valueLayerIsVisible ) || noDrawItems ) )
2357 if( reference && ( ( reference->
IsVisible() && refLayerIsVisible ) || noDrawItems ) )
2368 if( aIncludeText || noDrawItems )
2386 std::vector<PCB_TEXT*> texts;
2388 bool isFPEdit =
board &&
board->IsFootprintHolder();
2398 if( ( aLayers & item->GetLayerSet() ).none() )
2406 bbox.
Merge( item->GetBoundingBox() );
2411 if( ( aLayers &
pad->GetLayerSet() ).none() )
2414 bbox.
Merge(
pad->GetBoundingBox() );
2419 if( ( aLayers & zone->GetLayerSet() ).none() )
2422 bbox.
Merge( zone->GetBoundingBox() );
2430 if( ( aLayers & point->GetLayerSet() ).none() )
2433 bbox.
Merge( point->GetBoundingBox() );
2443 bool isFPEdit =
board &&
board->IsFootprintHolder();
2468 pad->Padstack().ForEachUniqueLayer(
2482 const SHAPE_POLY_SET& layerPoly = *zone->GetFilledPolysList( layer );
2498 const int halfsize =
pcbIUScale.mmToIU( 1.0 );
2509 std::vector<VECTOR2I> convex_hull;
2521 for(
const VECTOR2I& pt : convex_hull )
2535 bool isFPEdit =
board &&
board->IsFootprintHolder();
2545 if( item->IsOnLayer( aLayer ) )
2556 if(
pad->IsOnLayer( aLayer ) )
2562 if( zone->GetIsRuleArea() )
2565 if( zone->IsOnLayer( aLayer ) )
2567 const std::shared_ptr<SHAPE_POLY_SET>& layerPoly = zone->GetFilledPolysList( aLayer );
2569 for(
int ii = 0; ii < layerPoly->OutlineCount(); ii++ )
2570 rawPolys.
AddOutline( layerPoly->COutline( ii ) );
2574 std::vector<VECTOR2I> convex_hull;
2579 for(
const VECTOR2I& pt : convex_hull )
2592 variant =
board->GetCurrentVariant();
2605 aList.emplace_back(
_(
"Footprint Name" ),
GetFPID().GetLibItemName().wx_str() );
2610 wxString::Format(
_(
"Keywords: %s" ),
GetKeywords() ) );
2619 case F_Cu: aList.emplace_back(
_(
"Board Side" ),
_(
"Front" ) );
break;
2620 case B_Cu: aList.emplace_back(
_(
"Board Side" ),
_(
"Back (Flipped)" ) );
break;
2624 aList.emplace_back(
_(
"Rotation" ), wxString::Format( wxT(
"%.4g" ),
GetOrientation().AsDegrees() ) );
2626 auto addToken = []( wxString* aStr,
const wxString& aAttr )
2628 if( !aStr->IsEmpty() )
2629 *aStr += wxT(
", " );
2638 addToken( &status,
_(
"Locked" ) );
2641 addToken( &status,
_(
"autoplaced" ) );
2644 addToken( &attrs,
_(
"not in schematic" ) );
2647 addToken( &attrs,
_(
"exclude from pos files" ) );
2650 addToken( &attrs,
_(
"exclude from BOM" ) );
2653 addToken( &attrs,
_(
"exclude from simulation" ) );
2656 addToken( &attrs,
_(
"DNP" ) );
2658 aList.emplace_back(
_(
"Status: " ) + status,
_(
"Attributes:" ) + wxS(
" " ) + attrs );
2662 aList.emplace_back(
_(
"Component Class" ),
2666 msg.Printf(
_(
"Footprint: %s" ),
m_fpid.GetUniStringLibId() );
2668 aList.emplace_back( msg, msg2 );
2672 aList.emplace_back( msg, msg2 );
2680 if(
board->IsFootprintHolder() )
2712 return aItem->IsOnLayer( aLayer );
2715 return std::ranges::any_of(
m_pads, isOnLayer )
2716 || std::ranges::any_of(
m_zones, isOnLayer )
2717 || std::ranges::any_of(
m_fields, isOnLayer )
2718 || std::ranges::any_of(
m_drawings, isOnLayer );
2726 if(
pad->IsOnLayer( aLayer ) &&
pad->HitTest( aPosition, aAccuracy ) )
2732 if( zone->IsOnLayer( aLayer ) && zone->HitTest( aPosition, aAccuracy ) )
2738 if( item->Type() !=
PCB_TEXT_T && item->IsOnLayer( aLayer )
2739 && item->HitTest( aPosition, aAccuracy ) )
2751 std::vector<BOARD_ITEM*> items;
2755 if(
pad->IsOnLayer( aLayer ) )
2756 items.push_back(
pad );
2761 if( zone->IsOnLayer( aLayer ) )
2762 items.push_back( zone );
2767 if( item->Type() !=
PCB_TEXT_T && item->IsOnLayer( aLayer ) )
2768 items.push_back( item );
2777 if( !aContained && item->HitTest( aRect, aContained, aAccuracy ) )
2779 else if( aContained && !item->HitTest( aRect, aContained, aAccuracy ) )
2786 return !items.empty() && aContained;
2805 BOX2I arect = aRect;
2825 if(
pad->HitTest( arect,
false, 0 ) )
2831 if( zone->HitTest( arect,
false, 0 ) )
2837 if( point->HitTest( arect,
false, 0 ) )
2848 if( item->Type() !=
PCB_TEXT_T && item->HitTest( arect,
false, 0 ) )
2862 using std::ranges::all_of;
2863 using std::ranges::any_of;
2870 [&](
const auto* aItem )
2872 return aItem && aItem->HitTest( aPoly, aContained );
2878 auto drawings =
m_drawings | std::views::filter( [](
const auto* aItem )
2889 return all_of( drawings, hitTest )
2890 && all_of(
m_pads, hitTest )
2891 && all_of(
m_zones, hitTest );
2896 return any_of( drawings, hitTest )
2897 || any_of(
m_pads, hitTest )
2898 || any_of(
m_zones, hitTest );
2905 bool can_select = aSearchAfterMe ? false :
true;
2909 if( !can_select &&
pad == aSearchAfterMe )
2915 if( can_select &&
pad->GetNumber() == aPadNumber )
2927 if(
pad->m_Uuid == aUuid )
2940 if( !(
pad->GetLayerSet() & aLayerMask ).any() )
2943 if(
pad->HitTest( aPosition ) )
2953 std::vector<const PAD*> retv;
2957 if( ( aIgnore && aIgnore ==
pad ) || (
pad->GetNumber() != aPadNumber ) )
2960 retv.push_back(
pad );
2975 std::set<wxString> usedNumbers;
2987 if(
pad->GetNumber().IsEmpty() )
2990 usedNumbers.insert(
pad->GetNumber() );
3015 auto isElectricalPadNumber =
3016 [](
const wxString& num ) ->
bool
3023 while( i < num.size() && wxIsalpha( num[i] ) )
3031 if( i == num.size() )
3034 for(
size_t j = i; j < num.size(); ++j )
3036 if( !wxIsdigit( num[j] ) )
3043 std::set<wxString> counted;
3055 const wxString& num =
pad->GetNumber();
3057 if( isElectricalPadNumber( num ) )
3059 counted.insert( num );
3061 else if( num.Contains(
'_' ) )
3063 wxString first, second;
3064 first = num.BeforeFirst(
'_', &second );
3066 if( isElectricalPadNumber( first ) && isElectricalPadNumber( second ) )
3068 counted.insert( first );
3069 counted.insert( second );
3074 return static_cast<unsigned>( counted.size() );
3080 if(
nullptr == a3DModel )
3123 const std::vector<KICAD_T>& aScanTypes )
3125#if 0 && defined(DEBUG)
3126 std::cout <<
GetClass().mb_str() <<
' ';
3129 bool drawingsScanned =
false;
3131 for(
KICAD_T scanType : aScanTypes )
3170 if( !drawingsScanned )
3175 drawingsScanned =
true;
3214 if( reference.IsEmpty() )
3215 reference =
_(
"<no reference designator>" );
3217 return wxString::Format(
_(
"Footprint %s" ), reference );
3223 return wxString::Format( wxT(
"%s (%s)" ),
3258 aFunction( constraint );
3265 aFunction( drawing );
3271 catch( std::bad_function_call& )
3273 wxFAIL_MSG( wxT(
"Error running FOOTPRINT::RunOnChildren" ) );
3280 std::vector<int> layers;
3282 layers.reserve( 6 );
3288 wxASSERT_MSG(
false, wxT(
"Illegal layer" ) );
3305 bool f_silk =
false, b_silk =
false, non_silk =
false;
3309 if( item->GetLayer() ==
F_SilkS )
3311 else if( item->GetLayer() ==
B_SilkS )
3317 if( ( f_silk || b_silk ) && !non_silk &&
m_pads.empty() )
3354 constexpr double MINIMAL_ZOOM_LEVEL_FOR_VISIBILITY = 1.5;
3357 return MINIMAL_ZOOM_LEVEL_FOR_VISIBILITY;
3370 int biggest_clearance =
board->GetMaxClearanceValue();
3371 area.
Inflate( biggest_clearance );
3382 if( aName.find_first_of( invalids ) != std::string::npos )
3394 static const wxChar invalidCharsReadable[] = wxT(
"% $ < > 'tab' 'return' 'line feed' \\ \" / :");
3397 return invalidCharsReadable;
3399 return invalidChars.wc_str();
3405 if( aMoveVector.
x == 0 && aMoveVector.
y == 0 )
3419 EDA_ANGLE newOrientation = orientation + aAngle;
3426 field->KeepUpright();
3431 static_cast<PCB_TEXT*
>( item )->KeepUpright();
3438 wxASSERT( aLayer ==
F_Cu || aLayer ==
B_Cu );
3493 field->OnFootprintTransformed();
3496 pad->OnFootprintTransformed();
3499 zone->OnFootprintTransformed();
3507 item->OnFootprintTransformed();
3512 point->OnFootprintTransformed();
3553 if( !std::isfinite( aScaleX ) || !std::isfinite( aScaleY ) || aScaleX <= 0.0 || aScaleY <= 0.0 )
3558 const double ratioX = aScaleX / oldSx;
3559 const double ratioY = aScaleY / oldSy;
3560 const double linearFactor = ( aScaleX + aScaleY ) / ( oldSx + oldSy );
3568 pad->OnFootprintRescaled( ratioX, ratioY, linearFactor,
anchor, parentRotate );
3571 field->OnFootprintRescaled( ratioX, ratioY, linearFactor,
anchor, parentRotate );
3574 item->OnFootprintRescaled( ratioX, ratioY, linearFactor,
anchor, parentRotate );
3577 zone->OnFootprintRescaled( ratioX, ratioY, linearFactor,
anchor, parentRotate );
3580 point->OnFootprintTransformed();
3608 field->OnFootprintTransformed();
3611 pad->OnFootprintTransformed();
3614 zone->OnFootprintTransformed();
3617 point->OnFootprintTransformed();
3625 item->OnFootprintTransformed();
3629 item->Move(
delta );
3669 field->Move( moveVector );
3673 pad->Move( moveVector );
3677 item->Move( moveVector );
3681 zone->Move( moveVector );
3685 point->Move( moveVector );
3724 field->OnFootprintTransformed();
3727 pad->OnFootprintTransformed();
3730 zone->OnFootprintTransformed();
3733 point->OnFootprintTransformed();
3741 item->OnFootprintTransformed();
3745 item->Rotate( rotationCenter, angleChange );
3772 std::map<KIID, KIID> idMap;
3779 idMap[oldId] = child->
m_Uuid;
3784 constraint->RemapKIIDs( idMap );
3791 const BOARD_ITEM* aItem,
bool addToFootprint )
3795 switch( aItem->
Type() )
3799 PAD* new_pad =
new PAD( *
static_cast<const PAD*
>( aItem ) );
3802 if( addToFootprint )
3803 m_pads.push_back( new_pad );
3811 ZONE* new_zone =
new ZONE( *
static_cast<const ZONE*
>( aItem ) );
3814 if( addToFootprint )
3815 m_zones.push_back( new_zone );
3817 new_item = new_zone;
3826 if( addToFootprint )
3829 new_item = new_point;
3838 switch(
static_cast<const PCB_FIELD*
>( aItem )->GetId() )
3846 if( addToFootprint )
3849 new_item = new_field;
3858 if( addToFootprint )
3861 new_item = new_text;
3870 if( addToFootprint )
3873 new_item = new_shape;
3882 if( addToFootprint )
3885 new_item = new_barcode;
3894 if( addToFootprint )
3897 new_item = new_image;
3906 if( addToFootprint )
3909 new_item = new_textbox;
3922 if( addToFootprint )
3925 new_item = dimension;
3931 new_item = aItem->
Duplicate( addToParentGroup, aCommit );
3933 if( addToFootprint )
3943 if( addToFootprint )
3945 group->RunOnChildren(
3965 wxFAIL_MSG( wxT(
"Duplication not supported for items of class " ) + aItem->
GetClass() );
3975 std::set<wxString> usedNumbers;
3979 usedNumbers.insert(
pad->GetNumber() );
3986 while( usedNumbers.count( wxString::Format( wxT(
"%s%d" ), prefix, num ) ) )
3989 return wxString::Format( wxT(
"%s%d" ), prefix, num );
4053 for(
int i = 0; i < aCollector.
GetCount(); ++i )
4057 switch( item->
Type() )
4089 double footprintRegionArea =
polygonArea( footprintRegion );
4090 double uncoveredRegionArea = footprintRegionArea -
polygonArea( coveredRegion );
4091 double coveredArea = footprintRegionArea - uncoveredRegionArea;
4094 if( footprintRegionArea == 0 )
4097 double ratio = coveredArea / footprintRegionArea;
4104 return std::min( ratio, 1.0 );
4111 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
4132 shape->AddShape(
pad->GetEffectiveShape( aLayer, aFlash, aUsage )->Clone() );
4137 shape->AddShape( item->GetEffectiveShape( aLayer, aFlash, aUsage )->Clone() );
4139 shape->AddShape( item->GetEffectiveShape( aLayer, aFlash, aUsage )->Clone() );
4186 std::vector<PCB_SHAPE*> list_front;
4187 std::vector<PCB_SHAPE*> list_back;
4188 std::map<int, int> front_width_histogram;
4189 std::map<int, int> back_width_histogram;
4196 list_back.push_back( shape );
4203 list_front.push_back( shape );
4208 if( !list_front.size() && !list_back.size() )
4212 int chainingEpsilon =
pcbIUScale.mmToIU( 0.02 );
4215 true, aErrorHandler ) )
4225 auto max = std::max_element( front_width_histogram.begin(), front_width_histogram.end(),
4226 [](
const std::pair<int, int>& a,
const std::pair<int, int>& b )
4228 return a.second < b.second;
4231 if( max != front_width_histogram.end() )
4254 auto max = std::max_element( back_width_histogram.begin(), back_width_histogram.end(),
4255 [](
const std::pair<int, int>& a,
const std::pair<int, int>& b )
4257 return a.second < b.second;
4260 if( max != back_width_histogram.end() )
4283 std::map<PCB_LAYER_ID, std::vector<PCB_SHAPE*>> layer_shapes;
4289 if( item->Type() != PCB_SHAPE_T )
4292 for( PCB_LAYER_ID layer : item->GetLayerSet() )
4294 if( !IsCopperLayer( layer ) )
4297 if( board && !board->GetEnabledLayers().Contains( layer ) )
4300 layer_shapes[layer].push_back( static_cast<PCB_SHAPE*>( item ) );
4304 for(
size_t ii = 0; ii < m_pads.size(); ++ii )
4307 bool has_nettie =
false;
4309 auto it = map.find(
pad->GetNumber() );
4311 if( it == map.end() || it->second < 0 )
4314 for(
size_t jj = 0; jj < m_pads.size(); ++jj )
4319 PAD* other = m_pads[ jj ];
4321 auto it2 = map.find( other->
GetNumber() );
4323 if( it2 == map.end() || it2->second < 0 )
4326 if( it2->second == it->second )
4328 m_netTieCache[
pad].insert(
pad->GetNetCode() );
4330 m_netTieCache[other].insert( other->
GetNetCode() );
4331 m_netTieCache[other].insert(
pad->GetNetCode() );
4339 for(
auto& [ layer, shapes ] : layer_shapes )
4341 auto pad_shape =
pad->GetEffectiveShape( layer );
4343 for(
auto other_shape : shapes )
4345 auto shape = other_shape->GetEffectiveShape( layer );
4347 if( pad_shape->Collide( shape.get() ) )
4349 std::set<int>& nettie = m_netTieCache[
pad];
4350 m_netTieCache[other_shape].insert( nettie.begin(), nettie.end() );
4360 std::map<wxString, int> padNumberToGroupIdxMap;
4363 padNumberToGroupIdxMap[
pad->GetNumber() ] = -1;
4366 [&]( wxString aPad,
int aGroup )
4368 aPad.Trim(
true ).Trim(
false );
4370 if( !aPad.IsEmpty() )
4371 padNumberToGroupIdxMap[ aPad ] = aGroup;
4380 for( wxUniCharRef ch :
group )
4389 switch(
static_cast<unsigned char>( ch ) )
4396 processPad(
pad, ii );
4406 processPad(
pad, ii );
4409 return padNumberToGroupIdxMap;
4419 int groupIdx = padToNetTieGroupMap[ aPad->
GetNumber() ];
4420 std::vector<PAD*> otherPads;
4426 if( padToNetTieGroupMap[
pad->GetNumber() ] == groupIdx )
4427 otherPads.push_back(
pad );
4440 if( setAttr && likelyAttr && setAttr != likelyAttr )
4444 switch( likelyAttr )
4447 msg.Printf(
_(
"(expected 'Through hole'; actual '%s')" ),
GetTypeName() );
4450 msg.Printf(
_(
"(expected 'SMD'; actual '%s')" ),
GetTypeName() );
4455 (aErrorHandler)( msg );
4461 const std::function<
void(
const PAD*,
int,
4462 const wxString& )>& aErrorHandler )
4464 if( aErrorHandler ==
nullptr )
4469 pad->CheckPad( aUnitsProvider,
false,
4470 [&](
int errorCode,
const wxString& msg )
4472 aErrorHandler(
pad, errorCode, msg );
4479 const VECTOR2I& )>& aErrorHandler )
4481 std::unordered_map<PTR_PTR_CACHE_KEY, int> checkedPairs;
4496 if(
static_cast<void*
>( a ) >
static_cast<void*
>( b ) )
4499 if( checkedPairs.find( { a, b } ) == checkedPairs.end() )
4501 checkedPairs[ { a, b } ] = 1;
4518 if( holeA->Collide( holeB->GetSeg(), 0 ) )
4535 SHAPE* padShape =
pad->GetEffectiveShape( l ).get();
4538 if( padShape->
Collide( otherShape, 0,
nullptr, &pos ) )
4551 const VECTOR2I& )>& aErrorHandler )
4560 std::vector<BOARD_ITEM*> copperItems;
4564 if( item->IsOnCopperLayer() )
4565 copperItems.push_back( item );
4567 item->RunOnChildren(
4571 copperItems.push_back( descendent );
4578 if( !zone->GetIsRuleArea() && zone->IsOnCopperLayer() )
4579 copperItems.push_back( zone );
4584 if( field->IsOnCopperLayer() )
4585 copperItems.push_back( field );
4595 std::map<int, std::vector<const PAD*>> outlineIdxToPadsMap;
4599 if( item->IsOnLayer( layer ) )
4609 for(
int ii = 0; ii < copperOutlines.
OutlineCount(); ++ii )
4611 if(
pad->GetEffectiveShape( layer )->Collide( &copperOutlines.
Outline( ii ), 0 ) )
4612 outlineIdxToPadsMap[ ii ].emplace_back(
pad );
4619 for(
const auto& [ outlineIdx, pads ] : outlineIdxToPadsMap )
4621 if( pads.size() > 1 )
4623 const PAD* firstPad = pads[0];
4624 int firstGroupIdx = padNumberToGroupIdxMap[ firstPad->
GetNumber() ];
4626 for(
size_t ii = 1; ii < pads.size(); ++ii )
4628 const PAD* thisPad = pads[ii];
4629 int thisGroupIdx = padNumberToGroupIdxMap[ thisPad->
GetNumber() ];
4631 if( thisGroupIdx < 0 || thisGroupIdx != firstGroupIdx )
4640 if( item->HitTest( pos, 1 ) )
4642 shortingItem = item;
4648 aErrorHandler( shortingItem, firstPad, thisPad, pos );
4650 aErrorHandler( firstPad, thisPad,
nullptr, pos );
4661 std::set<wxString> padNumbers;
4670 msg.Printf(
_(
"(net-tie pad group contains unknown pad number %s)" ), padNumber );
4671 aErrorHandler( msg );
4673 else if( !padNumbers.insert(
pad->GetNumber() ).second )
4675 msg.Printf(
_(
"(pad %s appears in more than one net-tie pad group)" ), padNumber );
4676 aErrorHandler( msg );
4684 const VECTOR2I& aPt )>& aErrorHandler )
4686 auto checkColliding =
4701 if( itemShape->Collide( otherShape.get(), 0, &
actual, &pos ) )
4702 aErrorHandler( item, other, pos );
4711 checkColliding( item, other );
4715 checkColliding( item,
pad );
4726 std::swap( *
this, *
image );
4735 image->RunOnChildren(
4763 return *
this == other;
4770 [](
const auto* aLeft,
const auto* aRight )
4772 return *aLeft == *aRight;
4775 if( !std::ranges::equal(
m_pads, aOther.
m_pads, equalItems ) )
4788 std::vector<PCB_FIELD*> fields, otherFields;
4793 if( fields.size() != otherFields.size() )
4796 for(
size_t ii = 0; ii < fields.size(); ++ii )
4800 if( !( *fields[ii] == *otherFields[ii] ) )
4816 double similarity = 1.0;
4825 similarity *=
pad->Similarity( *otherPad );
4837 if( aPtA.
x != aPtB.
x )
4838 return aPtA.
x < aPtB.
x;
4840 if( aPtA.
y != aPtB.
y )
4841 return aPtA.
y < aPtB.
y;
4843 return std::nullopt;
4849 if( itemA->
Type() != itemB->
Type() )
4850 return itemA->
Type() < itemB->
Type();
4855 switch( itemA->
Type() )
4977 return itemA < itemB;
4989 std::optional<bool> padCopperMatches;
4992 const PAD* checkPad = aFirst;
5005 padCopperMatches = aFirst->
GetSize( aLayer ).
x < aSecond->
GetSize( aLayer ).
x;
5007 padCopperMatches = aFirst->
GetSize( aLayer ).
y < aSecond->
GetSize( aLayer ).
y;
5009 padCopperMatches = aFirst->
GetShape( aLayer ) < aSecond->
GetShape( aLayer );
5012 if( padCopperMatches.has_value() )
5013 return *padCopperMatches;
5021 return aFirst < aSecond;
5026bool FOOTPRINT::cmp_padstack::operator()(
const PAD* aFirst,
const PAD* aSecond )
const
5066 if( firstShape->VertexCount() != secondShape->VertexCount() )
5067 return firstShape->VertexCount() < secondShape->VertexCount();
5069 for(
int ii = 0; ii < firstShape->VertexCount(); ++ii )
5071 if( std::optional<bool> cmp =
cmp_points_opt( firstShape->CVertex( ii ), secondShape->CVertex( ii ) ) )
5105 return aFirst < aSecond;
5110 int aMaxError,
ERROR_LOC aErrorLoc )
const
5121 clearance.x +=
pad->GetSolderMaskExpansion( padLayer );
5122 clearance.y +=
pad->GetSolderMaskExpansion( padLayer );
5145 if( dummySize.
x <= 0 || dummySize.
y <= 0 )
5149 dummy.SetSize( padLayer, dummySize );
5150 dummy.TransformShapeToPolygon( aBuffer, padLayer, 0, aMaxError, aErrorLoc );
5154 pad->TransformShapeToPolygon( aBuffer, padLayer,
clearance.x, aMaxError, aErrorLoc );
5160 if( !
pad->FlashLayer( aLayer ) )
5165 pad->Padstack().ForEachUniqueLayer(
5168 processPad(
pad, l );
5173 processPad(
pad, aLayer );
5180 int aError,
ERROR_LOC aErrorLoc,
bool aIncludeText,
5181 bool aIncludeShapes,
bool aIncludePrivateItems )
const
5188 if( item->Type() ==
PCB_TEXT_T && aIncludeText )
5193 text->TransformTextToPolySet( aBuffer, aClearance, aError, aErrorLoc );
5204 textbox->PCB_SHAPE::TransformShapeToPolygon( aBuffer, aLayer, 0, aError, aErrorLoc );
5211 if( item->Type() ==
PCB_SHAPE_T && aIncludeShapes )
5232 if( ( aLayer ==
UNDEFINED_LAYER || field->GetLayer() == aLayer ) && field->IsVisible() )
5233 field->TransformTextToPolySet( aBuffer, aClearance, aError, aErrorLoc );
5243 std::set<KIFONT::OUTLINE_FONT*>
fonts;
5257 if( permission == PERMISSION::EDITABLE || permission == PERMISSION::INSTALLABLE )
5258 fonts.insert( outlineFont );
5264 processItem( item );
5267 processItem( field );
5281 wxLogTrace(
"EMBED",
"Failed to add font file: %s", font->GetFileName() );
5319 return wxEmptyString;
5324 const std::unordered_set<wxString>& aComponentClassNames )
5373 LSET padLayers =
pad->GetLayerSet();
5374 padLayers |= boardCopper;
5375 pad->SetLayerSet( padLayers );
5392 if( zcMap.
Choices().GetCount() == 0 )
5404 if( layerEnum.
Choices().GetCount() == 0 )
5412 wxPGChoices fpLayers;
5423 auto isNotFootprintHolder =
5429 return !
board->IsFootprintHolder();
5453 const wxString groupFields =
_HKI(
"Fields" );
5459 const wxString propertyFields =
_HKI(
"Footprint Properties" );
5477 const wxString groupAttributes =
_HKI(
"Attributes" );
5497 const wxString groupOverrides =
_HKI(
"Overrides" );
KICOMMON_API types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICOMMON_API KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
std::unique_ptr< EDA_ITEM > CreateItemForType(KICAD_T aType, EDA_ITEM *aContainer)
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
constexpr EDA_IU_SCALE pcbIUScale
constexpr int ARC_LOW_DEF
BITMAPS
A list of all bitmap identifiers.
#define DEFAULT_COURTYARD_WIDTH
BASE_SET & set(size_t pos)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
virtual BOARD_ITEM * Duplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr) const
Create a copy of this BOARD_ITEM.
static double polygonArea(SHAPE_POLY_SET &aPolySet)
Area of aPolySet with every contour closed first, holes subtracted.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the item shape to a closed polygon.
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
VECTOR2I GetFPRelativePosition() const
virtual void TransformShapeToPolySet(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, KIGFX::RENDER_SETTINGS *aRenderSettings=nullptr) const
Convert the item shape to a polyset.
BOARD_ITEM & operator=(const BOARD_ITEM &aOther)
BOARD_ITEM_CONTAINER * GetParent() const
virtual bool IsOnCopperLayer() const
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Information pertinent to a Pcbnew printed circuit board.
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
int GetCopperLayerCount() const
wxString GetCurrentVariant() const
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr size_type GetWidth() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr const Vec GetCenter() const
constexpr size_type GetHeight() const
constexpr bool Contains(const Vec &aPoint) const
constexpr coord_type GetTop() const
constexpr bool Intersects(const BOX2< Vec > &aRect) const
constexpr coord_type GetBottom() const
virtual int Accuracy() const =0
int GetCount() const
Return the number of objects in the list.
const COMPONENT_CLASS * GetStaticComponentClass() const
Gets the static component class.
COMPONENT_CLASS * GetEffectiveStaticComponentClass(const std::unordered_set< wxString > &classNames)
Computes and returns an effective component class for a (possibly empty) set of constituent class nam...
A lightweight representation of a component class.
int AsTenthsOfADegree() const
bool IsType(FRAME_T aType) const
The base class for create windows for drawing purpose.
std::unordered_set< EDA_ITEM * > & GetItems()
void AddItem(EDA_ITEM *aItem)
Add item to group.
virtual void ClearEditFlags()
void SetFlags(EDA_ITEM_FLAGS aMask)
std::vector< PROPERTY_BASE * > GetCustomPropertiesAsInspectables() const
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
static INSPECT_RESULT IterateForward(std::deque< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
This changes first parameter to avoid the DList and use the main queue instead.
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
int GetEllipseMinorRadius() const
const VECTOR2I & GetEllipseCenter() const
EDA_ANGLE GetEllipseEndAngle() const
int GetEllipseMajorRadius() const
EDA_ANGLE GetEllipseRotation() const
EDA_ANGLE GetEllipseStartAngle() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
virtual void SetVisible(bool aVisible)
double GetLineSpacing() const
virtual void SetText(const wxString &aText)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
EMBEDDED_FILES & operator=(EMBEDDED_FILES &&other) noexcept
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Load a file from disk and adds it to the collection.
bool m_embedFonts
If set, fonts will be embedded in the element on save.
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
ENUM_MAP & Undefined(T aValue)
wxString m_Filename
The 3D shape filename in 3D library.
Used when the right click button is pressed, or when the select tool is in effect.
const COLLECTORS_GUIDE * GetGuide() const
Class that other classes need to inherit from, in order to be inspectable.
wxAny Get(PROPERTY_BASE *aProperty) const
Represents an (ordered) list of JUMPER_GROUP objects.
void Add(JUMPER_GROUP aGroup)
Add a JUMPER_GROUP to the set.
Represents a group of jumper pins or pads, keyed by name.
A typed sum value used to carry the before/after of any single property.
wxString ToDisplayString() const
Human-readable representation with no unit context.
FONT is an abstract base class for both outline and stroke fonts.
virtual bool IsOutline() const
Implement outline font drawing.
EMBEDDING_PERMISSION GetEmbeddingPermission() const
virtual wxString GetClass() const =0
Return the class name.
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
static const LSET & SideSpecificMask()
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static const LSET & AllLayersMask()
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
static const int ORPHANED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
void ForEachUniqueLayer(const std::function< void(PCB_LAYER_ID)> &aMethod) const
Runs the given callable for each active unique copper layer in this padstack, meaning F_Cu for MODE::...
@ NORMAL
Shape is the same on all layers.
@ CUSTOM
Shapes can be defined on arbitrary layers.
@ FRONT_INNER_BACK
Up to three shapes can be defined (F_Cu, inner copper layers, B_Cu)
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
Return a SHAPE_SEGMENT object representing the pad's hole.
const BOX2I GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
int GetDrillSizeY() const
PAD_ATTRIB GetAttribute() const
const wxString & GetNumber() const
VECTOR2I GetPosition() const override
int GetDrillSizeX() const
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
int GetSolderMaskExpansion(PCB_LAYER_ID aLayer) const
VECTOR2I GetSize(PCB_LAYER_ID aLayer) const
const PADSTACK & Padstack() const
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
PAD_DRILL_SHAPE GetDrillShape() const
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID aLayer, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
std::optional< int > GetLocalSolderMaskMargin() const
VECTOR2I GetSolderPasteMargin(PCB_LAYER_ID aLayer) const
Usually < 0 (mask shape smaller than pad)because the margin can be dependent on the pad size,...
bool HasDrilledHole() const override
A geometric constraint between board items (issue #2329).
wxString GetUntranslatedName() const
Get the untranslated field name for storage, variable look-up, etc.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
PCB_FIELD * CloneField() const
Same as Clone, but returns a PCB_FIELD item.
A set of BOARD_ITEMs (i.e., without duplicates).
A PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
Object to handle a bitmap image that can be inserted in a PCB.
VECTOR2I GetLibraryBezierC1() const
int GetWidth() const override
void TransformShapeToPolySet(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, KIGFX::RENDER_SETTINGS *aRenderSettings=nullptr) const override
Convert the item shape to a polyset.
VECTOR2I GetLibraryEnd() const
VECTOR2I GetLibraryStart() const
STROKE_PARAMS GetStroke() const override
SHAPE_POLY_SET GetLibraryPolyShape() const
VECTOR2I GetLibraryBezierC2() const
VECTOR2I GetLibraryArcMid() const
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
bool IsBorderEnabled() const
Tests whether the border is disabled, as configured by the stroke.
void TransformTextToPolySet(SHAPE_POLY_SET &aBuffer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc) const
Convert the text to a polygonSet describing the actual character strokes (one per segment).
EDA_ANGLE GetTextAngle() const override
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
int GetTextThickness() const override
void SetTextAngle(const EDA_ANGLE &aAngle) override
VECTOR2I GetTextSize() const override
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
PROPERTY_BASE(const wxString &aName, PROPERTY_DISPLAY aDisplay=PT_DEFAULT, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType=ORIGIN_TRANSFORMS::NOT_A_COORD)
Used to generate unique IDs. Must come up front so it's initialized before ctor.
PROPERTY_BASE & SetGroup(const wxString &aGroup)
PROPERTY_BASE & SetIsCopyable(bool aIsCopyable=true)
virtual void SetChoices(const wxPGChoices &aChoices)
Set the possible values for for the property.
PROPERTY_BASE & SetIsHiddenFromLibraryEditors(bool aIsHidden=true)
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
bool IsAvailableFor(TYPE_ID aItemClass, PROPERTY_BASE *aProp, INSPECTABLE *aItem)
Checks overriden availability and original availability of a property, returns false if the property ...
PROPERTY_BASE & ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Find a point on the line chain that is closest to point aP.
Represent a set of closed polygons.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
int TotalVertices() const
Return total number of vertices stored in the set.
int FullPointCount() const
Return the number of points in the shape poly set.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
void Simplify()
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
void BooleanIntersection(const SHAPE_POLY_SET &b)
Perform boolean polyset intersection.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the index-th vertex in a given hole outline within a given outline.
int OutlineCount() const
Return the number of outlines in the set.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
An abstract shape on 2D plane.
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
Handle a list of polygons defining a copper zone.
bool SetNetCode(int aNetCode, bool aNoAssert) override
Override that clamps the netcode to 0 when this zone is in copper-thieving fill mode.
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
SHAPE_POLY_SET GetLibraryOutline() const
unsigned GetAssignedPriority() const
This file is part of the common library.
bool ConvertOutlineToPolygon(std::vector< PCB_SHAPE * > &aShapeList, SHAPE_POLY_SET &aPolygons, int aErrorMax, int aChainingEpsilon, bool aAllowDisjoint, OUTLINE_ERROR_HANDLER *aErrorHandler, bool aAllowUseArcsInPolygons)
Build a polygon set with holes from a PCB_SHAPE list.
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const VECTOR2I &pt)> OUTLINE_ERROR_HANDLER
void BuildConvexHull(std::vector< VECTOR2I > &aResult, const std::vector< VECTOR2I > &aPoly)
Calculate the convex hull of a list of points in counter-clockwise order.
@ CHAMFER_ACUTE_CORNERS
Acute angles are chamfered.
@ DRCE_DRILLED_HOLES_TOO_CLOSE
@ DRCE_DRILLED_HOLES_COLOCATED
@ HOLE_TO_HOLE_CONSTRAINT
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_180
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
#define COURTYARD_CONFLICT
temporary set when moving footprints having courtyard overlapping
#define MALFORMED_F_COURTYARD
#define MALFORMED_B_COURTYARD
#define STRUCT_DELETED
flag indication structures to be erased
#define MALFORMED_COURTYARDS
@ FRAME_FOOTPRINT_CHOOSER
a few functions useful in geometry calculations.
const wxChar *const traceApi
Flag to enable debug output related to the IPC API and its plugin system.
Some functions to handle hotkeys in KiCad.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
@ LAYER_CONFLICTS_SHADOW
Shadow layer for items flagged conflicting.
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
@ LAYER_FP_REFERENCES
Show footprints references (when texts are visible).
@ LAYER_FOOTPRINTS_BK
Show footprints on back.
@ LAYER_ANCHOR
Anchor of items having an anchor point (texts, footprints).
@ LAYER_FP_VALUES
Show footprints values (when texts are visible).
PCB_LAYER_ID
A quick note on layer IDs:
bool IsValidLayer(int aLayerId)
Test whether a given integer is a valid layer index, i.e.
const wxString & GetLibFilenameForbiddenChars()
Characters illegal in a footprint library filename.
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
@ LEFT_RIGHT
Flip left to right (around the Y axis)
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
DIFF_VALUE WxAnyToDiffValue(const wxAny &aValue, PROPERTY_BASE *aProperty)
Convert a wxAny value read from a PROPERTY_BASE getter into a DIFF_VALUE that the engine can store,...
bool BoxHitTest(const VECTOR2I &aHitPoint, const BOX2I &aHittee, int aAccuracy)
Perform a point-to-box hit test.
wxString GetRefDesPrefix(const wxString &aRefDes)
Get the (non-numeric) prefix from a refdes - e.g.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
void PackEmbeddedFiles(common::types::EmbeddedFiles &aOutput, const EMBEDDED_FILES &aFiles)
bool UnpackEmbeddedFiles(EMBEDDED_FILES &aOutput, const common::types::EmbeddedFiles &aProto)
KICOMMON_API KIID_PATH UnpackSheetPath(const types::SheetPath &aInput)
KICOMMON_API std::optional< KICAD_T > TypeNameFromAny(const google::protobuf::Any &aMessage)
KICOMMON_API VECTOR3D UnpackVector3D(const types::Vector3D &aInput)
KICOMMON_API void PackCustomProperties(google::protobuf::RepeatedPtrField< types::CustomProperty > *aOutput, const EDA_ITEM &aItem)
KICOMMON_API void PackSheetPath(types::SheetPath &aOutput, const KIID_PATH &aInput)
KICOMMON_API void PackLibId(types::LibraryIdentifier *aOutput, const LIB_ID &aId)
KICOMMON_API LIB_ID UnpackLibId(const types::LibraryIdentifier &aId)
KICOMMON_API void UnpackCustomProperties(const google::protobuf::RepeatedPtrField< types::CustomProperty > &aInput, EDA_ITEM &aItem)
KICOMMON_API void PackVector3D(types::Vector3D &aOutput, const VECTOR3D &aInput)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
@ SMD
Smd pad, appears on the solder paste layer (default)
@ PTH
Plated through hole pad.
@ FIDUCIAL_LOCAL
a fiducial (usually a smd) local to the parent footprint
@ FIDUCIAL_GLBL
a fiducial (usually a smd) for the full board
@ MECHANICAL
a pad used for mechanical support
@ PRESSFIT
a PTH with a hole diameter with tight tolerances for press fit pin
@ HEATSINK
a pad used as heat sink, usually in SMD footprints
@ NONE
no special fabrication property
@ TESTPOINT
a test point pad
@ CASTELLATED
a pad with a castellated through hole
@ BGA
Smd pad, used in BGA footprints.
BARCODE class definition.
Class to handle a set of BOARD_ITEMs.
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
#define NO_SETTER(owner, type)
Macro to define read-only fields (no setter method available)
#define ENUM_TO_WXANY(type)
@ PT_DEGREE
Angle expressed in degrees.
@ PT_SIZE
Size expressed in distance units (mm/inch)
#define REGISTER_TYPE(x)
Helper macro to map type hashes to names.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Collection of utility functions for component reference designators (refdes)
std::vector< FAB_LAYER_COLOR > dummy
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
wxString GetDefaultVariantName()
int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
wxString UnescapeString(const wxString &aSource)
A structure for storing weighted search terms.
wxString GetDefaultFieldName(FIELD_T aFieldId, TRANSLATION aTranslation)
Return a default symbol field name for a mandatory field type.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ USER
The field ID hasn't been set yet; field is invalid.
@ DESCRIPTION
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_CONSTRAINT_T
a geometric constraint between board items
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
VECTOR2< int32_t > VECTOR2I
ZONE_CONNECTION
How pads are covered by copper in zone.
@ THERMAL
Use thermal relief for pads.
@ THT_THERMAL
Thermal relief only for THT pads.
@ NONE
Pads are not covered.
@ FULL
pads are covered by copper