49#include <compoundfilereader.h> 
   56#include <wx/docview.h> 
   58#include <wx/mstream.h> 
   59#include <wx/wfstream.h> 
   60#include <wx/zstream.h> 
   62#include <magic_enum.hpp> 
   84        THROW_IO_ERROR( wxString::Format( wxT( 
"Component creator tries to access component id %u " 
   85                                               "of %u existing components" ),
 
 
   94                                             const std::vector<ALTIUM_VERTICE>& aVertices )
 
  103            double  startradiant   = 
DEG2RAD( vertex.startangle );
 
  104            double  endradiant     = 
DEG2RAD( vertex.endangle );
 
  106                                             -
KiROUND( std::sin( startradiant ) * vertex.radius ) );
 
  109                                           -
KiROUND( std::sin( endradiant ) * vertex.radius ) );
 
  111            VECTOR2I arcStart = vertex.center + arcStartOffset;
 
  112            VECTOR2I arcEnd   = vertex.center + arcEndOffset;
 
  117            if( arcStart.
Distance( vertex.position )
 
  118                    < arcEnd.
Distance( vertex.position ) )
 
  145            aLine.
Append( vertex.position );
 
 
  155    auto override = 
m_layermap.find( aAltiumLayer );
 
  159        return override->second;
 
  162    switch( aAltiumLayer )
 
 
  261    static std::set<ALTIUM_LAYER> altiumLayersWithWarning;
 
  266        std::vector<PCB_LAYER_ID> layers;
 
  267        layers.reserve( layerCount );
 
  272                layers.emplace_back( layer );
 
  283        wxString layerName = it != 
m_layerNames.end() ? it->second : wxString::Format( wxT( 
"(%d)" ),
 
  284                                                                                      (
int) aAltiumLayer );
 
  286        if( 
m_reporter && altiumLayersWithWarning.insert( aAltiumLayer ).second )
 
  289                    _( 
"Altium layer %s has no KiCad equivalent. It has been moved to KiCad " 
 
  305                        const wxString& aLibrary, 
const wxString& aFootprintName )
 
 
  325    const unsigned PROGRESS_DELTA = 250;
 
 
  343                        const std::map<ALTIUM_PCB_DIR, std::string>& aFileMapping )
 
  346    const std::vector<std::tuple<bool, ALTIUM_PCB_DIR, PARSE_FUNCTION_POINTER_fp>> parserOrder = {
 
  458        for( 
const std::tuple<bool, ALTIUM_PCB_DIR, PARSE_FUNCTION_POINTER_fp>& cur : parserOrder )
 
  463            std::tie( isRequired, 
directory, fp ) = cur;
 
  468            const auto& mappedDirectory = aFileMapping.find( 
directory );
 
  470            if( mappedDirectory == aFileMapping.end() )
 
  473            const std::vector<std::string>  mappedFile{ mappedDirectory->second, 
"Header" };
 
  474            const CFB::COMPOUND_FILE_ENTRY* file = altiumPcbFile.
FindStream( mappedFile );
 
  476            if( file == 
nullptr )
 
  480            uint32_t             numOfRecords = reader.
Read<uint32_t>();
 
  486                    m_reporter->Report( wxString::Format( 
_( 
"'%s' was not parsed correctly." ),
 
  500                    m_reporter->Report( wxString::Format( 
_( 
"'%s' was not fully parsed." ),
 
  512    if( boardDirectory != aFileMapping.end() )
 
  514        std::vector<std::string> mappedFile{ boardDirectory->second, 
"Data" };
 
  516        const CFB::COMPOUND_FILE_ENTRY* file = altiumPcbFile.
FindStream( mappedFile );
 
  521                    "This file does not appear to be in a valid PCB Binary Version 6.0 format. In " 
  523                    "make sure to save as \"PCB Binary Files (*.PcbDoc)\"." ) );
 
  528    for( 
const std::tuple<bool, ALTIUM_PCB_DIR, PARSE_FUNCTION_POINTER_fp>& cur : parserOrder )
 
  533        std::tie( isRequired, 
directory, fp ) = cur;
 
  535        const auto& mappedDirectory = aFileMapping.find( 
directory );
 
  537        if( mappedDirectory == aFileMapping.end() )
 
  539            wxASSERT_MSG( !isRequired, wxString::Format( wxT( 
"Altium Directory of kind %d was " 
  540                                                              "expected, but no mapping is " 
  541                                                              "present in the code" ),
 
  546        std::vector<std::string> mappedFile{ mappedDirectory->second };
 
  549            mappedFile.emplace_back( 
"Data" );
 
  551        const CFB::COMPOUND_FILE_ENTRY* file = altiumPcbFile.
FindStream( mappedFile );
 
  553        if( file != 
nullptr )
 
  555            fp( altiumPcbFile, file );
 
  557        else if( isRequired )
 
  561                m_reporter->Report( wxString::Format( 
_( 
"File not found: '%s' for directory '%s'." ),
 
  576        if( zone->GetAssignedPriority() == 1000 )
 
  587        zone->SetAssignedPriority( priority >= 0 ? priority : 0 );
 
  591    for( std::pair<const ALTIUM_LAYER, ZONE*>& zone : 
m_outer_plane )
 
  592        zone.second->SetAssignedPriority( 0 );
 
  602            if( !zone->HasFilledPolysForLayer( layer ) )
 
  605            zone->GetFilledPolysList( layer )->Fracture();
 
  643                if( arc->
GetCenter() == dim->GetPosition() )
 
  652        VECTOR2I radialLine = dim->GetEnd() - dim->GetStart();
 
  657        radialLine = radialLine.
Resize( std::max( 
radius, 2 ) );
 
  658        dim->SetEnd( dim->GetStart() + (
VECTOR2I) radialLine );
 
  659        dim->SetLeaderLength( totalLength - 
radius );
 
  669    int desired_x = ( w - bbbox.
GetWidth() ) / 2;
 
  670    int desired_y = ( h - bbbox.
GetHeight() ) / 2;
 
  672    VECTOR2I movementVector( desired_x - bbbox.
GetX(), desired_y - bbbox.
GetY() );
 
  673    m_board->Move( movementVector );
 
 
  684                                       const wxString&       aFootprintName )
 
  686    std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( 
m_board );
 
  704    std::tuple<wxString, const CFB::COMPOUND_FILE_ENTRY*> ret =
 
  707    wxString fpDirName = std::get<0>( ret );
 
  708    const CFB::COMPOUND_FILE_ENTRY* footprintStream = std::get<1>( ret );
 
  710    if( fpDirName.IsEmpty() )
 
  713                wxString::Format( 
_( 
"Footprint directory not found: '%s'." ), aFootprintName ) );
 
  716    const std::vector<std::string>  streamName{ fpDirName.ToStdString(), 
"Data" };
 
  717    const CFB::COMPOUND_FILE_ENTRY* footprintData = altiumLibFile.
FindStream( footprintStream, { 
"Data" } );
 
  719    if( footprintData == 
nullptr )
 
  732    footprint->SetFPID( fpID );
 
  734    const std::vector<std::string>  parametersStreamName{ fpDirName.ToStdString(),
 
  736    const CFB::COMPOUND_FILE_ENTRY* parametersData =
 
  737            altiumLibFile.
FindStream( footprintStream, { 
"Parameters" } );
 
  739    if( parametersData != 
nullptr )
 
  742        std::map<wxString, wxString> parameterProperties = parametersReader.
ReadProperties();
 
  744                                                               wxT( 
"DESCRIPTION" ), wxT( 
"" ) );
 
  745        footprint->SetLibDescription( description );
 
  751            m_reporter->Report( wxString::Format( 
_( 
"File not found: '%s'." ),
 
  756        footprint->SetLibDescription( wxT( 
"" ) );
 
  759    const std::vector<std::string> extendedPrimitiveInformationStreamName{
 
  760        "ExtendedPrimitiveInformation", 
"Data" 
  762    const CFB::COMPOUND_FILE_ENTRY* extendedPrimitiveInformationData =
 
  763            altiumLibFile.
FindStream( footprintStream, extendedPrimitiveInformationStreamName );
 
  765    if( extendedPrimitiveInformationData != 
nullptr )
 
  768    footprint->SetReference( wxT( 
"REF**" ) );
 
  769    footprint->SetValue( aFootprintName );
 
  770    footprint->Reference().SetVisible( 
true ); 
 
  771    footprint->Value().SetVisible( 
true );
 
  774    const int      defaultTextThickness( 
pcbIUScale.mmToIU( 0.15 ) );
 
  776    for( 
PCB_FIELD* field : footprint->GetFields() )
 
  778        field->SetTextSize( defaultTextSize );
 
  779        field->SetTextThickness( defaultTextThickness );
 
  837            THROW_IO_ERROR( wxString::Format( 
_( 
"Record of unknown type: '%d'." ), recordtype ) );
 
  843    for( 
bool changes = 
true; changes; )
 
  848                [&changes]( 
PAD* aPad1, 
PAD* aPad2 )
 
  850                    if( !( aPad1->GetNumber().IsEmpty() ^ aPad2->GetNumber().IsEmpty() ) )
 
  853                    for( PCB_LAYER_ID layer : aPad1->GetLayerSet() )
 
  855                        std::shared_ptr<SHAPE> shape1 = aPad1->GetEffectiveShape( layer );
 
  856                        std::shared_ptr<SHAPE> shape2 = aPad2->GetEffectiveShape( layer );
 
  858                        if( shape1->Collide( shape2.get() ) )
 
  860                            if( aPad1->GetNumber().IsEmpty() )
 
  861                                aPad1->SetNumber( aPad2->GetNumber() );
 
  863                                aPad2->SetNumber( aPad1->GetNumber() );
 
  872    footprint->AutoPositionFields();
 
  874    if( parser.HasParsingError() )
 
  876        THROW_IO_ERROR( wxString::Format( wxT( 
"%s stream was not parsed correctly" ),
 
  880    if( parser.GetRemainingBytes() != 0 )
 
  882        THROW_IO_ERROR( wxString::Format( wxT( 
"%s stream is not fully parsed" ),
 
  886    return footprint.release();
 
 
  897        THROW_IO_ERROR( wxString::Format( wxT( 
"Netcode with id %d does not exist. Only %d nets " 
 
  909    const auto rules = 
m_rules.find( aKind );
 
  914    for( 
const ARULE6& rule : rules->second )
 
  916        if( rule.
name == aName )
 
 
  925    const auto rules = 
m_rules.find( aKind );
 
  930    for( 
const ARULE6& rule : rules->second )
 
 
  940                                  const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 
  958                                                        const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
  975        THROW_IO_ERROR( wxT( 
"ExtendedPrimitiveInformation stream is not fully parsed" ) );
 
 
  980                                  const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
  997    size_t layercount = 0;
 
 1000    while( layerid < elem.
stackup.size() && layerid != 0 )
 
 1002        layerid = elem.
stackup[ layerid - 1 ].nextId;
 
 1006    size_t kicadLayercount = ( layercount % 2 == 0 ) ? layercount : layercount + 1;
 
 1007    m_board->SetCopperLayerCount( kicadLayercount );
 
 1016    auto it = stackup.
GetList().begin();
 
 1025            altiumLayerId < elem.
stackup.size() && altiumLayerId != 0;
 
 1026            altiumLayerId = elem.
stackup[altiumLayerId - 1].nextId )
 
 1032        if( layer.
nextId == 0 && layercount != kicadLayercount )
 
 1034            m_board->SetLayerName( ( *it )->GetBrdLayerId(), wxT( 
"[unused]" ) );
 
 1037                THROW_IO_ERROR( wxT( 
"Board6 stream, unexpected item while parsing stackup" ) );
 
 1039            ( *it )->SetThickness( 0 );
 
 1044                THROW_IO_ERROR( wxT( 
"Board6 stream, unexpected item while parsing stackup" ) );
 
 1046            ( *it )->SetThickness( 0, 0 );
 
 1047            ( *it )->SetThicknessLocked( 
true, 0 );
 
 1055            THROW_IO_ERROR( wxT( 
"Board6 stream, unexpected item while parsing stackup" ) );
 
 1069        if( klayer == 
B_Cu )
 
 1072                THROW_IO_ERROR( wxT( 
"Board6 stream, unexpected id while parsing last stackup layer" ) );
 
 1082            THROW_IO_ERROR( wxT( 
"Board6 stream, unexpected item while parsing stackup" ) );
 
 
 1131    if( aStackup.size() == 0 )
 
 1134    std::vector<INPUT_LAYER_DESC> inputLayers;
 
 1135    std::map<wxString, ALTIUM_LAYER>  altiumLayerNameMap;
 
 1142            [&]( 
size_t ii ) -> 
size_t 
 1148                    return curLayer.
nextId - 1;
 
 1153    for( 
size_t ii = 0; ii < aStackup.size(); ii = 
next( ii ) )
 
 1155        curLayer = aStackup[ii];
 
 1178        inputLayers.push_back( iLdesc );
 
 1179        altiumLayerNameMap.insert( { curLayer.
name, layer_num } );
 
 1183    if( inputLayers.size() == 0 )
 
 1190    for( std::pair<wxString, PCB_LAYER_ID> layerPair : reMappedLayers )
 
 1194            wxFAIL_MSG( wxT( 
"Unexpected Layer ID" ) );
 
 1198        ALTIUM_LAYER altiumID     = altiumLayerNameMap.at( layerPair.first );
 
 1199        m_layermap.insert_or_assign( altiumID, layerPair.second );
 
 1200        enabledLayers |= 
LSET( { layerPair.second } );
 
 1203    m_board->SetEnabledLayers( enabledLayers );
 
 1204    m_board->SetVisibleLayers( enabledLayers );
 
 
 1221            int              nextShape = lineChain.
NextShape( i );
 
 1222            bool             isLastShape = nextShape < 0;
 
 1226            shape->SetStroke( stroke );
 
 1238            shape->SetStroke( stroke );
 
 1240            shape->SetStart( seg.
A );
 
 1241            shape->SetEnd( seg.
B );
 
 
 1250                                    const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 1264            std::shared_ptr<NETCLASS> nc = std::make_shared<NETCLASS>( elem.
name );
 
 1266            for( 
const wxString& 
name : elem.
names )
 
 1268                m_board->GetDesignSettings().m_NetSettings->SetNetclassPatternAssignment(
 
 1269                        name, nc->GetName() );
 
 1272            if( 
m_board->GetDesignSettings().m_NetSettings->HasNetclass( nc->GetName() ) )
 
 1279                    msg.Printf( 
_( 
"More than one Altium netclass with name '%s' found. " 
 1280                                   "Only the first one will be imported." ), elem.
name );
 
 1286                m_board->GetDesignSettings().m_NetSettings->SetNetclass( nc->GetName(), nc );
 
 1294    m_board->m_LegacyNetclassesLoaded = 
true;
 
 
 1299                                       const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 1306    uint16_t componentId = 0;
 
 1313        std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( 
m_board );
 
 1323        footprint->SetFPID( fpID );
 
 1325        footprint->SetPosition( elem.
position );
 
 1326        footprint->SetOrientationDegrees( elem.
rotation );
 
 1332        if( reference.find_first_not_of( 
"0123456789" ) == wxString::npos )
 
 1333            reference.Prepend( wxT( 
"UNK" ) );
 
 1335        footprint->SetReference( reference );
 
 1340        path.push_back( pathid );
 
 1341        path.push_back( 
id );
 
 1343        footprint->SetPath( 
path );
 
 1347        footprint->SetLocked( elem.
locked );
 
 1348        footprint->Reference().SetVisible( elem.
nameon );
 
 1349        footprint->Value().SetVisible( elem.
commenton );
 
 1359        THROW_IO_ERROR( wxT( 
"Components6 stream is not fully parsed" ) );
 
 
 1366    while( Angle < aMin )
 
 1369    while( Angle >= aMax )
 
 
 1392            m_reporter->Report( wxString::Format( wxT( 
"Model %s not found for footprint %s" ),
 
 1405    if( file->
name.IsEmpty() )
 
 1406        file->
name = model->first.name;
 
 1409    std::vector<char>   decompressedData;
 
 1410    wxMemoryInputStream compressedStream( model->second.data(), model->second.size() );
 
 1411    wxZlibInputStream   zlibStream( compressedStream );
 
 1415    decompressedData.resize( model->second.size() * 6 );
 
 1418    while( !zlibStream.Eof() )
 
 1420        zlibStream.Read( decompressedData.data() + offset, decompressedData.size() - offset );
 
 1421        size_t bytesRead = zlibStream.LastRead();
 
 1426        offset += bytesRead;
 
 1428        if( offset >= decompressedData.size() )
 
 1429            decompressedData.resize( 2 * decompressedData.size() ); 
 
 1432    decompressedData.resize( offset );
 
 1453        orientation              = -orientation;
 
 1460        modelRotation.
x += 180;
 
 1461        modelRotation.
z = -modelRotation.
z;
 
 1475    aFootprint->
Models().push_back( modelSettings );
 
 
 1480                                             const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 1494        if( skipComponentBodies )
 
 1502            THROW_IO_ERROR( wxString::Format( wxT( 
"ComponentsBodies6 stream tries to access " 
 1503                                                   "component id %d of %zu existing components" ),
 
 1518                msg.Printf( wxT( 
"ComponentsBodies6 stream tries to access model id %s which does " 
 1519                                 "not exist" ), elem.
modelId );
 
 1532        wxMemoryInputStream  compressedStream( modelData.
m_data.data(), modelData.
m_data.size() );
 
 1533        wxZlibInputStream    zlibStream( compressedStream );
 
 1534        wxMemoryOutputStream decompressedStream;
 
 1536        zlibStream.Read( decompressedStream );
 
 1559            orientation              = -orientation;
 
 1582        footprint->
Models().push_back( modelSettings );
 
 1586        THROW_IO_ERROR( wxT( 
"ComponentsBodies6 stream is not fully parsed" ) );
 
 
 1593        THROW_IO_ERROR( wxT( 
"Incorrect number of reference points for linear dimension object" ) );
 
 1602                    _( 
"Dimension found on an Altium layer (%d) with no KiCad equivalent. " 
 1603                           "It has been moved to KiCad layer Eco1_User." ), aElem.
layer ),
 
 1616    dimension->SetLayer( klayer );
 
 1617    dimension->SetStart( referencePoint0 );
 
 1619    if( referencePoint0 != aElem.
xy1 )
 
 1631        VECTOR2I     referenceDiff         = referencePoint1 - referencePoint0;
 
 1633        SEG          segm1( referencePoint0, referencePoint0 + directionNormalVector );
 
 1634        SEG          segm2( referencePoint1, referencePoint1 + direction );
 
 1638            THROW_IO_ERROR( wxT( 
"Invalid dimension.  This should never happen." ) );
 
 1640        dimension->SetEnd( *intersection );
 
 1644        if( direction.
Cross( referenceDiff ) > 0 )
 
 1647        dimension->SetHeight( height );
 
 1651        dimension->SetEnd( referencePoint1 );
 
 1654    dimension->SetLineThickness( aElem.
linewidth );
 
 1660    int dist = ( dimension->GetEnd() - dimension->GetStart() ).EuclideanNorm();
 
 1662    if( dist < 3 * dimension->GetArrowLength() )
 
 1666    wxRegEx units( wxS( 
"(mm)|(in)|(mils)|(thou)|(')|(\")" ), wxRE_ADVANCED );
 
 1678    dimension->Text().SetBold( aElem.
textbold );
 
 1681        dimension->SetTextThickness( dimension->GetTextThickness() * 
BOLD_FACTOR );
 
 
 1700        THROW_IO_ERROR( wxT( 
"Not enough reference points for radial dimension object" ) );
 
 1709                _( 
"Dimension found on an Altium layer (%d) with no KiCad equivalent. " 
 1710                   "It has been moved to KiCad layer Eco1_User." ),
 
 1720    std::unique_ptr<PCB_DIM_RADIAL> dimension = std::make_unique<PCB_DIM_RADIAL>( 
m_board );
 
 1723    dimension->SetLayer( klayer );
 
 1724    dimension->SetStart( referencePoint0 );
 
 1725    dimension->SetEnd( aElem.
xy1 );
 
 1726    dimension->SetLineThickness( aElem.
linewidth );
 
 1727    dimension->SetKeepTextAligned( 
false );
 
 1748            m_reporter->Report( wxT( 
"No text position present for leader dimension object" ),
 
 1755    dimension->SetTextPos( aElem.
textPoint.at( 0 ) );
 
 1761    dimension->SetBold( aElem.
textbold );
 
 1764        dimension->SetTextThickness( dimension->GetTextThickness() * 
BOLD_FACTOR );
 
 1772    int yAdjust = dimension->GetTextBox( 
nullptr ).GetCenter().y - dimension->GetTextPos().y;
 
 1773    dimension->SetTextPos( dimension->GetTextPos() + 
VECTOR2I( 0, yAdjust + aElem.
textgap ) );
 
 
 1790            msg.Printf( 
_( 
"Dimension found on an Altium layer (%d) with no KiCad equivalent. " 
 1791                          "It has been moved to KiCad layer Eco1_User." ), aElem.
layer );
 
 1808            shape->SetLayer( klayer );
 
 1810            shape->SetStart( last );
 
 1822            if( dirVec.
x != 0 || dirVec.
y != 0 )
 
 1831                    shape1->SetLayer( klayer );
 
 1833                    shape1->SetStart( referencePoint0 );
 
 1834                    shape1->SetEnd( referencePoint0 + arrVec );
 
 1844                    shape2->SetLayer( klayer );
 
 1846                    shape2->SetStart( referencePoint0 );
 
 1847                    shape2->SetEnd( referencePoint0 + arrVec );
 
 1859            m_reporter->Report( wxT( 
"No text position present for leader dimension object" ),
 
 1866    std::unique_ptr<PCB_TEXT> 
text = std::make_unique<PCB_TEXT>( 
m_board );
 
 1870    text->SetLayer( klayer );
 
 
 1889            msg.Printf( 
_( 
"Dimension found on an Altium layer (%d) with no KiCad equivalent. " 
 1890                           "It has been moved to KiCad layer Eco1_User." ), aElem.
layer );
 
 1901        shape->SetLayer( klayer );
 
 
 1920            msg.Printf( 
_( 
"Dimension found on an Altium layer (%d) with no KiCad equivalent. " 
 1921                           "It has been moved to KiCad layer Eco1_User." ), aElem.
layer );
 
 1931    std::unique_ptr<PCB_DIM_CENTER> dimension = std::make_unique<PCB_DIM_CENTER>( 
m_board );
 
 1933    dimension->SetLayer( klayer );
 
 1934    dimension->SetLineThickness( aElem.
linewidth );
 
 1935    dimension->SetStart( aElem.
xy1 );
 
 1936    dimension->SetEnd( aElem.
xy1 + vec );
 
 
 1943                                       const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 1963                m_reporter->Report( wxString::Format( 
_( 
"Ignored Angular dimension (not yet supported)." ) ),
 
 1976                m_reporter->Report( wxString::Format( 
_( 
"Ignored Datum dimension (not yet supported)." ) ),
 
 1984                m_reporter->Report( wxString::Format( 
_( 
"Ignored Baseline dimension (not yet supported)." ) ),
 
 1994                m_reporter->Report( wxString::Format( 
_( 
"Ignored Linear dimension (not yet supported)." ) ),
 
 2001                m_reporter->Report( wxString::Format( 
_( 
"Ignored Radial dimension (not yet supported)." ) ),
 
 2009                msg.Printf( 
_( 
"Ignored dimension of kind %d (not yet supported)." ), elem.
kind );
 
 2017        THROW_IO_ERROR( wxT( 
"Dimensions6 stream is not fully parsed" ) );
 
 
 2022                                  const CFB::COMPOUND_FILE_ENTRY* aEntry,
 
 2023                                  const std::vector<std::string>& aRootDir )
 
 2034    wxString invalidChars = wxFileName::GetForbiddenChars();
 
 2041        std::vector<std::string> stepPath = aRootDir;
 
 2042        stepPath.emplace_back( std::to_string( idx ) );
 
 2044        bool     validName = !elem.
name.IsEmpty() && elem.
name.IsAscii()
 
 2045                                && wxString::npos == elem.
name.find_first_of( invalidChars );
 
 2046        wxString storageName = validName ? elem.
name : wxString::Format( wxT( 
"model_%d" ), idx );
 
 2050        const CFB::COMPOUND_FILE_ENTRY* stepEntry = aAltiumPcbFile.
FindStream( stepPath );
 
 2052        if( stepEntry == 
nullptr )
 
 2057                msg.Printf( 
_( 
"File not found: '%s'. 3D-model not imported." ), 
FormatPath( stepPath ) );
 
 2064        size_t            stepSize = 
static_cast<size_t>( stepEntry->size );
 
 2065        std::vector<char> stepContent( stepSize );
 
 2073                                                     std::move( stepContent ) ) ) );
 
 2077    std::map<wxString, std::vector<wxString>> nameIdMap;
 
 2080        nameIdMap[data.m_modelname].push_back( 
id );
 
 2082    for( 
auto& [
name, ids] : nameIdMap )
 
 2084        for( 
size_t i = 1; i < ids.size(); i++ )
 
 2086            const wxString& 
id = ids[i];
 
 2093            wxString modelName = modelTuple->second.m_modelname;
 
 2095            if( modelName.Contains( 
"." ) )
 
 2098                wxString baseName = modelName.BeforeLast( 
'.', &ext );
 
 2100                modelTuple->second.m_modelname = baseName + 
'_' + std::to_string( i ) + 
'.' + ext;
 
 2104                modelTuple->second.m_modelname = modelName + 
'_' + std::to_string( i );
 
 
 2115                                 const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 2127        ANET6 elem( reader );
 
 
 2141                                     const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 2184            msg.Printf( 
_( 
"Polygon outline count is %d, expected 1." ), outline.
OutlineCount() );
 
 2192        std::unique_ptr<ZONE> zone = std::make_unique<ZONE>(
m_board);
 
 2198        zone->SetPosition( elem.
vertices.at( 0 ).position );
 
 2199        zone->SetLocked( elem.
locked );
 
 2201        zone->Outline()->AddOutline( outline.
Outline( 0 ) );
 
 2208        int planeLayers = 0;
 
 2209        int signalLayers = 0;
 
 2223        if( planeLayers > 0 && planeClearanceRule )
 
 2226        if( signalLayers > 0 && zoneClearanceRule )
 
 2234        if( polygonConnectRule != 
nullptr )
 
 2253            zone->SetThermalReliefSpokeWidth(
 
 2264            zone->SetAssignedPriority( 1 );
 
 2269                    || zone->GetBoundingBox().Contains( outer_plane->second->GetBoundingBox() ) )
 
 2284                const BOX2I& bbox = zone->GetBoundingBox();
 
 2293                zone->SetHatchOrientation( 
ANGLE_45 );
 
 
 2308                                  const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 2326        std::sort( val.second.begin(), val.second.end(),
 
 2329                    return lhs.priority < rhs.priority;
 
 2342    if( trackWidthRule )
 
 2344        m_board->GetDesignSettings().m_TrackMinWidth = trackWidthRule->
minLimit;
 
 2348    if( routingViasRule )
 
 2350        m_board->GetDesignSettings().m_ViasMinSize = routingViasRule->
minWidth;
 
 2359    if( holeToHoleRule )
 
 2365    if( soldermaskRule )
 
 
 2376                                        const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 2392        THROW_IO_ERROR( wxT( 
"BoardRegions stream is not fully parsed" ) );
 
 
 2396                                              const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 2404    for( 
int primitiveIndex = 0; reader.
GetRemainingBytes() >= 4; primitiveIndex++ )
 
 2423        THROW_IO_ERROR( 
"ShapeBasedRegions6 stream is not fully parsed" );
 
 
 2447        std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( 
m_board );
 
 2449        zone->SetIsRuleArea( 
true );
 
 2457            zone->SetDoNotAllowZoneFills( 
true );
 
 2458            zone->SetDoNotAllowVias( 
false );
 
 2459            zone->SetDoNotAllowTracks( 
false );
 
 2460            zone->SetDoNotAllowPads( 
false );
 
 2461            zone->SetDoNotAllowFootprints( 
false );
 
 2464        zone->SetPosition( aElem.
outline.at( 0 ).position );
 
 2465        zone->Outline()->AddOutline( linechain );
 
 2483                msg.Printf( 
_( 
"Dashed outline found on an Altium layer (%d) with no KiCad equivalent. " 
 2484                               "It has been moved to KiCad layer Eco1_User." ), aElem.
layer );
 
 2505        shape->SetPolyShape( linechain );
 
 2506        shape->SetFilled( 
false );
 
 2507        shape->SetLayer( klayer );
 
 2529            msg.Printf( 
_( 
"Ignored polygon shape of kind %d (not yet supported)." ), aElem.
kind );
 
 
 2538                                                           const int       aPrimitiveIndex )
 
 2554        std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aFootprint );
 
 2556        zone->SetIsRuleArea( 
true );
 
 2564            zone->SetDoNotAllowZoneFills( 
true );
 
 2565            zone->SetDoNotAllowVias( 
false );
 
 2566            zone->SetDoNotAllowTracks( 
false );
 
 2567            zone->SetDoNotAllowPads( 
false );
 
 2568            zone->SetDoNotAllowFootprints( 
false );
 
 2571        zone->SetPosition( aElem.
outline.at( 0 ).position );
 
 2572        zone->Outline()->AddOutline( linechain );
 
 2606                    msg.Printf( 
_( 
"Loading library '%s':\n" 
 2607                                 "Footprint %s contains a dashed outline on Altium layer (%d) with " 
 2608                                 "no KiCad equivalent. It has been moved to KiCad layer Eco1_User." ),
 
 2620                    msg.Printf( 
_( 
"Footprint %s contains a dashed outline on Altium layer (%d) with " 
 2621                                 "no KiCad equivalent. It has been moved to KiCad layer Eco1_User." ),
 
 2643        std::unique_ptr<PCB_SHAPE> shape = std::make_unique<PCB_SHAPE>( aFootprint, 
SHAPE_T::POLY );
 
 2645        shape->SetPolyShape( linechain );
 
 2646        shape->SetFilled( 
false );
 
 2647        shape->SetLayer( klayer );
 
 2663                msg.Printf( 
_( 
"Error loading library '%s':\n" 
 2664                           "Footprint %s contains polygon shape of kind %d (not yet supported)." ),
 
 2676                msg.Printf( 
_( 
"Footprint %s contains polygon shape of kind %d (not yet supported)." ),
 
 
 2704    for( 
const std::vector<ALTIUM_VERTICE>& hole : aElem.
holes )
 
 2712        polySet.
AddHole( hole_linechain );
 
 2717    shape->SetPolyShape( polySet );
 
 2718    shape->SetFilled( 
true );
 
 2719    shape->SetLayer( aLayer );
 
 
 2734                                                                  const int       aPrimitiveIndex )
 
 2751    for( 
const std::vector<ALTIUM_VERTICE>& hole : aElem.
holes )
 
 2759        polySet.
AddHole( hole_linechain );
 
 2762    if( aLayer == 
F_Cu || aLayer == 
B_Cu )
 
 2765        std::unique_ptr<PAD> 
pad = std::make_unique<PAD>( aFootprint );
 
 2768        padLayers.
set( aLayer );
 
 2779        pad->SetPosition( anchorPos );
 
 2782        shapePolys.
Move( -anchorPos );
 
 2786        auto  it = map.find( aPrimitiveIndex );
 
 2788        if( it != map.end() )
 
 2794                pad->SetLocalSolderPasteMargin( 
info.pastemaskexpansionmanual );
 
 2799                pad->SetLocalSolderMaskMargin( 
info.soldermaskexpansionmanual );
 
 2809        pad->SetLayerSet( padLayers );
 
 2815        std::unique_ptr<PCB_SHAPE> shape = std::make_unique<PCB_SHAPE>( aFootprint, 
SHAPE_T::POLY );
 
 2817        shape->SetPolyShape( polySet );
 
 2818        shape->SetFilled( 
true );
 
 2819        shape->SetLayer( aLayer );
 
 
 2828                                    const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 2844                THROW_IO_ERROR(  wxString::Format( 
"Region stream tries to access polygon id %d " 
 2845                                                   "of %d existing polygons.",
 
 2852            if( zone == 
nullptr )
 
 2874            for( 
const std::vector<ALTIUM_VERTICE>& hole : elem.
holes )
 
 2881                hole_linechain.
Append( hole.at( 0 ).position );
 
 2883                fill.
AddHole( hole_linechain );
 
 
 2903                                 const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 2910    for( 
int primitiveIndex = 0; reader.
GetRemainingBytes() >= 4; primitiveIndex++ )
 
 2913        AARC6 elem( reader );
 
 
 2964            THROW_IO_ERROR( wxString::Format( 
"Tracks stream tries to access polygon id %u " 
 2965                                              "of %zu existing polygons.",
 
 2971        if( zone == 
nullptr )
 
 3019    for( 
const auto& layerExpansionMask :
 
 3022        int width = aElem.
width + ( layerExpansionMask.second * 2 );
 
 3026            std::unique_ptr<PCB_SHAPE> arc = std::make_unique<PCB_SHAPE>( 
m_board );
 
 3030            arc->SetLayer( layerExpansionMask.first );
 
 
 3039                                              const int aPrimitiveIndex, 
const bool aIsBoardImport )
 
 3043        wxFAIL_MSG( wxString::Format( 
"Altium: Unexpected footprint Arc with polygon id %d",
 
 3076    for( 
const auto& layerExpansionMask :
 
 3079        int width = aElem.
width + ( layerExpansionMask.second * 2 );
 
 3083            std::unique_ptr<PCB_SHAPE> arc = std::make_unique<PCB_SHAPE>( aFootprint );
 
 3087            arc->SetLayer( layerExpansionMask.first );
 
 
 3119            std::unique_ptr<PCB_ARC> arc = std::make_unique<PCB_ARC>( 
m_board, &shapeArc );
 
 3121            arc->SetWidth( aElem.
width );
 
 3122            arc->SetLayer( aLayer );
 
 3130        std::unique_ptr<PCB_SHAPE> arc = std::make_unique<PCB_SHAPE>(
m_board);
 
 3134        arc->SetLayer( aLayer );
 
 
 3144    std::unique_ptr<PCB_SHAPE> arc = std::make_unique<PCB_SHAPE>( aFootprint );
 
 3148    arc->SetLayer( aLayer );
 
 
 3155                                 const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 3165        APAD6 elem( reader );
 
 
 3194        std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( 
m_board );
 
 3195        footprint->SetPosition( aElem.
position );
 
 
 3206    std::unique_ptr<PAD> 
pad = std::make_unique<PAD>( aFootprint );
 
 3208    pad->SetNumber( 
"" );
 
 3219    pad->SetLayerSet( 
LSET().AllCuMask() );
 
 3246        pad->Padstack().FrontOuterLayers().has_solder_mask = 
true;
 
 3250        pad->Padstack().FrontOuterLayers().has_solder_mask = 
false;
 
 3256        pad->Padstack().BackOuterLayers().has_solder_mask = 
true;
 
 3260        pad->Padstack().BackOuterLayers().has_solder_mask = 
false;
 
 3265        pad->SetLocked( 
true );
 
 
 3295    std::unique_ptr<PAD> 
pad = std::make_unique<PAD>( aFootprint );
 
 3318                    msg.Printf( 
_( 
"Error loading library '%s':\n" 
 3319                               "Footprint %s pad %s is not marked as multilayer, but is a TH pad." ),
 
 3331                    msg.Printf( 
_( 
"Footprint %s pad %s is not marked as multilayer, but is a TH pad." ),
 
 3351                wxFAIL_MSG( wxT( 
"Round holes are handled before the switch" ) );
 
 3360                        msg.Printf( 
_( 
"Loading library '%s':\n" 
 3361                                     "Footprint %s pad %s has a square hole (not yet supported)." ),
 
 3373                        msg.Printf( 
_( 
"Footprint %s pad %s has a square hole (not yet supported)." ),
 
 3408                            msg.Printf( 
_( 
"Loading library '%s':\n" 
 3409                                         "Footprint %s pad %s has a hole-rotation of %d degrees. " 
 3410                                         "KiCad only supports 90 degree rotations." ),
 
 3423                            msg.Printf( 
_( 
"Footprint %s pad %s has a hole-rotation of %d degrees. " 
 3424                                         "KiCad only supports 90 degree rotations." ),
 
 3443                        msg.Printf( 
_( 
"Error loading library '%s':\n" 
 3444                                   "Footprint %s pad %s uses a hole of unknown kind %d." ),
 
 3457                        msg.Printf( 
_( 
"Footprint %s pad %s uses a hole of unknown kind %d." ),
 
 3477    auto setCopperGeometry =
 
 3522                        msg.Printf( 
_( 
"Error loading library '%s':\n" 
 3523                                   "Footprint %s pad %s uses an unknown pad shape." ),
 
 3535                        msg.Printf( 
_( 
"Footprint %s pad %s uses an unknown pad shape." ),
 
 3586    switch( aElem.
layer )
 
 3604        pad->SetLayer( klayer );
 
 3605        pad->SetLayerSet( 
LSET( { klayer } ) );
 
 3616        pad->SetLayerSet( 
pad->GetLayerSet().reset( 
F_Mask ) );
 
 3619        pad->SetLayerSet( 
pad->GetLayerSet().reset( 
B_Mask ) );
 
 
 3637            msg.Printf( 
_( 
"Non-copper pad %s found on an Altium layer (%d) with no KiCad " 
 3638                         "equivalent. It has been moved to KiCad layer Eco1_User." ),
 
 3646    std::unique_ptr<PCB_SHAPE> 
pad = std::make_unique<PCB_SHAPE>( 
m_board );
 
 
 3665                msg.Printf( 
_( 
"Loading library '%s':\n" 
 3666                             "Footprint %s non-copper pad %s found on an Altium layer (%d) with no " 
 3667                             "KiCad equivalent. It has been moved to KiCad layer Eco1_User." ),
 
 3680                msg.Printf( 
_( 
"Footprint %s non-copper pad %s found on an Altium layer (%d) with no " 
 3681                             "KiCad equivalent. It has been moved to KiCad layer Eco1_User." ),
 
 3692    std::unique_ptr<PCB_SHAPE> 
pad = std::make_unique<PCB_SHAPE>( aFootprint );
 
 
 3708            msg.Printf( 
_( 
"Non-copper pad %s is connected to a net, which is not supported." ),
 
 3719            msg.Printf( 
_( 
"Non-copper pad %s has a hole, which is not supported." ), aElem.
name );
 
 3729            msg.Printf( 
_( 
"Non-copper pad %s has a complex pad stack (not yet supported)." ),
 
 3762            int offset = ( std::min( aElem.
topsize.
x, aElem.
topsize.
y ) * cornerradius ) / 200;
 
 3767            if( cornerradius < 100 )
 
 3769                int offsetX = aElem.
topsize.
x / 2 - offset;
 
 3770                int offsetY = aElem.
topsize.
y / 2 - offset;
 
 3863        aShape->
SetPolyPoints( { p11 - chamferX, p11 - chamferY, p12 + chamferY, p12 - chamferX,
 
 3864                                 p22 + chamferX, p22 + chamferY, p21 - chamferY, p21 + chamferX } );
 
 3876            msg.Printf( 
_( 
"Non-copper pad %s uses an unknown pad shape." ), aElem.
name );
 
 
 3886                                 const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 3896        AVIA6 elem( reader );
 
 3898        std::unique_ptr<PCB_VIA> 
via = std::make_unique<PCB_VIA>( 
m_board );
 
 3910        if( start_layer_outside && end_layer_outside )
 
 3914        else if( ( !start_layer_outside ) && ( !end_layer_outside ) )
 
 3937                msg.Printf( 
_( 
"Via from layer %d to %d uses a non-copper layer, which is not " 
 3948        via->SetLayerPair( start_klayer, end_klayer );
 
 3971                wxCHECK2_MSG( altiumLayer < 32, 
break,
 
 3972                              "Altium importer expects 32 or fewer copper layers" );
 
 
 3997                                   const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 4004    for( 
int primitiveIndex = 0; reader.
GetRemainingBytes() >= 4; primitiveIndex++ )
 
 
 4035                msg.Printf( wxT( 
"ATRACK6 stream tries to access polygon id %u " 
 4036                                 "of %u existing polygons; skipping it" ),
 
 4037                            static_cast<unsigned>( aElem.
polygon ),
 
 4038                            static_cast<unsigned>( 
m_polygons.size() ) );
 
 4047        if( zone == 
nullptr )
 
 4097        int width = aElem.
width + ( layerExpansionMask.second * 2 );
 
 4102            seg->SetStart( aElem.
start );
 
 4103            seg->SetEnd( aElem.
end );
 
 4105            seg->SetLayer( layerExpansionMask.first );
 
 
 4114                                                const int  aPrimitiveIndex,
 
 4115                                                const bool aIsBoardImport )
 
 4119        wxFAIL_MSG( wxString::Format( 
"Altium: Unexpected footprint Track with polygon id %u",
 
 4155        int width = aElem.
width + ( layerExpansionMask.second * 2 );
 
 4158            std::unique_ptr<PCB_SHAPE> seg = std::make_unique<PCB_SHAPE>( aFootprint, 
SHAPE_T::SEGMENT );
 
 4160            seg->SetStart( aElem.
start );
 
 4161            seg->SetEnd( aElem.
end );
 
 4163            seg->SetLayer( layerExpansionMask.first );
 
 
 4175        std::unique_ptr<PCB_TRACK> track = std::make_unique<PCB_TRACK>( 
m_board );
 
 4177        track->SetStart( aElem.
start );
 
 4178        track->SetEnd( aElem.
end );
 
 4179        track->SetWidth( aElem.
width );
 
 4180        track->SetLayer( aLayer );
 
 4189        seg->SetStart( aElem.
start );
 
 4190        seg->SetEnd( aElem.
end );
 
 4192        seg->SetLayer( aLayer );
 
 
 4202    std::unique_ptr<PCB_SHAPE> seg = std::make_unique<PCB_SHAPE>( aFootprint, 
SHAPE_T::SEGMENT );
 
 4204    seg->SetStart( aElem.
start );
 
 4205    seg->SetEnd( aElem.
end );
 
 4207    seg->SetLayer( aLayer );
 
 
 4214                                        const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 4224        THROW_IO_ERROR( wxT( 
"WideStrings6 stream is not fully parsed" ) );
 
 
 4228                                  const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 
 4286    std::unique_ptr<PCB_TEXTBOX> pcbTextbox = std::make_unique<PCB_TEXTBOX>( 
m_board );
 
 4287    std::unique_ptr<PCB_TEXT>    pcbText = std::make_unique<PCB_TEXT>( 
m_board );
 
 4291    static const std::map<wxString, wxString> variableMap = {
 
 4292        { 
"LAYER_NAME", 
"LAYER" },
 
 4293        { 
"PRINT_DATE", 
"CURRENT_DATE"},
 
 4303        item = pcbTextbox.get();
 
 4304        text = pcbTextbox.get();
 
 4315    text->SetText( kicadText );
 
 
 4329    std::unique_ptr<PCB_TEXTBOX> fpTextbox = std::make_unique<PCB_TEXTBOX>( aFootprint );
 
 4330    std::unique_ptr<PCB_TEXT> fpText = std::make_unique<PCB_TEXT>( aFootprint );
 
 4347        item = &aFootprint->
Value(); 
 
 4349        field = &aFootprint->
Value();
 
 4353        item = fpText.get();
 
 4354        text = fpText.get();
 
 4358    static const std::map<wxString, wxString> variableMap = {
 
 4359        { 
"DESIGNATOR", 
"REFERENCE" },
 
 4360        { 
"COMMENT",    
"VALUE" },
 
 4361        { 
"VALUE",      
"ALTIUM_VALUE" },
 
 4362        { 
"LAYER_NAME", 
"LAYER" },
 
 4363        { 
"PRINT_DATE", 
"CURRENT_DATE"},
 
 4368        item = fpTextbox.get();
 
 4369        text = fpTextbox.get();
 
 4382    text->SetText( kicadText );
 
 4383    text->SetKeepUpright( 
false );
 
 
 4399    std::unique_ptr<PCB_BARCODE> pcbBarcode = std::make_unique<PCB_BARCODE>( 
m_board );
 
 4401    pcbBarcode->SetLayer( aLayer );
 
 4402    pcbBarcode->SetPosition( aElem.
position );
 
 4406    pcbBarcode->SetText( aElem.
text );
 
 4416    pcbBarcode->AssembleBarcode();
 
 
 4425    std::unique_ptr<PCB_BARCODE> fpBarcode = std::make_unique<PCB_BARCODE>( aFootprint );
 
 4427    fpBarcode->SetLayer( aLayer );
 
 4428    fpBarcode->SetPosition( aElem.
position );
 
 4432    fpBarcode->SetText( aElem.
text );
 
 4442    fpBarcode->AssembleBarcode();
 
 
 4471        kicadMargin = 
VECTOR2I( charWidth * 0.933, charHeight * 0.67 );
 
 4473        kicadMargin = 
VECTOR2I( charWidth * 0.808, charHeight * 0.844 );
 
 4476                        + kicadMargin * 2 - margin * 2 );
 
 4478    kposition = kposition - kicadMargin + margin;
 
 4496    switch( justification )
 
 4520            msg.Printf( 
_( 
"Unknown textbox justification %d, aText %s" ), justification,
 
 
 4540    int rectHeight = aElem.
height;
 
 4543        rectWidth = -rectWidth;
 
 4549    switch( justification )
 
 4555        kposition.
y -= rectHeight;
 
 4561        kposition.
y -= rectHeight / 2;
 
 4571        kposition.
x += rectWidth / 2;
 
 4572        kposition.
y -= rectHeight;
 
 4578        kposition.
x += rectWidth / 2;
 
 4579        kposition.
y -= rectHeight / 2;
 
 4585        kposition.
x += rectWidth / 2;
 
 4591        kposition.
x += rectWidth;
 
 4592        kposition.
y -= rectHeight;
 
 4598        kposition.
x += rectWidth;
 
 4599        kposition.
y -= rectHeight / 2;
 
 4605        kposition.
x += rectWidth;
 
 
 4658            if( font->
GetName().Contains( wxS( 
"Arial" ) ) )
 
 
 4673                                  const CFB::COMPOUND_FILE_ENTRY* aEntry )
 
 
 4731                                               const bool aIsBoardImport )
 
 
 4773    fill->SetFilled( 
true );
 
 4774    fill->SetLayer( aLayer );
 
 4777    fill->SetStart( aElem.
pos1 );
 
 4778    fill->SetEnd( aElem.
pos2 );
 
 
 4800    if( aLayer == 
F_Cu || aLayer == 
B_Cu )
 
 4802        std::unique_ptr<PAD> 
pad = std::make_unique<PAD>( aFootprint );
 
 4805        padLayers.
set( aLayer );
 
 4820                std::swap( width, height );
 
 4823            pad->SetPosition( aElem.
pos1 / 2 + aElem.
pos2 / 2 );
 
 4835            pad->SetPosition( anchorPos );
 
 4846                             aElem.
pos1.
y / 2 + aElem.
pos2.
y / 2 - anchorPos.
y );
 
 4848            pad->AddPrimitivePoly( 
F_Cu, shapePolys, 0, 
true );
 
 4852        pad->SetLayerSet( padLayers );
 
 4858        std::unique_ptr<PCB_SHAPE> fill =
 
 4861        fill->SetFilled( 
true );
 
 4862        fill->SetLayer( aLayer );
 
 4865        fill->SetStart( aElem.
pos1 );
 
 4866        fill->SetEnd( aElem.
pos2 );
 
 
 4885        layerSet.
set( klayer );
 
 
 4893    bool keepoutRestrictionVia = ( aKeepoutRestrictions & 0x01 ) != 0;
 
 4894    bool keepoutRestrictionTrack = ( aKeepoutRestrictions & 0x02 ) != 0;
 
 4895    bool keepoutRestrictionCopper = ( aKeepoutRestrictions & 0x04 ) != 0;
 
 4896    bool keepoutRestrictionSMDPad = ( aKeepoutRestrictions & 0x08 ) != 0;
 
 4897    bool keepoutRestrictionTHPad = ( aKeepoutRestrictions & 0x10 ) != 0;
 
 
 4909                                                     const uint8_t      aKeepoutRestrictions )
 
 4911    std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( 
m_board );
 
 4913    zone->SetIsRuleArea( 
true );
 
 
 4930                                                         const uint8_t      aKeepoutRestrictions )
 
 4932    std::unique_ptr<ZONE> zone = std::make_unique<ZONE>( aFootprint );
 
 4934    zone->SetIsRuleArea( 
true );
 
 
 4958    if( elems.first == elems.second )
 
 4961    std::vector<std::pair<PCB_LAYER_ID, int>> layerExpansionPairs;
 
 4963    for( 
auto it = elems.first; it != elems.second; ++it )
 
 5003    return layerExpansionPairs;
 
 
std::string FormatPath(const std::vector< std::string > &aVectorPath)
Helper for debug logging (vector -> string)
 
const uint16_t ALTIUM_NET_UNCONNECTED
 
const uint16_t ALTIUM_POLYGON_NONE
 
const uint16_t ALTIUM_POLYGON_BOARD
 
const int ALTIUM_COMPONENT_NONE
 
LIB_ID AltiumToKiCadLibID(const wxString &aLibName, const wxString &aLibReference)
 
wxString AltiumPcbSpecialStringsToKiCadStrings(const wxString &aString, const std::map< wxString, wxString > &aOverrides)
 
void HelperShapeLineChainFromAltiumVertices(SHAPE_LINE_CHAIN &aLine, const std::vector< ALTIUM_VERTICE > &aVertices)
 
double normalizeAngleDegrees(double Angle, double aMin, double aMax)
Normalize angle to be aMin < angle <= aMax angle is in degrees.
 
constexpr double BOLD_FACTOR
 
bool IsAltiumLayerCopper(ALTIUM_LAYER aLayer)
 
bool IsAltiumLayerAPlane(ALTIUM_LAYER aLayer)
 
@ EXTENDPRIMITIVEINFORMATION
 
std::function< void(const ALTIUM_PCB_COMPOUND_FILE &, const CFB::COMPOUND_FILE_ENTRY *)> PARSE_FUNCTION_POINTER_fp
 
constexpr int ARC_HIGH_DEF
 
constexpr EDA_IU_SCALE pcbIUScale
 
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
 
#define DEFAULT_BOARD_THICKNESS_MM
 
@ BS_ITEM_TYPE_DIELECTRIC
 
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
 
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
 
size_t GetRemainingBytes() const
 
std::map< uint32_t, wxString > ReadWideStringTable()
 
size_t ReadAndSetSubrecordLength()
 
std::map< wxString, wxString > ReadProperties(std::function< std::map< wxString, wxString >(const std::string &)> handleBinaryData=[](const std::string &) { return std::map< wxString, wxString >();})
 
const CFB::CompoundFileReader & GetCompoundFileReader() const
 
const CFB::COMPOUND_FILE_ENTRY * FindStream(const std::vector< std::string > &aStreamPath) const
 
const std::pair< AMODEL, std::vector< char > > * GetLibModel(const wxString &aModelID) const
 
std::tuple< wxString, const CFB::COMPOUND_FILE_ENTRY * > FindLibFootprintDirName(const wxString &aFpUnicodeName)
 
PROGRESS_REPORTER * m_progressReporter
optional; may be nullptr
 
void ParseClasses6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
std::vector< PCB_DIM_RADIAL * > m_radialDimensions
 
void ConvertArcs6ToFootprintItemOnLayer(FOOTPRINT *aFootprint, const AARC6 &aElem, PCB_LAYER_ID aLayer)
 
void ConvertTracks6ToBoardItem(const ATRACK6 &aElem, const int aPrimitiveIndex)
 
void ConvertTracks6ToFootprintItem(FOOTPRINT *aFootprint, const ATRACK6 &aElem, const int aPrimitiveIndex, const bool aIsBoardImport)
 
int m_highest_pour_index
Altium stores pour order across all layers.
 
void ConvertTexts6ToFootprintItemOnLayer(FOOTPRINT *aFootprint, const ATEXT6 &aElem, PCB_LAYER_ID aLayer)
 
std::map< ALTIUM_LAYER, PCB_LAYER_ID > m_layermap
 
void ConvertShapeBasedRegions6ToBoardItemOnLayer(const AREGION6 &aElem, PCB_LAYER_ID aLayer)
 
void ParseVias6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void HelperParseDimensions6Leader(const ADIMENSION6 &aElem)
 
wxString m_footprintName
for footprint library loading error reporting
 
std::vector< FOOTPRINT * > m_components
 
void ParseShapeBasedRegions6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
const ARULE6 * GetRuleDefault(ALTIUM_RULE_KIND aKind) const
 
void HelperParsePad6NonCopper(const APAD6 &aElem, PCB_LAYER_ID aLayer, PCB_SHAPE *aShape)
 
void ParseRegions6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
std::vector< PCB_LAYER_ID > GetKicadLayersToIterate(ALTIUM_LAYER aAltiumLayer) const
 
void ConvertShapeBasedRegions6ToFootprintItem(FOOTPRINT *aFootprint, const AREGION6 &aElem, const int aPrimitiveIndex)
 
void HelperPcpShapeAsFootprintKeepoutRegion(FOOTPRINT *aFootprint, const PCB_SHAPE &aShape, const ALTIUM_LAYER aAltiumLayer, const uint8_t aKeepoutRestrictions)
 
void ConvertArcs6ToBoardItem(const AARC6 &aElem, const int aPrimitiveIndex)
 
void ConvertShapeBasedRegions6ToFootprintItemOnLayer(FOOTPRINT *aFootprint, const AREGION6 &aElem, PCB_LAYER_ID aLayer, const int aPrimitiveIndex)
 
std::map< ALTIUM_LAYER, ZONE * > m_outer_plane
 
std::vector< int > m_altiumToKicadNetcodes
 
unsigned m_totalCount
for progress reporting
 
void ParseComponents6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void HelperPcpShapeAsBoardKeepoutRegion(const PCB_SHAPE &aShape, const ALTIUM_LAYER aAltiumLayer, const uint8_t aKeepoutRestrictions)
 
std::map< wxString, ALTIUM_EMBEDDED_MODEL_DATA > m_EmbeddedModels
 
void ConvertFills6ToBoardItemOnLayer(const AFILL6 &aElem, PCB_LAYER_ID aLayer)
 
std::vector< std::pair< PCB_LAYER_ID, int > > HelperGetSolderAndPasteMaskExpansions(const ALTIUM_RECORD aType, const int aPrimitiveIndex, const ALTIUM_LAYER aAltiumLayer)
 
void ConvertBarcodes6ToBoardItemOnLayer(const ATEXT6 &aElem, PCB_LAYER_ID aLayer)
 
void ConvertComponentBody6ToFootprintItem(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, FOOTPRINT *aFootprint, const ACOMPONENTBODY6 &aElem)
 
void HelperSetTextAlignmentAndPos(const ATEXT6 &aElem, EDA_TEXT *aEdaText)
 
void ParseBoard6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void ConvertFills6ToFootprintItem(FOOTPRINT *aFootprint, const AFILL6 &aElem, const bool aIsBoardImport)
 
void ParseExtendedPrimitiveInformationData(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void ParseFileHeader(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void ConvertShapeBasedRegions6ToBoardItem(const AREGION6 &aElem)
 
void HelperCreateBoardOutline(const std::vector< ALTIUM_VERTICE > &aVertices)
 
std::map< ALTIUM_RULE_KIND, std::vector< ARULE6 > > m_rules
 
void ConvertVias6ToFootprintItem(FOOTPRINT *aFootprint, const AVIA6 &aElem)
 
void ParseRules6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void HelperSetZoneKeepoutRestrictions(ZONE &aZone, const uint8_t aKeepoutRestrictions)
 
void HelperParseDimensions6Linear(const ADIMENSION6 &aElem)
 
void ParseTracks6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
std::map< uint32_t, wxString > m_unicodeStrings
 
void ConvertTexts6ToBoardItem(const ATEXT6 &aElem)
 
void HelperParseDimensions6Center(const ADIMENSION6 &aElem)
 
void HelperParseDimensions6Radial(const ADIMENSION6 &aElem)
 
void ParseBoardRegionsData(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void ParseArcs6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void ConvertTexts6ToBoardItemOnLayer(const ATEXT6 &aElem, PCB_LAYER_ID aLayer)
 
void ConvertPads6ToFootprintItemOnCopper(FOOTPRINT *aFootprint, const APAD6 &aElem)
 
FOOTPRINT * ParseFootprint(ALTIUM_PCB_COMPOUND_FILE &altiumLibFile, const wxString &aFootprintName)
 
REPORTER * m_reporter
optional; may be nullptr
 
int GetNetCode(uint16_t aId) const
 
void ConvertTexts6ToEdaTextSettings(const ATEXT6 &aElem, EDA_TEXT &aEdaText)
 
wxString m_library
for footprint library loading error reporting
 
void ConvertPads6ToFootprintItemOnNonCopper(FOOTPRINT *aFootprint, const APAD6 &aElem)
 
void ConvertTexts6ToFootprintItem(FOOTPRINT *aFootprint, const ATEXT6 &aElem)
 
unsigned m_lastProgressCount
 
void ParseFills6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void ConvertArcs6ToFootprintItem(FOOTPRINT *aFootprint, const AARC6 &aElem, const int aPrimitiveIndex, const bool aIsBoardImport)
 
void HelperParseDimensions6Datum(const ADIMENSION6 &aElem)
 
void ConvertPads6ToBoardItem(const APAD6 &aElem)
 
void ConvertFills6ToFootprintItemOnLayer(FOOTPRINT *aFootprint, const AFILL6 &aElem, PCB_LAYER_ID aLayer)
 
void ParseWideStrings6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void remapUnsureLayers(std::vector< ABOARD6_LAYER_STACKUP > &aStackup)
 
std::vector< ZONE * > m_polygons
 
void ParsePads6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void ConvertArcs6ToPcbShape(const AARC6 &aElem, PCB_SHAPE *aShape)
 
void ConvertTracks6ToBoardItemOnLayer(const ATRACK6 &aElem, PCB_LAYER_ID aLayer)
 
void ConvertFills6ToBoardItem(const AFILL6 &aElem)
 
FOOTPRINT * HelperGetFootprint(uint16_t aComponent) const
 
LAYER_MAPPING_HANDLER m_layerMappingHandler
 
void ParsePolygons6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
PCB_LAYER_ID GetKicadLayer(ALTIUM_LAYER aAltiumLayer) const
 
void ParseComponentsBodies6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void ConvertTracks6ToFootprintItemOnLayer(FOOTPRINT *aFootprint, const ATRACK6 &aElem, PCB_LAYER_ID aLayer)
 
void Parse(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const std::map< ALTIUM_PCB_DIR, std::string > &aFileMapping)
 
ALTIUM_PCB(BOARD *aBoard, PROGRESS_REPORTER *aProgressReporter, LAYER_MAPPING_HANDLER &aLayerMappingHandler, REPORTER *aReporter=nullptr, const wxString &aLibrary=wxEmptyString, const wxString &aFootprintName=wxEmptyString)
 
void ConvertArcs6ToBoardItemOnLayer(const AARC6 &aElem, PCB_LAYER_ID aLayer)
 
void ParseTexts6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
std::map< ALTIUM_RECORD, std::multimap< int, const AEXTENDED_PRIMITIVE_INFORMATION > > m_extendedPrimitiveInformationMaps
 
void ParseModelsData(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry, const std::vector< std::string > &aRootDir)
 
std::map< ALTIUM_LAYER, wxString > m_layerNames
 
void ConvertPads6ToBoardItemOnNonCopper(const APAD6 &aElem)
 
void HelperSetTextboxAlignmentAndPos(const ATEXT6 &aElem, PCB_TEXTBOX *aPcbTextbox)
 
void ConvertBarcodes6ToFootprintItemOnLayer(FOOTPRINT *aFootprint, const ATEXT6 &aElem, PCB_LAYER_ID aLayer)
 
void ParseNets6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void ConvertPads6ToFootprintItem(FOOTPRINT *aFootprint, const APAD6 &aElem)
 
const ARULE6 * GetRule(ALTIUM_RULE_KIND aKind, const wxString &aName) const
 
void ParseDimensions6Data(const ALTIUM_PCB_COMPOUND_FILE &aAltiumPcbFile, const CFB::COMPOUND_FILE_ENTRY *aEntry)
 
void HelperSetZoneLayers(ZONE &aZone, const ALTIUM_LAYER aAltiumLayer)
 
static wxString ReadString(const std::map< wxString, wxString > &aProps, const wxString &aKey, const wxString &aDefault)
 
BASE_SET & set(size_t pos)
 
Container for design settings for a BOARD object.
 
void SetGridOrigin(const VECTOR2I &aOrigin)
 
const VECTOR2I & GetGridOrigin() const
 
void SetAuxOrigin(const VECTOR2I &aOrigin)
 
const VECTOR2I & GetAuxOrigin() const
 
BOARD_STACKUP & GetStackupDescriptor()
 
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
 
virtual void SetIsKnockout(bool aKnockout)
 
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
 
virtual LSET BoardLayerSet() const
Return the LSET for the board that this item resides on.
 
Manage layers needed to make a physical board.
 
void RemoveAll()
Delete all items in list and clear the list.
 
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
 
int BuildBoardThicknessFromStackup() const
 
void BuildDefaultStackupList(const BOARD_DESIGN_SETTINGS *aSettings, int aActiveCopperLayersCount=0)
Create a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
 
Information pertinent to a Pcbnew printed circuit board.
 
constexpr coord_type GetY() const
 
constexpr size_type GetWidth() const
 
constexpr coord_type GetX() const
 
constexpr size_type GetHeight() const
 
bool IsHorizontal() const
 
bool IsCardinal90() const
 
EDA_ANGLE GetArcAngle() const
 
void SetCenter(const VECTOR2I &aCenter)
 
virtual void SetFilled(bool aFlag)
 
void SetStart(const VECTOR2I &aStart)
 
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
 
void SetShape(SHAPE_T aShape)
 
void SetEnd(const VECTOR2I &aEnd)
 
void SetArcAngleAndEnd(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
 
void SetPolyPoints(const std::vector< VECTOR2I > &aPoints)
 
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
 
int GetTextHeight() const
 
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
 
void SetTextPos(const VECTOR2I &aPoint)
 
KIFONT::FONT * GetFont() const
 
void SetMirrored(bool isMirrored)
 
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
 
void SetBoldFlag(bool aBold)
Set only the bold flag, without changing the font.
 
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
 
GR_TEXT_V_ALIGN_T GetVertJustify() const
 
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
 
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
 
void SetFont(KIFONT::FONT *aFont)
 
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
 
wxString GetEmbeddedFileLink(const EMBEDDED_FILE &aFile) const
Return the link for an embedded file.
 
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Load a file from disk and adds it to the collection.
 
static RETURN_CODE CompressAndEncode(EMBEDDED_FILE &aFile)
Take data from the #decompressedData buffer and compresses it using ZSTD into the #compressedEncodedD...
 
VECTOR3D m_Offset
3D model offset (mm)
 
VECTOR3D m_Rotation
3D model rotation (degrees)
 
wxString m_Filename
The 3D shape filename in 3D library.
 
FONT is an abstract base class for both outline and stroke fonts.
 
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
 
virtual bool IsStroke() const
 
const wxString & GetName() const
 
virtual bool IsOutline() const
 
LAYER_RANGE_ITERATOR begin() const
 
A logical library item identifier and consists of various portions much like a URI.
 
LSET is a set of PCB_LAYER_IDs.
 
static const LSET & AllBoardTechMask()
Return a mask holding board technical layers (no CU layer) on both side.
 
static const LSET & UserMask()
 
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
 
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
 
Handle the data for a net.
 
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
 
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
 
void SetRoundRectRadiusRatio(double aRatio, PCB_LAYER_ID aLayer)
 
void SetChamferRatio(double aRatio, PCB_LAYER_ID aLayer)
 
void SetShape(PAD_SHAPE aShape, PCB_LAYER_ID aLayer)
 
void SetChamferPositions(int aPositions, PCB_LAYER_ID aLayer)
 
@ 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)
 
void SetSize(const VECTOR2I &aSize, PCB_LAYER_ID aLayer)
 
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
 
static constexpr PCB_LAYER_ID INNER_LAYERS
! The layer identifier to use for "inner layers" on top/inner/bottom padstacks
 
static LSET PTHMask()
layer set for a through hole pad
 
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
 
static LSET SMDMask()
layer set for a SMD pad on Front layer
 
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
 
A radial dimension indicates either the radius or diameter of an arc or circle.
 
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
 
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
 
void SetPosition(const VECTOR2I &aPos) override
 
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
 
void SetStroke(const STROKE_PARAMS &aStroke) override
 
VECTOR2I GetPosition() const override
 
void SetBorderEnabled(bool enabled)
 
void SetMarginTop(int aTop)
 
void SetMarginLeft(int aLeft)
 
void SetMarginBottom(int aBottom)
 
void SetTextAngle(const EDA_ANGLE &aAngle) override
 
void SetMarginRight(int aRight)
 
A progress reporter interface for use in multi-threaded environments.
 
A pure virtual class used to derive REPORTER objects from.
 
OPT_VECTOR2I Intersect(const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false) const
Compute intersection point of segment (this) with segment aSeg.
 
const VECTOR2I & GetArcMid() const
 
const VECTOR2I & GetP1() const
 
const VECTOR2I & GetP0() const
 
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
 
const SHAPE_ARC & Arc(size_t aArc) const
 
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
 
int PointCount() const
Return the number of points (vertices) in this line chain.
 
ssize_t ArcIndex(size_t aSegment) const
Return the arc index for the given segment index.
 
SEG Segment(int aIndex) const
Return a copy of the aIndex-th segment in the line chain.
 
int NextShape(int aPointIndex) const
Return the vertex index of the next shape in the chain, or -1 if aPointIndex is the last shape.
 
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
 
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
 
bool IsArcStart(size_t aIndex) const
 
Represent a set of closed polygons.
 
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
 
void BooleanAdd(const SHAPE_POLY_SET &b)
Perform boolean polyset union.
 
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
 
void Fracture()
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
 
void Inflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false)
Perform outline inflation/deflation.
 
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)
 
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Adds a new hole to the given outline (default: last) and returns its index.
 
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.
 
int OutlineCount() const
Return the number of outlines in the set.
 
void Move(const VECTOR2I &aVector) override
 
Simple container to manage line stroke parameters.
 
constexpr extended_type Cross(const VECTOR2< T > &aVector) const
Compute cross product of self with aVector.
 
double Distance(const VECTOR2< extended_type > &aVector) const
Compute the distance between two vectors.
 
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
 
constexpr VECTOR2< T > Perpendicular() const
Compute the perpendicular vector.
 
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
 
Handle a list of polygons defining a copper zone.
 
void SetNeedRefill(bool aNeedRefill)
 
void SetDoNotAllowPads(bool aEnable)
 
SHAPE_POLY_SET * GetFill(PCB_LAYER_ID aLayer)
 
void SetDoNotAllowTracks(bool aEnable)
 
void SetFilledPolysList(PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
Set the list of filled polygons.
 
void SetIsFilled(bool isFilled)
 
bool HasFilledPolysForLayer(PCB_LAYER_ID aLayer) const
 
void SetLayerSet(const LSET &aLayerSet) override
 
void SetDoNotAllowVias(bool aEnable)
 
void SetDoNotAllowFootprints(bool aEnable)
 
void SetDoNotAllowZoneFills(bool aEnable)
 
static int GetDefaultHatchPitch()
 
@ CHAMFER_ACUTE_CORNERS
Acute angles are chamfered.
 
static constexpr EDA_ANGLE ANGLE_90
 
static constexpr EDA_ANGLE ANGLE_45
 
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
 
bool m_ImportSkipComponentBodies
Skip importing component bodies when importing some format files, such as Altium.
 
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
 
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
 
size_t CopperLayerToOrdinal(PCB_LAYER_ID aLayer)
Converts KiCad copper layer enum to an ordinal between the front and back layers.
 
PCB_LAYER_ID
A quick note on layer IDs:
 
void for_all_pairs(_InputIterator __first, _InputIterator __last, _Function __f)
Apply a function to every possible pair of elements of a sequence.
 
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.
 
BARCODE class definition.
 
std::function< std::map< wxString, PCB_LAYER_ID >(const std::vector< INPUT_LAYER_DESC > &)> LAYER_MAPPING_HANDLER
Pointer to a function that takes a map of source and KiCad layers and returns a re-mapped version.
 
std::optional< VECTOR2I > OPT_VECTOR2I
 
wxString NotSpecifiedPrm()
 
uint8_t keepoutrestrictions
 
wxString dielectricmaterial
 
std::vector< ABOARD6_LAYER_STACKUP > stackup
 
std::vector< ALTIUM_VERTICE > board_vertices
 
std::vector< wxString > names
 
wxString sourceHierachicalPath
 
wxString sourcefootprintlibrary
 
wxString sourcedesignator
 
std::vector< VECTOR2I > textPoint
 
ALTIUM_DIMENSION_KIND kind
 
std::vector< VECTOR2I > referencePoint
 
uint8_t keepoutrestrictions
 
std::vector< char > m_data
 
ALTIUM_PAD_SHAPE inner_shape[29]
 
ALTIUM_PAD_HOLE_SHAPE holeshape
 
ALTIUM_PAD_SHAPE_ALT alt_shape[32]
 
int32_t soldermaskexpansionmanual
 
std::unique_ptr< APAD6_SIZE_AND_SHAPE > sizeAndShape
 
ALTIUM_PAD_SHAPE topshape
 
ALTIUM_MODE pastemaskexpansionmode
 
ALTIUM_MODE soldermaskexpansionmode
 
ALTIUM_PAD_SHAPE botshape
 
ALTIUM_PAD_SHAPE midshape
 
int32_t pastemaskexpansionmanual
 
int32_t pad_to_die_length
 
std::vector< ALTIUM_VERTICE > vertices
 
ALTIUM_POLYGON_HATCHSTYLE hatchstyle
 
uint8_t keepoutrestrictions
 
std::vector< ALTIUM_VERTICE > outline
 
std::vector< std::vector< ALTIUM_VERTICE > > holes
 
ALTIUM_CONNECT_STYLE polygonconnectStyle
 
int planeclearanceClearance
 
int32_t polygonconnectReliefconductorwidth
 
int32_t polygonconnectAirgapwidth
 
uint32_t text_offset_width
 
uint32_t textbox_rect_height
 
ALTIUM_TEXT_POSITION textbox_rect_justification
 
uint32_t textbox_rect_width
 
uint32_t margin_border_width
 
bool isJustificationValid
 
ALTIUM_BARCODE_TYPE barcode_type
 
ALTIUM_TEXT_TYPE fonttype
 
uint8_t keepoutrestrictions
 
int32_t soldermask_expansion_front
 
bool soldermask_expansion_manual
 
int32_t soldermask_expansion_back
 
uint32_t diameter_by_layer[32]
 
std::vector< char > decompressedData
 
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.
 
double DEG2RAD(double deg)
 
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
 
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
 
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
 
VECTOR2< int32_t > VECTOR2I
 
VECTOR3< double > VECTOR3D
 
@ THERMAL
Use thermal relief for pads.
 
@ NONE
Pads are not covered.
 
@ FULL
pads are covered by copper