62    wxString libName = aFileName.GetName();
 
   64    if( libName.IsEmpty() && aRootSheet )
 
   67        libName = fn.GetName();
 
   70    if( libName.IsEmpty() )
 
 
   89        THROW_IO_ERROR( 
_( 
"File does not appear to be a CADSTAR parts Library file" ) );
 
  101    std::vector<LIB_SYMBOL*> retVal;
 
  105        std::unique_ptr<LIB_SYMBOL> loadedPart = 
loadLibPart( part );
 
  110            retVal.push_back( loadedPart.release() );
 
 
  117std::unique_ptr<LIB_SYMBOL>
 
  121    std::unique_ptr<LIB_SYMBOL> retSym;
 
  131        if( !
Library.SymbolDefinitions.count( symbolID ) )
 
  133            m_reporter->Report( wxString::Format( 
_( 
"Unable to find symbol %s, referenced by part " 
  134                                                     "%s. The part was not loaded." ),
 
  143        std::unique_ptr<LIB_SYMBOL> kiSymDef( 
loadSymdef( symbolID )->Duplicate() );
 
  145        if( (
int)sym.
m_Pins.size() != kiSymDef->GetPinCount() )
 
  147            m_reporter->Report( wxString::Format( 
_( 
"Inconsistent pin numbers in symbol %s " 
  148                                                     "compared to the one defined in part %s. The " 
  149                                                     "part was not loaded." ),
 
  163            wxCHECK( termID > 0 && sym.
m_Pins.size() >= 
size_t( termID ), 
nullptr );
 
  164            SCH_PIN* 
pin = kiSymDef->GetPin( storedPinNum );
 
  165            size_t   termIdx = size_t( termID ) - 1;
 
  174            wxString partPinNum = wxString::Format( 
"%ld", sym.
m_Pins[termIdx].m_Identifier );
 
  175            pin->SetNumber( partPinNum );
 
  189            wxCHECK( kiSymDef->GetUnitCount() == 1, 
nullptr );
 
  191            retSym = std::move( kiSymDef );
 
  193            retSym->SetUnitCount( aPart.
m_Symbols.size(), 
true );
 
  195            retSym->SetName( escapedPartName );
 
  197            retSym->GetValueField().SetText( aPart.
m_Value.value_or( 
"" ) );
 
  199            retSym->SetDescription( aPart.
m_Description.value_or( 
"" ) );
 
  201            auto addFieldIfHasValue =
 
  202                    [&]( 
const wxString& 
name, 
const std::optional<std::string>& value )
 
  204                        if( value.has_value() )
 
  217                wxString modelVal = wxString::Format( 
"model=\"%s\"", aPart.
m_SpiceModel.value() );
 
  244            VECTOR2I symCenter = retSym->GetBodyBoundingBox( unit, 0, 
false, 
false ).GetCenter();
 
  245            symCenter.
y = -symCenter.
y; 
 
  251            for( 
auto& [signalName, csPinVector] : aPart.
m_HiddenPins )
 
  255                    std::unique_ptr<SCH_PIN> 
pin = std::make_unique<SCH_PIN>( retSym.get() );
 
  257                    long pinNum = csPin.m_Identifier;
 
  258                    pin->SetNumber( wxString::Format( 
"%ld", pinNum ) );
 
  259                    pin->SetName( signalName );
 
  262                    pin->SetVisible( 
false );
 
  272                        direction = { -direction.
y, direction.
x };
 
  277                    pin->SetPosition( symCenter + offset );
 
  280                    pin->SetUnit( unit );
 
  281                    retSym->AddDrawItem( 
pin.release() );
 
 
  301                                                  std::unique_ptr<LIB_SYMBOL>& aDestSym,
 
  302                                                  int aDestUnit, 
bool aOverrideFields )
 
  305    for( 
SCH_ITEM* item : aDestSym->GetUnitDrawItems( aDestUnit, 0  ) )
 
  306        aDestSym->RemoveDrawItem( item );
 
  309    for( 
SCH_ITEM* newItem : aSourceSym->GetUnitDrawItems( 1, 0  ) )
 
  313        itemCopy->
SetUnit( aDestUnit );
 
  314        aDestSym->AddDrawItem( itemCopy );
 
  318    if( aOverrideFields )
 
  320        std::vector<SCH_FIELD*> fieldsToCopy;
 
  321        aSourceSym->GetFields( fieldsToCopy );
 
  323        for( 
SCH_FIELD* templateField : fieldsToCopy )
 
  326            templateField->Copy( appliedField );
 
 
  334    wxCHECK( aSchematic,  );
 
  355        numSteps += 
Parts.PartDefinitions.size();
 
  382    if( 
Schematic.VariantHierarchy.Variants.size() > 0 )
 
  384        m_reporter->Report( wxString::Format( 
_( 
"The CADSTAR design contains variants which has " 
  385                                                 "no KiCad equivalent. Only the master variant " 
  386                                                 "('%s') was loaded." ),
 
  387                                              Schematic.VariantHierarchy.Variants.at( 
"V0" ).Name ),
 
  393        m_reporter->Report( 
_( 
"The CADSTAR design contains grouped items which has no KiCad " 
  394                               "equivalent. Any grouped items have been ungrouped." ),
 
  400        m_reporter->Report( 
_( 
"The CADSTAR design contains re-use blocks which has no KiCad " 
  401                               "equivalent. The re-use block information has been discarded during " 
  408    for( std::pair<LAYER_ID, SCH_SHEET*> sheetPair : 
m_sheetMap )
 
  413        BOX2I sheetBoundingBox;
 
  428                    if( field.IsVisible() )
 
  429                        bbox.
Merge( field.GetBoundingBox() );
 
  435                wxString  txt = txtItem->
GetText();
 
  437                if( txt.Contains( 
"${" ) )
 
  444                bbox = item->GetBoundingBox();
 
  447            sheetBoundingBox.
Merge( bbox );
 
  460        auto roundToNearestGrid =
 
  461                [&]( 
int aNumber ) -> 
int 
  463                    int error = aNumber % 
grid;
 
  464                    int absError = 
sign( error ) * error;
 
  466                    if( absError > ( 
grid / 2 ) )
 
  467                        return aNumber + ( 
sign( error ) * 
grid ) - error;
 
  469                        return aNumber - error;
 
  476        int      longestSide = std::max( targetSheetSize.
x, targetSheetSize.
y );
 
  477        int      margin = ( (double) longestSide * 0.03 );
 
  478        margin = roundToNearestGrid( margin );
 
  479        targetSheetSize += margin * 2;
 
  490        VECTOR2I sheetcentre( pageSizeIU.
x / 2, pageSizeIU.
y / 2 );
 
  494        VECTOR2I translation = sheetcentre - itemsCentre;
 
  495        translation.
x = roundToNearestGrid( translation.
x );
 
  496        translation.
y = roundToNearestGrid( translation.
y );
 
  499        std::vector<SCH_ITEM*> allItems;
 
  502                   std::back_inserter( allItems ) );
 
  506            item->Move( translation );
 
  514    m_reporter->Report( 
_( 
"CADSTAR fonts are different to the ones in KiCad. This will likely " 
  515                           "result in alignment issues. Please review the imported text elements " 
  516                           "carefully and correct manually if required." ),
 
  519    m_reporter->Report( 
_( 
"The CADSTAR design has been imported successfully.\n" 
  520                           "Please review the import errors and warnings (if any)." ) );
 
 
  533    constexpr long long maxDesignSizekicad = std::numeric_limits<int>::max();
 
  535    if( designSizeXkicad > maxDesignSizekicad || designSizeYkicad > maxDesignSizekicad )
 
  538                _( 
"The design is too large and cannot be imported into KiCad. \n" 
  539                   "Please reduce the maximum design size in CADSTAR by navigating to: \n" 
  540                   "Design Tab -> Properties -> Design Options -> Maximum Design Size. \n" 
  541                   "Current Design size: %.2f, %.2f millimeters. \n"  
  542                   "Maximum permitted design size: %.2f, %.2f millimeters.\n" ), 
 
 
  558    if( orphanSheets.size() > 1 )
 
  563        for( 
LAYER_ID sheetID : orphanSheets )
 
  579    else if( orphanSheets.size() > 0 )
 
  581        LAYER_ID rootSheetID = orphanSheets.at( 0 );
 
  583        wxFileName loadedFilePath = wxFileName( 
Filename );
 
  585        std::string filename = wxString::Format( 
"%s_%02d", loadedFilePath.GetName(),
 
  591        wxFileName fn( 
m_schematic->Project().GetProjectPath() + filename );
 
  592        m_rootSheet->GetScreen()->SetFileName( fn.GetFullPath() );
 
  597    else if( 
Header.Format.Type == 
"SYMBOL" )
 
  599        THROW_IO_ERROR( 
_( 
"The selected file is a CADSTAR symbol library. It does not contain a " 
  600                           "schematic design so cannot be imported/opened in this way." ) );
 
  604        THROW_IO_ERROR( 
_( 
"The CADSTAR schematic might be corrupt: there is no root sheet." ) );
 
 
  611    for( std::pair<BLOCK_ID, BLOCK> blockPair : 
Schematic.Blocks )
 
  613        BLOCK&   block   = blockPair.second;
 
  616        if( block.
Type == BLOCK::TYPE::PARENT )
 
  618        else if( block.
Type == BLOCK::TYPE::CHILD )
 
  627            for( std::pair<TERMINAL_ID, TERMINAL> termPair : block.
Terminals )
 
  630                wxString 
name = 
"YOU SHOULDN'T SEE THIS TEXT. THIS IS A BUG.";
 
  634                if( block.
Type == BLOCK::TYPE::PARENT )
 
  636                else if( block.
Type == BLOCK::TYPE::CHILD )
 
 
  659    for( std::pair<PART_ID, PART> partPair : 
Parts.PartDefinitions )
 
  661        PART_ID partID = partPair.first;
 
  662        PART    part = partPair.second;
 
  672            GATE_ID                gateID   = gatePair.first;
 
  673            PART::DEFINITION::GATE gate     = gatePair.second;
 
  676            if( symbolID.IsEmpty() )
 
  678                m_reporter->Report( wxString::Format( 
_( 
"Part definition '%s' references symbol " 
  679                                                         "'%s' (alternate '%s') which could not be " 
  680                                                         "found in the symbol library. The part has " 
  681                                                         "not been loaded into the KiCad library." ),
 
  703                m_reporter->Report( wxString::Format( 
_( 
"Part definition '%s' has an incomplete " 
  704                                                         "definition (no symbol definitions are " 
  705                                                         "associated with it). The part has not " 
  706                                                         "been loaded into the KiCad library." ),
 
 
  725    for( std::pair<SYMBOL_ID, SYMBOL> symPair : 
Schematic.Symbols )
 
  727        SYMBOL sym = symPair.second;
 
  736                m_reporter->Report( wxString::Format( 
_( 
"Symbol '%s' references part '%s' which " 
  737                                                         "could not be found in the library. The " 
  738                                                         "symbol was not loaded" ),
 
  746            if( sym.
GateID.IsEmpty() )
 
  796                partname.Replace( wxT( 
"\n" ), wxT( 
"\\n" ) );
 
  797                partname.Replace( wxT( 
"\r" ), wxT( 
"\\r" ) );
 
  798                partname.Replace( wxT( 
"\t" ), wxT( 
"\\t" ) );
 
  799                partField->
SetText( partname );
 
  818                    wxASSERT( attrField->
GetName() == attrName );
 
  820                    attrVal.
Value.Replace( wxT( 
"\n" ), wxT( 
"\\n" ) );
 
  821                    attrVal.
Value.Replace( wxT( 
"\r" ), wxT( 
"\\r" ) );
 
  822                    attrVal.
Value.Replace( wxT( 
"\t" ), wxT( 
"\\t" ) );
 
  835                THROW_IO_ERROR( wxString::Format( 
_( 
"Symbol ID '%s' references library symbol " 
  836                                                     "'%s' which could not be found in the " 
  837                                                     "library. Did you export all items of the " 
  847                THROW_IO_ERROR( wxString::Format( 
_( 
"Symbol ID '%s' is a signal reference or " 
  848                                                     "global signal but it has too many pins. The " 
  849                                                     "expected number of pins is 1 but %d were " 
  863                wxString libraryNetName = 
Library.SymbolDefinitions.at( symID ).Alternate;
 
  873                wxString libPartName = libraryNetName;
 
  879                if( libPartName != symbolInstanceNetName )
 
  881                    libPartName += wxT( 
" (" ) + symbolInstanceNetName + wxT( 
")" );
 
  887                    wxCHECK( templatePart,  );
 
  891                    kiPart->
SetName( libPartName );
 
  896                    std::vector<SCH_PIN*> pins = kiPart->
GetPins();
 
  897                    wxCHECK( pins.size() == 1,  );
 
  900                    pins.at( 0 )->SetName( symbolInstanceNetName );
 
  952                netLabel->
SetText( 
"***UNKNOWN NET****" ); 
 
  966                if( libSymDef.
Alternate.Lower().Contains( 
"in" ) )
 
  968                else if( libSymDef.
Alternate.Lower().Contains( 
"bi" ) )
 
  970                else if( libSymDef.
Alternate.Lower().Contains( 
"out" ) )
 
  980                screen->
Append( netLabel );
 
  985                wxASSERT_MSG( 
false, 
"Unknown Symbol Variant." );
 
  990            m_reporter->Report( wxString::Format( 
_( 
"Symbol ID '%s' is of an unknown type. It is " 
  991                                                     "neither a symbol or a net power / symbol. " 
  992                                                     "The symbol was not loaded." ),
 
 1001            if( symbolName.empty() )
 
 1002                symbolName = wxString::Format( 
"ID: %s", sym.
ID );
 
 1004                symbolName += sym.
GateID;
 
 1006            m_reporter->Report( wxString::Format( 
_( 
"Symbol '%s' is scaled in the original " 
 1007                                                     "CADSTAR schematic but this is not supported " 
 1008                                                     "in KiCad. When the symbol is reloaded from " 
 1009                                                     "the library, it will revert to the original " 
 
 1021    for( std::pair<BUS_ID, BUS> busPair : 
Schematic.Buses )
 
 1023        BUS    bus     = busPair.second;
 
 1024        bool   firstPt = 
true;
 
 1027        if( bus.
LayerID != wxT( 
"NO_SHEET" ) )
 
 1030            std::shared_ptr<BUS_ALIAS> kiBusAlias = std::make_shared<BUS_ALIAS>();
 
 1032            kiBusAlias->SetName( bus.
Name );
 
 1040            label->
SetText( wxT( 
"{" ) + busname + wxT( 
"}" ) );
 
 1089                label->
SetText( wxT( 
"{" ) + busname + wxT( 
"}" ) );
 
 
 1101    for( std::pair<NET_ID, NET_SCH> netPair : 
Schematic.Nets )
 
 1104        wxString                            netName = net.
Name;
 
 1105        std::map<NETELEMENT_ID, SCH_LABEL*> netlabels;
 
 1107        if( netName.IsEmpty() )
 
 1108            netName = wxString::Format( 
"$%ld", net.
SignalNum );
 
 1112        for( std::pair<NETELEMENT_ID, NET_SCH::SYM_TERM> terminalPair : net.
Terminals )
 
 1114            NET_SCH::SYM_TERM netTerm = terminalPair.second;
 
 1123                if( netTerm.HasNetLabel )
 
 1128                    applyTextSettings( val, netTerm.NetLabel.TextCodeID, netTerm.NetLabel.Alignment,
 
 1129                                       netTerm.NetLabel.Justification, netTerm.NetLabel.OrientAngle,
 
 1130                                       netTerm.NetLabel.Mirror  );
 
 1147            else if( !net.
Name.IsEmpty() && 
Schematic.Symbols.count( netTerm.SymbolID )
 
 1148                     && netTerm.HasNetLabel )
 
 1158                applyTextSettings( label, netTerm.NetLabel.TextCodeID, netTerm.NetLabel.Alignment,
 
 1159                                   netTerm.NetLabel.Justification );
 
 1161                netlabels.insert( { netTerm.ID, label } );
 
 1164                m_sheetMap.at( sheet )->GetScreen()->Append( label );
 
 1168        auto getHierarchicalLabel =
 
 1171                    if( aNode.Contains( 
"BLKT" ) )
 
 1174                        BLOCK_PIN_ID blockPinID = std::make_pair( blockTerm.BlockID,
 
 1175                                                                  blockTerm.TerminalID );
 
 1185        for( std::pair<NETELEMENT_ID, NET_SCH::BLOCK_TERM> blockPair : net.
BlockTerminals )
 
 1187            SCH_HIERLABEL* label = getHierarchicalLabel( blockPair.first );
 
 1194        for( std::pair<NETELEMENT_ID, NET_SCH::BUS_TERM> busPair : net.
BusTerminals )
 
 1196            NET_SCH::BUS_TERM busTerm = busPair.second;
 
 1200                m_busesMap.at( bus.
ID )->Members().emplace_back( netName );
 
 1220            if( busTerm.HasNetLabel )
 
 1222                applyTextSettings( label, busTerm.NetLabel.TextCodeID, busTerm.NetLabel.Alignment,
 
 1223                                   busTerm.NetLabel.Justification );
 
 1230            netlabels.insert( { busTerm.ID, label } );
 
 1234        for( std::pair<NETELEMENT_ID, NET_SCH::DANGLER> danglerPair : net.
Danglers )
 
 1236            NET_SCH::DANGLER dangler = danglerPair.second;
 
 1242            if( dangler.HasNetLabel )
 
 1244                applyTextSettings( label, dangler.NetLabel.TextCodeID, dangler.NetLabel.Alignment,
 
 1245                                   dangler.NetLabel.Justification );
 
 1249            netlabels.insert( { dangler.ID, label } );
 
 1251            m_sheetMap.at( dangler.LayerID )->GetScreen()->Append( label );
 
 1254        for( NET_SCH::CONNECTION_SCH conn : net.
Connections )
 
 1256            if( conn.LayerID == wxT( 
"NO_SHEET" ) )
 
 1267            if( conn.Path.size() < 1 || conn.Path.front() != start )
 
 1268                conn.Path.insert( conn.Path.begin(), start );
 
 1270            if( conn.Path.size() < 2 || conn.Path.back() != 
end )
 
 1271                conn.Path.push_back( 
end );
 
 1273            bool      firstPt  = 
true;
 
 1274            bool      secondPt = 
false;
 
 1280            for( 
const POINT& pt : conn.Path )
 
 1288            std::vector<NETELEMENT_ID> nodes;
 
 1289            nodes.push_back( conn.StartNode );
 
 1290            nodes.push_back( conn.EndNode );
 
 1305                        int leftSide  = sheetPosition.
x;
 
 1306                        int rightSide = sheetPosition.
x + sheetSize.
x;
 
 1307                        int topSide   = sheetPosition.
y;
 
 1308                        int botSide   = sheetPosition.
y + sheetSize.
y;
 
 1312                        sheetEdge.
Append( leftSide, topSide );
 
 1313                        sheetEdge.
Append( rightSide, topSide );
 
 1314                        sheetEdge.
Append( rightSide, botSide );
 
 1315                        sheetEdge.
Append( leftSide, botSide );
 
 1316                        sheetEdge.
Append( leftSide, topSide );
 
 1320                        if( !wireChain.
Intersect( sheetEdge, wireToSheetIntersects ) )
 
 1325                            if( node == conn.StartNode )
 
 1326                                wireChain = wireChain.
Reverse();
 
 1330                            if( node == conn.StartNode )
 
 1331                                wireChain = wireChain.
Reverse();
 
 1337                            VECTOR2I intsctPt   = wireToSheetIntersects.at( 0 ).p;
 
 1338                            int      intsctIndx = wireChain.
FindSegment( intsctPt );
 
 1339                            wxASSERT_MSG( intsctIndx != -1, 
"Can't find intersecting segment" );
 
 1341                            if( node == conn.StartNode )
 
 1342                                wireChain.
Replace( 0, intsctIndx, intsctPt );
 
 1344                                wireChain.
Replace( intsctIndx + 1,  -1, intsctPt );
 
 1352            auto fixNetLabelsAndSheetPins =
 
 1357                        if( netlabels.find( aNetEleID ) != netlabels.end() )
 
 1358                            netlabels.at( aNetEleID )->SetSpinStyle( spin.
MirrorY() );
 
 1360                        SCH_HIERLABEL* sheetPin = getHierarchicalLabel( aNetEleID );
 
 1382                    fixNetLabelsAndSheetPins( wireAngle, conn.StartNode );
 
 1391                if( !conn.ConnectionLineCode.IsEmpty() )
 
 1396                m_sheetMap.at( conn.LayerID )->GetScreen()->Append( wire );
 
 1403                fixNetLabelsAndSheetPins( wireAngle, conn.EndNode );
 
 1407        for( std::pair<NETELEMENT_ID, NET_SCH::JUNCTION_SCH> juncPair : net.
Junctions )
 
 1409            NET_SCH::JUNCTION_SCH junc = juncPair.second;
 
 1414            m_sheetMap.at( junc.LayerID )->GetScreen()->Append( kiJunc );
 
 1416            if( junc.HasNetLabel )
 
 1430                m_sheetMap.at( junc.LayerID )->GetScreen()->Append( label );
 
 
 1439    for( std::pair<FIGURE_ID, FIGURE> figPair : 
Schematic.Figures )
 
 1441        FIGURE fig = figPair.second;
 
 
 1450    for( std::pair<TEXT_ID, TEXT> textPair : 
Schematic.Texts )
 
 1452        TEXT txt = textPair.second;
 
 
 1462    for( std::pair<DOCUMENTATION_SYMBOL_ID, DOCUMENTATION_SYMBOL> docSymPair :
 
 1469            m_reporter->Report( wxString::Format( 
_( 
"Documentation Symbol '%s' refers to symbol " 
 1470                                                     "definition ID '%s' which does not exist in " 
 1471                                                     "the library. The symbol was not loaded." ),
 
 1484        bool       mirrorInvert      = docSym.
Mirror;
 
 1486        for( std::pair<FIGURE_ID, FIGURE> figPair : docSymDef.
Figures )
 
 1488            FIGURE fig = figPair.second;
 
 1491                        centreOfTransform, mirrorInvert );
 
 1494        for( std::pair<TEXT_ID, TEXT> textPair : docSymDef.
Texts )
 
 1496            TEXT txt = textPair.second;
 
 1498            txt.
Mirror = ( txt.
Mirror ) ? !mirrorInvert : mirrorInvert;
 
 1504                                                   scalingFactor, centreOfTransform, mirrorInvert );
 
 
 1523    auto findAndReplaceTextField =
 
 1526                if( 
m_context.TextFieldToValuesMap.find( aField ) != 
m_context.TextFieldToValuesMap.end() )
 
 1528                    if( 
m_context.TextFieldToValuesMap.at( aField ) != aValue )
 
 1530                        m_context.TextFieldToValuesMap.at( aField ) = aValue;
 
 1531                        m_context.InconsistentTextFields.insert( aField );
 
 1537                    m_context.TextFieldToValuesMap.insert( { aField, aValue } );
 
 1547        std::map<wxString, wxString>& txtVars = pj->
GetTextVars();
 
 1550        if( 
Schematic.VariantHierarchy.Variants.size() > 0 )
 
 1560        for( std::pair<TEXT_FIELD_NAME, wxString> txtvalue : 
m_context.TextFieldToValuesMap )
 
 1563            wxString varValue = txtvalue.second;
 
 1565            txtVars.insert( { varName, varValue } );
 
 1568        for( std::pair<wxString, wxString> txtvalue : 
m_context.FilenamesToTextMap )
 
 1570            wxString varName  = txtvalue.first;
 
 1571            wxString varValue = txtvalue.second;
 
 1573            txtVars.insert( { varName, varValue } );
 
 1578        m_reporter->Report( 
_( 
"Text Variables could not be set as there is no project attached." ),
 
 
 1586                                                 std::unique_ptr<LIB_SYMBOL>& aKiCadSymbol )
 
 1589    if( 
SCH_FIELD* existingField = aKiCadSymbol->GetField( aFieldName ) )
 
 1590        return existingField;
 
 1594    aKiCadSymbol->AddField( newfield );
 
 
 1607    wxCHECK( 
Library.SymbolDefinitions.find( aSymdefID ) != 
Library.SymbolDefinitions.end(), 
nullptr );
 
 1613    std::unique_ptr<LIB_SYMBOL> kiSym = std::make_unique<LIB_SYMBOL>( csSym.
BuildLibName() );
 
 1614    const int                   gateNumber = 1; 
 
 1617    for( std::pair<FIGURE_ID, FIGURE> figPair : csSym.
Figures )
 
 1619        FIGURE         fig = figPair.second;
 
 1636                        return getKiCadLibraryPoint( aPt, csSym.Origin );
 
 1651            kiSym->AddDrawItem( shape );
 
 1658    for( std::pair<TERMINAL_ID, TERMINAL> termPair : csSym.
Terminals )
 
 1661        wxString pinNum = wxString::Format( 
"%ld", term.
ID );
 
 1662        wxString pinName = wxEmptyString;
 
 1663        std::unique_ptr<SCH_PIN> 
pin = std::make_unique<SCH_PIN>( kiSym.get() );
 
 1669        pin->SetLength( 0 ); 
 
 1671        pin->SetUnit( gateNumber );
 
 1672        pin->SetNumber( pinNum );
 
 1673        pin->SetName( pinName );
 
 1691        pin->SetNumberTextSize( pinNumberHeight );
 
 1692        pin->SetNameTextSize( pinNameHeight );
 
 1694        pinNumToTerminals.insert( { 
pin->GetNumber(), term.
ID } );
 
 1695        kiSym->AddDrawItem( 
pin.release() );
 
 1703    for( std::pair<TEXT_ID, TEXT> textPair : csSym.
Texts )
 
 1705        TEXT csText = textPair.second;
 
 1707        auto     libtext = std::make_unique<SCH_TEXT>( pos, csText.
Text, 
LAYER_DEVICE );
 
 1709        libtext->SetUnit( gateNumber );
 
 1711        libtext->SetMultilineAllowed( 
true ); 
 
 1717        if( csText.
Text.Contains( 
"\n" ) )
 
 1719            wxArrayString strings;
 
 1722            for( 
size_t ii = 0; ii < strings.size(); ++ii )
 
 1724                BOX2I    bbox = libtext->GetTextBox( 
nullptr, ii );
 
 1727                RotatePoint( linePos, libtext->GetTextPos(), -libtext->GetTextAngle() );
 
 1730                textLine->
SetText( strings[ii] );
 
 1737                kiSym->AddDrawItem( textLine );
 
 1743            libtext->SetMultilineAllowed( 
false );
 
 1744            kiSym->AddDrawItem( libtext.release() );
 
 1766    wxCHECK( partField, 
nullptr );
 
 1782    for( 
auto& [attributeId, textLocation] : csSym.
TextLocations )
 
 1807        if( attrValue.HasLocation )
 
 1814    m_symDefMap.insert( { aSymdefID, std::move( kiSym ) } );
 
 
 1821                                                              const PART& aCadstarPart,
 
 1825    wxCHECK( 
Library.SymbolDefinitions.find( aSymdefID ) != 
Library.SymbolDefinitions.end(),  );
 
 1827    std::unique_ptr<LIB_SYMBOL> kiSymDef( 
loadSymdef( aSymdefID )->Duplicate() );
 
 1828    wxCHECK( kiSymDef,  );
 
 1831    std::unique_ptr<LIB_SYMBOL> tempSymbol( aSymbol );
 
 1839        SCH_PIN*              
pin = kiSymDef->GetPin( storedPinNum );
 
 1844        if( pinNum.IsEmpty() )
 
 1846            if( !csPin.Identifier.IsEmpty() )
 
 1847                pinNum = csPin.Identifier;
 
 1849                pinNum = wxString::Format( 
"%ld", termID );
 
 1851                pinNum = wxString::Format( 
"%ld", csPin.ID );
 
 1855        pin->SetNumber( pinNum );
 
 1856        pin->SetName( pinName );
 
 1858        pinNumMap.insert( { termID, pinNum } );
 
 1869    tempSymbol->GetValueField().SetVisible( 
false );
 
 1875    const POINT& symDefOrigin = 
Library.SymbolDefinitions.at( aSymdefID ).Origin;
 
 1876    wxString     footprintRefName = wxEmptyString;
 
 1877    wxString     footprintAlternateName = wxEmptyString;
 
 1884        wxString attributeValue = aAttributeVal.Value;
 
 1885        attributeValue.Replace( wxT( 
"\n" ), wxT( 
"\\n" ) );
 
 1886        attributeValue.Replace( wxT( 
"\r" ), wxT( 
"\\r" ) );
 
 1887        attributeValue.Replace( wxT( 
"\t" ), wxT( 
"\\t" ) );
 
 1893        if( attrName == wxT( 
"(PartDefinitionNameStem)" ) )
 
 1896            attributeValue.Replace( wxT( 
" " ), 
"_" );
 
 1897            tempSymbol->GetReferenceField().SetText( attributeValue );
 
 1900        else if( attrName == wxT( 
"(PartDescription)" ) )
 
 1902            tempSymbol->SetDescription( attributeValue );
 
 1905        else if( attrName == wxT( 
"(PartDefinitionReferenceName)" ) )
 
 1907            footprintRefName = attributeValue;
 
 1910        else if( attrName == wxT( 
"(PartDefinitionAlternateName)" ) )
 
 1912            footprintAlternateName = attributeValue;
 
 1916        bool       attrIsNew = tempSymbol->GetField( attrName ) == 
nullptr;
 
 1919        wxASSERT( attrField->
GetName() == attrName );
 
 1920        attrField->
SetText( aAttributeVal.Value );
 
 1921        attrField->
SetUnit( gateNumber );
 
 1923        const ATTRIBUTE_ID& attrid = aAttributeVal.AttributeID;
 
 1926        if( aAttributeVal.HasLocation )
 
 1932        else if( attrIsNew )
 
 1942        loadLibraryField( attrVal );
 
 1946        loadLibraryField( attrVal );
 
 1952        tempSymbol->SetShowPinNames( 
false );
 
 1953        tempSymbol->SetShowPinNumbers( 
false );
 
 1957    aSymbol = tempSymbol.release();
 
 
 1962                                                       const wxString& aFootprintName,
 
 1963                                                       const wxString& aFootprintAlternate )
 
 1965    wxString fpNameInLibrary = 
generateLibName( aFootprintName, aFootprintAlternate );
 
 1967    if( !fpNameInLibrary.IsEmpty() )
 
 1969        wxArrayString fpFilters;
 
 1970        fpFilters.Add( aFootprintName ); 
 
 1972        if( !aFootprintAlternate.IsEmpty() )
 
 1973            fpFilters.Add( fpNameInLibrary );
 
 1975        aKiCadSymbol->SetFPFilters( fpFilters );
 
 1978        aKiCadSymbol->GetFootprintField().SetText( libID.
Format() );
 
 
 1987                                                                 int aLineThickness )
 
 1989    const VERTEX* prev = &aCadstarVertices.at( 0 );
 
 1994    for( 
size_t i = 1; i < aCadstarVertices.size(); i++ )
 
 1996        cur = &aCadstarVertices.at( i );
 
 2007            centerPoint = ( startPoint + endPoint ) / 2;
 
 2037                shape->
SetEnd( startPoint );
 
 2042                shape->
SetEnd( endPoint );
 
 2048        shape->
SetUnit( aGateNumber );
 
 
 2067                       aCadstarAttrLoc.
Mirror );
 
 
 2095    int       compOrientation = 0;
 
 2097    if( aCadstarSymbol.
Mirror )
 
 2099        compAngle = -compAngle;
 
 2105    EDA_ANGLE test2( aComponentOrientation );
 
 2109        m_reporter->Report( wxString::Format( 
_( 
"Symbol '%s' is rotated by an angle of %.1f "  
 2110                                                 "degrees in the original CADSTAR design but " 
 2111                                                 "KiCad only supports rotation angles multiples " 
 2112                                                 "of 90 degrees. The connecting wires will need " 
 2123        m_reporter->Report( wxString::Format( 
_( 
"Symbol '%s' references sheet ID '%s' which does " 
 2124                                                 "not exist in the design. The symbol was not " 
 2134    wxString gate = ( aCadstarSymbol.
GateID.IsEmpty() ) ? wxString( wxT( 
"A" ) ) : aCadstarSymbol.
GateID;
 
 2135    wxString partGateIndex = aCadstarSymbol.
PartRef.
RefID + gate;
 
 2142        std::map<wxString, SCH_PIN*> pinNumToLibPinMap;
 
 2144        for( 
auto& term : termNumMap )
 
 2146            wxString pinNum = term.second;
 
 2147            pinNumToLibPinMap.insert( { pinNum,
 
 2151        auto replacePinNumber =
 
 2152                [&]( wxString aOldPinNum, wxString aNewPinNum )
 
 2154                    if( aOldPinNum == aNewPinNum )
 
 2157                    SCH_PIN* libpin = pinNumToLibPinMap.at( aOldPinNum );
 
 2162        for( 
auto& pinPair : aCadstarSymbol.
PinNumbers )
 
 2164            SYMBOL::PIN_NUM 
pin = pinPair.second;
 
 2166            replacePinNumber( termNumMap.at( 
pin.TerminalID ),
 
 2167                              wxString::Format( 
"%ld", 
pin.PinNum ) );
 
 2171        for( 
auto& pinPair : aCadstarSymbol.
PinNames )
 
 2174            replacePinNumber( termNumMap.at( 
pin.TerminalID ), 
pin.NameOrLabel );
 
 
 2204        if( textIsVertical )
 
 2207        alignment = 
mirrorX( alignment );
 
 2213                       aCadstarAttrLoc.
Mirror );
 
 
 2228        aReturnedOrientation = 
ANGLE_0;
 
 2246    return compOrientation;
 
 
 2255    auto logUnknownNetElementError =
 
 2258            m_reporter->Report( wxString::Format( 
_( 
"Net %s references unknown net element %s. " 
 2259                                                     "The net was not properly loaded and may " 
 2260                                                     "require manual fixing." ),
 
 2269    if( aNetElementID.Contains( 
"J" ) ) 
 
 2272            return logUnknownNetElementError();
 
 2274        return aNet.
Junctions.at( aNetElementID ).Location;
 
 2276    else if( aNetElementID.Contains( 
"P" ) ) 
 
 2279            return logUnknownNetElementError();
 
 2285            return logUnknownNetElementError();
 
 2291        if( 
Library.SymbolDefinitions.find( symdefid ) == 
Library.SymbolDefinitions.end() )
 
 2292            return logUnknownNetElementError();
 
 2295                Library.SymbolDefinitions.at( symdefid ).Terminals.at( termid ).Position;
 
 2298        VECTOR2I pinOffset = libpinPosition - libOrigin;
 
 2302        VECTOR2I  pinPosition = symbolOrigin + pinOffset;
 
 2306            pinPosition.
x = ( 2 * symbolOrigin.
x ) - pinPosition.
x;
 
 2311        RotatePoint( pinPosition, symbolOrigin, -adjustedOrientation );
 
 2314        retval.
x = pinPosition.
x;
 
 2315        retval.
y = pinPosition.
y;
 
 2319    else if( aNetElementID.Contains( 
"BT" ) ) 
 
 2322            return logUnknownNetElementError();
 
 2324        return aNet.
BusTerminals.at( aNetElementID ).SecondPoint;
 
 2326    else if( aNetElementID.Contains( 
"BLKT" ) ) 
 
 2329            return logUnknownNetElementError();
 
 2335            return logUnknownNetElementError();
 
 2337        return Schematic.Blocks.at( blockid ).Terminals.at( termid ).Position;
 
 2339    else if( aNetElementID.Contains( 
"D" ) ) 
 
 2342            return logUnknownNetElementError();
 
 2344        return aNet.
Danglers.at( aNetElementID ).Position;
 
 2348        return logUnknownNetElementError();
 
 
 2355    wxString netname = aNet.
Name;
 
 2357    if( netname.IsEmpty() )
 
 2358        netname = wxString::Format( 
"$%ld", aNet.
SignalNum );
 
 
 2370                                                    const double& aScalingFactor,
 
 2372                                                    const bool& aMirrorInvert )
 
 2377    const VERTEX* prev = &aCadstarVertices.at( 0 );
 
 2381                  "First vertex should always be a point vertex" );
 
 2383    auto pointTransform =
 
 2387                                       aScalingFactor, aTransformCentre, aMirrorInvert );
 
 2390    for( 
size_t ii = 1; ii < aCadstarVertices.size(); ii++ )
 
 2392        cur = &aCadstarVertices.at( ii );
 
 2394        VECTOR2I transformedStartPoint = pointTransform( prev->
End );
 
 2395        VECTOR2I transformedEndPoint = pointTransform( cur->
End );
 
 2417            segment->
SetLayer( aKiCadSchLayerID );
 
 2429            wxFAIL_MSG( 
"Unknown CADSTAR Vertex type" );
 
 
 2438                                             const LAYER_ID& aCadstarSheetIDOverride,
 
 2442                                             const double& aScalingFactor,
 
 2444                                             const bool& aMirrorInvert )
 
 2447                       aCadstarSheetIDOverride, aKiCadSchLayerID, aMoveVector, aRotation,
 
 2448                       aScalingFactor, aTransformCentre, aMirrorInvert );
 
 2453                           aKiCadSchLayerID, aMoveVector, aRotation, aScalingFactor,
 
 2454                           aTransformCentre, aMirrorInvert );
 
 
 2465                 "Sheet already loaded!" );
 
 2468         aParentSheet.
Last(),
 
 2476    wxString 
name = 
Sheets.SheetNames.at( aCadstarSheetID );
 
 2481    wxString    loadedFilename = wxFileName( 
Filename ).GetName();
 
 2482    std::string filename = wxString::Format( 
"%s_%02d", loadedFilename, sheetNum ).ToStdString();
 
 2489    wxFileName fn( 
m_schematic->Project().GetProjectPath() + filename );
 
 2494    wxString pageNumStr = wxString::Format( 
"%d", 
getSheetNumber( aCadstarSheetID ) );
 
 2499    m_sheetMap.insert( { aCadstarSheetID, sheet } );
 
 
 2509                 "FIXME! Parent sheet should be loaded before attempting to load subsheets" );
 
 2511    for( std::pair<BLOCK_ID, BLOCK> blockPair : 
Schematic.Blocks )
 
 2513        BLOCK& block = blockPair.second;
 
 2515        if( block.
LayerID == aCadstarSheetID && block.
Type == BLOCK::TYPE::CHILD )
 
 2519                if( block.
Figures.size() > 0 )
 
 2521                    m_reporter->Report( wxString::Format( 
_( 
"The block ID %s (Block name: '%s') " 
 2522                                                             "is drawn on sheet '%s' but is not " 
 2523                                                             "linked to another sheet in the " 
 2524                                                             "design. KiCad requires all sheet " 
 2525                                                             "symbols to be associated to a sheet, " 
 2526                                                             "so the block was not loaded." ),
 
 2528                                                          Sheets.SheetNames.at( aCadstarSheetID ) ),
 
 2538            std::pair<VECTOR2I, VECTOR2I> blockExtents;
 
 2540            if( block.
Figures.size() > 0 )
 
 2546                THROW_IO_ERROR( wxString::Format( 
_( 
"The CADSTAR schematic might be corrupt: " 
 2547                                                     "Block %s references a child sheet but has no " 
 2548                                                     "Figure defined." ),
 
 2561                field.SetVisible( 
false );
 
 
 2605    std::vector<LAYER_ID> childSheets, orphanSheets;
 
 2608    for( std::pair<BLOCK_ID, BLOCK> blockPair : 
Schematic.Blocks )
 
 2610        BLOCK&    block        = blockPair.second;
 
 2613        if( block.
Type == BLOCK::TYPE::CHILD )
 
 2614            childSheets.push_back( assocSheetID );
 
 2620        if( std::find( childSheets.begin(), childSheets.end(), sheetID ) == childSheets.end() )
 
 2621            orphanSheets.push_back( sheetID );
 
 2624    return orphanSheets;
 
 
 2634        if( sheetID == aCadstarSheetID )
 
 
 2647    wxCHECK_MSG( aItem, , wxT( 
"aItem is null" ) );
 
 2649    if( aCadstarSheetID == 
"ALL_SHEETS" )
 
 2653        for( std::pair<LAYER_ID, SHEET_NAME> sheetPair : 
Sheets.SheetNames )
 
 2655            LAYER_ID sheetID = sheetPair.first;
 
 2662        aItem = duplicateItem;
 
 2664    else if( aCadstarSheetID == 
"NO_SHEET" )
 
 2666        wxFAIL_MSG( wxT( 
"Trying to add an item to NO_SHEET? This might be a documentation symbol." ) );
 
 2672            m_sheetMap.at( aCadstarSheetID )->GetScreen()->Append( aItem );
 
 2677            wxFAIL_MSG( wxT( 
"Unknown Sheet ID." ) );
 
 
 2685                                               const wxString& aSymDefAlternate )
 
 2694        for( 
auto& [
id, symdef] : 
Library.SymbolDefinitions )
 
 2696            wxString refKey = symdef.ReferenceName.Lower();
 
 2697            wxString altKey = symdef.Alternate.Lower();
 
 2709            else if( altKey.IsEmpty() )
 
 2717    wxString refKeyToFind = aSymdefName.Lower();
 
 2718    wxString altKeyToFind = aSymDefAlternate.Lower();
 
 
 2736    if( 
AttrColors.AttributeColors.find( aCadstarAttributeID ) != 
AttrColors.AttributeColors.end() )
 
 2737        return AttrColors.AttributeColors.at( aCadstarAttributeID ).IsVisible;
 
 
 2745    wxCHECK( 
Assignments.Codedefs.LineCodes.find( aCadstarLineCodeID )
 
 
 2755    wxCHECK( 
Assignments.Codedefs.LineCodes.find( aCadstarLineCodeID )
 
 2760    switch( 
Assignments.Codedefs.LineCodes.at( aCadstarLineCodeID ).Style )
 
 
 2776    wxCHECK( 
Assignments.Codedefs.TextCodes.find( aCadstarTextCodeID )
 
 2780    return Assignments.Codedefs.TextCodes.at( aCadstarTextCodeID );
 
 
 2794    wxCHECK( 
Assignments.Codedefs.AttributeNames.find( aCadstarAttributeID )
 
 2796             aCadstarAttributeID );
 
 2798    return Assignments.Codedefs.AttributeNames.at( aCadstarAttributeID ).Name;
 
 
 2805    wxCHECK( 
Parts.PartDefinitions.find( aCadstarPartID ) != 
Parts.PartDefinitions.end(), 
PART() );
 
 2807    return Parts.PartDefinitions.at( aCadstarPartID );
 
 
 2814    wxCHECK( 
Assignments.Codedefs.RouteCodes.find( aCadstarRouteCodeID )
 
 2818    return Assignments.Codedefs.RouteCodes.at( aCadstarRouteCodeID );
 
 
 2822CADSTAR_SCH_ARCHIVE_LOADER::PART::DEFINITION::PIN
 
 2826    for( std::pair<PART_DEFINITION_PIN_ID, PART::DEFINITION::PIN> pinPair :
 
 2829        PART::DEFINITION::PIN partPin = pinPair.second;
 
 2831        if( partPin.TerminalGate == aGateID && partPin.TerminalPin == aTerminalID )
 
 2835    return PART::DEFINITION::PIN();
 
 
 2860    if( aCadstarGateID.IsEmpty() )
 
 2863    return (
int) aCadstarGateID.Upper().GetChar( 0 ) - (int) wxUniChar( 
'A' ) + 1;
 
 
 2906    switch( aCadstarAlignment )
 
 2925    default: wxFAIL_MSG( 
"Unknown Cadstar Alignment" ); 
return aCadstarAlignment;
 
 
 2933    switch( aCadstarAlignment )
 
 2947    default: wxFAIL_MSG( 
"Unknown Cadstar Alignment" ); 
return aCadstarAlignment;
 
 
 2957    aKiCadTextItem->
SetText( escapedText );
 
 2959    if( !
Assignments.Codedefs.TextCodes.count( aCadstarTextCodeID ) )
 
 2968    if( textWidth == 0 )
 
 
 2989                                                    const long long      aCadstarOrientAngle,
 
 2998    ALIGNMENT textAlignment = aCadstarAlignment;
 
 3004        textAlignment = 
mirrorX( aCadstarAlignment );
 
 3009                switch( aAlignment )
 
 3064    wxCHECK( textEdaItem,  ); 
 
 3086            textAlignment = 
rotate180( textAlignment );
 
 3090            textAlignment = 
rotate180( textAlignment );
 
 3093            wxFAIL_MSG( 
"Unknown Quadrant" );
 
 3097        setAlignment( aKiCadTextItem, textAlignment );
 
 3104        setAlignment( aKiCadTextItem, textAlignment );
 
 3106        int      off = 
static_cast<SCH_TEXT*
>( aKiCadTextItem )->GetTextOffset();
 
 3117        default:                 wxFAIL_MSG( 
"Unexpected Spin Style" );               
break;
 
 3145            wxFAIL_MSG( 
"Unexpected Spin Style" );
 
 3154        label->SetSpinStyle( spin );
 
 3158        wxFAIL_MSG( 
"Unexpected item type" );
 
 
 3173                       aCadstarTextElement.
Mirror );
 
 
 3180                                                          long long aScalingFactorNumerator,
 
 3181                                                          long long aScalingFactorDenominator )
 
 3185    if( aScalingFactorNumerator == aScalingFactorDenominator )
 
 3189        [&]( 
int aLength ) -> 
int 
 3191            return( aLength * aScalingFactorNumerator ) / aScalingFactorDenominator;
 
 3197            return VECTOR2I( scaleLen( aCoord.x ), scaleLen( aCoord.y ) );
 
 3203            return VECTOR2I( scaleLen( aSize.x ), scaleLen( aSize.y ) );
 
 3210        switch( item.Type() )
 
 3236            pin.SetPosition( scalePt( 
pin.GetPosition() ) );
 
 3237            pin.SetLength( scaleLen( 
pin.GetLength() ) );
 
 
 3277        if( aGateNumber > 0 && shape.
GetUnit() != aGateNumber )
 
 3290            if( pt0 != pt1 && uniqueSegments.count( pt0 ) == 0 && uniqueSegments.count( pt1 ) == 0 )
 
 3293                if( pt0.
x == pt1.
x || pt0.
y == pt1.
y )
 
 3295                    uniqueSegments.insert( { pt0, poly } );
 
 3296                    uniqueSegments.insert( { pt1, poly } );
 
 3304        auto setPinOrientation =
 
 3320        if( uniqueSegments.count( 
pin->GetPosition() ) )
 
 3326            if( otherPt == 
pin->GetPosition() )
 
 3327                otherPt = poly.
CPoint( 1 );
 
 
 3338std::pair<VECTOR2I, VECTOR2I>
 
 3346        if( upperLeft.
x > v.
End.
x )
 
 3347            upperLeft.
x = v.
End.
x;
 
 3349        if( upperLeft.
y < v.
End.
y )
 
 3350            upperLeft.
y = v.
End.
y;
 
 3352        if( lowerRight.
x < v.
End.
x )
 
 3353            lowerRight.
x = v.
End.
x;
 
 3355        if( lowerRight.
y > v.
End.
y )
 
 3356            lowerRight.
y = v.
End.
y;
 
 3363            if( upperLeft.
x > v.
End.
x )
 
 3364                upperLeft.
x = v.
End.
x;
 
 3366            if( upperLeft.
y < v.
End.
y )
 
 3367                upperLeft.
y = v.
End.
y;
 
 3369            if( lowerRight.
x < v.
End.
x )
 
 3370                lowerRight.
x = v.
End.
x;
 
 3372            if( lowerRight.
y > v.
End.
y )
 
 3373                lowerRight.
y = v.
End.
y;
 
 3380    VECTOR2I size = lowerRightKiCad - upperLeftKiCad;
 
 3382    return { upperLeftKiCad, 
VECTOR2I( abs( size.
x ), abs( size.
y ) ) };
 
 
 3412                                                     const double& aScalingFactor,
 
 3414                                                     const bool& aMirrorInvert )
 
 3418    if( aScalingFactor != 1.0 )
 
 3421        retVal -= aTransformCentre;
 
 3422        retVal.
x = 
KiROUND( retVal.
x * aScalingFactor );
 
 3423        retVal.
y = 
KiROUND( retVal.
y * aScalingFactor );
 
 3424        retVal += aTransformCentre;
 
 3428        MIRROR( retVal.
x, aTransformCentre.
x );
 
 3430    if( !aRotation.
IsZero() )
 
 3431        RotatePoint( retVal, aTransformCentre, aRotation );
 
 3433    if( aMoveVector != 
VECTOR2I{ 0, 0 } )
 
 3434        retVal += aMoveVector;
 
 
 3442    return sqrt( ( (
double) aPoint.
x * (
double) aPoint.
x )
 
 3443                 + ( (
double) aPoint.
y * (
double) aPoint.
y ) );
 
 
constexpr EDA_IU_SCALE schIUScale
 
constexpr double SCH_IU_PER_MM
Schematic internal units 1=100nm.
 
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
 
CADSTAR_PIN_TYPE
file: cadstar_archive_objects.h Contains common object definitions
 
@ OUTPUT_NOT_OR
Output pin not OR tieable.
 
@ TRISTATE_DRIVER
Tristate output pin.
 
@ OUTPUT_OR
Output pin OR tieable.
 
@ UNCOMMITTED
Uncommitted pin (default)
 
@ TRISTATE_INPUT
Tristate input pin.
 
@ TRISTATE_BIDIR
Tristate bi-directional driver pin.
 
@ OUTPUT_NOT_NORM_OR
Output pin not normally OR tieable.
 
#define SYMBOL_NAME_ATTRID
Symbol Name attribute ID - used for placement of designators on the schematic.
 
#define SIGNALNAME_ORIGIN_ATTRID
 
#define LINK_ORIGIN_ATTRID
 
const wxString PartAcceptanceFieldName
 
const wxString PartNumberFieldName
 
const wxString PartNameFieldName
 
const wxString PartVersionFieldName
 
Loads a csa file into a KiCad SCHEMATIC object.
 
constexpr Vec Centre() const
 
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
 
constexpr coord_type GetLeft() const
 
constexpr coord_type GetRight() const
 
constexpr const SizeVec & GetSize() const
 
constexpr coord_type GetTop() const
 
constexpr coord_type GetBottom() const
 
@ ANTICLOCKWISE_SEMICIRCLE
 
static wxString EscapeFieldText(const wxString &aFieldText)
 
@ FRACTIONALGRID
Param1 = Units, Param2 = Divisor.
 
static const long FONT_BOLD
 
static const std::map< TEXT_FIELD_NAME, wxString > CADSTAR_TO_KICAD_FIELDS
Map between CADSTAR fields and KiCad text variables.
 
long TERMINAL_ID
Terminal is the pin identifier in the schematic.
 
TEXT_FIELD_NAME
These are special fields in text objects enclosed between the tokens '<@' and '>' such as <@[FIELD_NA...
 
ALIGNMENT
From CADSTAR Help: "Text Alignment enables you to define the position of an alignment origin for all ...
 
@ NO_ALIGNMENT
NO_ALIGNMENT has different meaning depending on the object type.
 
static const long UNDEFINED_VALUE
 
static wxString generateLibName(const wxString &aRefName, const wxString &aAlternateName)
 
wxString LAYER_ID
ID of a Sheet (if schematic) or board Layer (if PCB)
 
static void FixTextPositionNoAlignment(EDA_TEXT *aKiCadTextItem)
Correct the position of a text element that had NO_ALIGNMENT in CADSTAR.
 
@ OUTLINE
Unfilled closed shape.
 
@ OPENSHAPE
Unfilled open shape. Cannot have cutouts.
 
@ SOLID
Filled closed shape (solid fill).
 
@ HATCHED
Filled closed shape (hatch fill).
 
static const double TXT_HEIGHT_RATIO
CADSTAR fonts are drawn on a 24x24 integer matrix, where the each axis goes from 0 to 24.
 
void checkPoint()
Updates m_progressReporter or throws if user canceled.
 
static wxString HandleTextOverbar(wxString aCadstarString)
Convert a string with CADSTAR overbar characters to equivalent in KiCad.
 
JUSTIFICATION
From CADSTAR Help: "Multi Line Text can also be justified as Left, Centre or Right.
 
PROGRESS_REPORTER * m_progressReporter
 
bool CheckFileHeader(const std::filesystem::path &aPath) const
 
CADSTAR_PARTS_LIB_MODEL ReadFile(const std::filesystem::path &aPath) const
 
static SCH_FIELD * addNewFieldToSymbol(const wxString &aFieldName, std::unique_ptr< LIB_SYMBOL > &aKiCadSymbol)
 
void loadItemOntoKiCadSheet(const LAYER_ID &aCadstarSheetID, SCH_ITEM *aItem)
 
void Load(SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet)
Loads a CADSTAR Schematic Archive file into the KiCad SCHEMATIC object given.
 
ROUTECODE getRouteCode(const ROUTECODE_ID &aCadstarRouteCodeID)
 
static wxString CreateLibName(const wxFileName &aFileName, const SCH_SHEET *aRootSheet)
 
std::map< BLOCK_PIN_ID, SCH_HIERLABEL * > m_sheetPinMap
Cadstar->KiCad Sheet Pins.
 
const int SMALL_LABEL_SIZE
 
VECTOR2I applyTransform(const VECTOR2I &aPoint, const VECTOR2I &aMoveVector={ 0, 0 }, const EDA_ANGLE &aRotation=ANGLE_0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
 
std::map< SYMBOL_ID, SCH_GLOBALLABEL * > m_globalLabelsMap
Cadstar->KiCad Global Labels.
 
SCH_SYMBOL * loadSchematicSymbol(const SYMBOL &aCadstarSymbol, const LIB_SYMBOL &aKiCadPart, EDA_ANGLE &aComponentOrientation)
 
void applyTextSettings(EDA_TEXT *aKiCadTextItem, const TEXTCODE_ID &aCadstarTextCodeID, const ALIGNMENT &aCadstarAlignment, const JUSTIFICATION &aCadstarJustification, const long long aCadstarOrientAngle=0, bool aMirrored=false)
 
void loadSheetAndChildSheets(const LAYER_ID &aCadstarSheetID, const VECTOR2I &aPosition, const VECTOR2I &aSheetSize, const SCH_SHEET_PATH &aParentSheet)
 
wxString getAttributeName(const ATTRIBUTE_ID &aCadstarAttributeID)
 
std::vector< LIB_SYMBOL * > m_loadedSymbols
Loaded symbols so far.
 
PART getPart(const PART_ID &aCadstarPartID)
 
std::vector< LAYER_ID > findOrphanSheets()
 
std::map< BUS_ID, std::shared_ptr< BUS_ALIAS > > m_busesMap
Cadstar->KiCad Buses.
 
SCH_TEXT * getKiCadSchText(const TEXT &aCadstarTextElement)
 
std::map< TERMINAL_ID, wxString > TERMINAL_TO_PINNUM_MAP
Map between a terminal ID in a symbol definition to the pin number that should be imported into KiCad...
 
wxString getNetName(const NET_SCH &aNet)
 
std::pair< BLOCK_ID, TERMINAL_ID > BLOCK_PIN_ID
 
std::map< SYMBOL_ID, SCH_SYMBOL * > m_powerSymMap
Cadstar->KiCad Power Symbols.
 
std::pair< PART_ID, GATE_ID > PART_GATE_ID
 
void loadDocumentationSymbols()
 
VECTOR2I getKiCadLibraryPoint(const VECTOR2I &aCadstarPoint, const VECTOR2I &aCadstarCentre)
 
PART::DEFINITION::PIN getPartDefinitionPin(const PART &aCadstarPart, const GATE_ID &aGateID, const TERMINAL_ID &aTerminalID)
 
std::map< wxString, TERMINAL_ID > PINNUM_TO_TERMINAL_MAP
 
std::map< SYMDEF_ID, PINNUM_TO_TERMINAL_MAP > m_symDefTerminalsMap
 
int getTextHeightFromTextCode(const TEXTCODE_ID &aCadstarTextCodeID)
 
void loadChildSheets(const LAYER_ID &aCadstarSheetID, const SCH_SHEET_PATH &aSheet)
 
void applyToLibraryFieldAttribute(const ATTRIBUTE_LOCATION &aCadstarAttrLoc, const VECTOR2I &aSymbolOrigin, SCH_FIELD *aKiCadField)
 
double getPolarRadius(const VECTOR2I &aPoint)
 
void setFootprintOnSymbol(std::unique_ptr< LIB_SYMBOL > &aKiCadSymbol, const wxString &aFootprintName, const wxString &aFootprintAlternate)
 
void applyTextCodeIfExists(EDA_TEXT *aKiCadTextItem, const TEXTCODE_ID &aCadstarTextCodeID)
 
int getSheetNumber(const LAYER_ID &aCadstarSheetID)
 
void copySymbolItems(std::unique_ptr< LIB_SYMBOL > &aSourceSym, std::unique_ptr< LIB_SYMBOL > &aDestSym, int aDestUnit, bool aOverrideFields=true)
 
int getLineThickness(const LINECODE_ID &aCadstarLineCodeID)
 
TEXTCODE getTextCode(const TEXTCODE_ID &aCadstarTextCodeID)
 
SPIN_STYLE getSpinStyle(const long long &aCadstarOrientation, bool aMirror)
 
std::map< wxString, LIB_SYMBOL * > m_powerSymLibMap
NetName->KiCad Power Lib Symbol.
 
std::map< std::pair< wxString, wxString >, SYMDEF_ID > m_SymDefNamesCache
Cache storing symbol names and alternates to symdef IDs.
 
std::map< PART_ID, TERMINAL_TO_PINNUM_MAP > m_pinNumsMap
Cadstar Part->KiCad Pin number map.
 
void loadHierarchicalSheetPins()
 
std::vector< LIB_SYMBOL * > LoadPartsLib(const wxString &aFilename)
 
ELECTRICAL_PINTYPE getKiCadPinType(const CADSTAR_PIN_TYPE &aPinType)
 
wxString m_footprintLibName
Name of the footprint library to prepend all footprints with.
 
int getKiCadLength(long long aCadstarLength)
 
std::map< PART_ID, LIB_SYMBOL * > m_partMap
Cadstar->KiCad Parts.
 
bool isAttributeVisible(const ATTRIBUTE_ID &aCadstarAttributeID)
 
VECTOR2I getKiCadPoint(const VECTOR2I &aCadstarPoint)
 
EDA_ANGLE getAngle(const long long &aCadstarAngle)
 
const double ARC_ACCURACY
 
std::map< wxString, SYMDEF_ID > m_DefaultSymDefNamesCache
Cache storing symbol names (default alternate) to symdef IDs.
 
void loadSymbolGateAndPartFields(const SYMDEF_ID &aSymdefID, const PART &aCadstarPart, const GATE_ID &aGateID, LIB_SYMBOL *aSymbol)
 
void loadFigure(const FIGURE &aCadstarFigure, const LAYER_ID &aCadstarSheetIDOverride, SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I &aMoveVector={ 0, 0 }, const EDA_ANGLE &aRotation=ANGLE_0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
 
std::map< PART_GATE_ID, SYMDEF_ID > m_partSymbolsMap
Map holding the symbols loaded so far for a particular PART_ID and GATE_ID.
 
LIB_SYMBOL * getScaledLibPart(const LIB_SYMBOL *aSymbol, long long aScalingFactorNumerator, long long aScalingFactorDenominator)
 
SYMDEF_ID getSymDefFromName(const wxString &aSymdefName, const wxString &aSymDefAlternate)
 
std::pair< VECTOR2I, VECTOR2I > getFigureExtentsKiCad(const FIGURE &aCadstarFigure)
 
std::map< LAYER_ID, SCH_SHEET * > m_sheetMap
Cadstar->KiCad Sheets.
 
POINT getLocationOfNetElement(const NET_SCH &aNet, const NETELEMENT_ID &aNetElementID)
 
void fixUpLibraryPins(LIB_SYMBOL *aSymbolToFix, int aGateNumber)
 
std::map< SYMDEF_ID, std::unique_ptr< const LIB_SYMBOL > > m_symDefMap
Cadstar->KiCad Lib Symbols loaded so far.
 
std::unique_ptr< LIB_SYMBOL > loadLibPart(const CADSTAR_PART_ENTRY &aPart)
 
ALIGNMENT rotate180(const ALIGNMENT &aCadstarAlignment)
 
long long getCadstarAngle(const EDA_ANGLE &aAngle)
 
void loadLibrarySymbolShapeVertices(const std::vector< VERTEX > &aCadstarVertices, const VECTOR2I &aSymbolOrigin, LIB_SYMBOL *aSymbol, int aGateNumber, int aLineThickness)
 
LINE_STYLE getLineStyle(const LINECODE_ID &aCadstarLineCodeID)
 
VECTOR2I m_designCenter
Required for calculating the offset to apply to the Cadstar design so that it fits in the KiCad canva...
 
ALIGNMENT mirrorX(const ALIGNMENT &aCadstarAlignment)
 
int getComponentOrientation(const EDA_ANGLE &aOrientAngle, EDA_ANGLE &aReturnedOrientation)
 
void loadShapeVertices(const std::vector< VERTEX > &aCadstarVertices, LINECODE_ID aCadstarLineCodeID, LAYER_ID aCadstarSheetID, SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I &aMoveVector={ 0, 0 }, const EDA_ANGLE &aRotation=ANGLE_0, const double &aScalingFactor=1.0, const VECTOR2I &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
 
const LIB_SYMBOL * loadSymdef(const SYMDEF_ID &aSymdefID)
 
int getKiCadUnitNumberFromGate(const GATE_ID &aCadstarGateID)
 
void loadSymbolFieldAttribute(const ATTRIBUTE_LOCATION &aCadstarAttrLoc, const EDA_ANGLE &aComponentOrientation, bool aIsMirrored, SCH_FIELD *aKiCadField)
 
void loadSchematicSymbolInstances()
 
ASSIGNMENTS_SCM Assignments
 
CADSTAR_SCHEMATIC Schematic
 
int KiCadUnitDivider
Use this value to convert units in this CSA file to KiCad units.
 
PARTNAMECOL SymbolPartNameColor
 
void Parse()
Parses the file.
 
A base class for most all the KiCad significant classes used in schematics and boards.
 
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
 
KICAD_T Type() const
Returns the type of object.
 
virtual void SetParent(EDA_ITEM *aParent)
 
EDA_ITEM * GetParent() const
 
SHAPE_POLY_SET & GetPolyShape()
 
void SetPolyShape(const SHAPE_POLY_SET &aShape)
 
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
 
void SetStart(const VECTOR2I &aStart)
 
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
 
void SetEnd(const VECTOR2I &aEnd)
 
void SetArcGeometry(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Set the three controlling points for an arc.
 
void SetFillMode(FILL_T aFill)
 
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
 
int GetTextHeight() const
 
const EDA_ANGLE & GetTextAngle() const
 
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
 
virtual const wxString & GetText() const
Return the string associated with the text object.
 
void SetTextPos(const VECTOR2I &aPoint)
 
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
 
void SetTextWidth(int aWidth)
 
virtual void SetVisible(bool aVisible)
 
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
 
void SetTextHeight(int aHeight)
 
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
 
virtual void SetText(const wxString &aText)
 
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
 
int GetTextThickness() const
 
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
 
void SetMultilineAllowed(bool aAllow)
 
VECTOR2I GetTextSize() const
 
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
 
iterator end()
Return a read/write iterator that points to one past the last element in the EE_RTREE.
 
iterator begin()
Return a read/write iterator that points to the first.
 
A logical library item identifier and consists of various portions much like a URI.
 
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
 
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
 
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, bool aLib)
Replace illegal LIB_ID item name characters with underscores '_'.
 
Define a library symbol object.
 
SCH_PIN * GetPin(const wxString &aNumber, int aUnit=0, int aBodyStyle=0) const
Return pin object with the requested pin aNumber.
 
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
 
wxString GetName() const override
 
void SetUnitCount(int aCount, bool aDuplicateDrawItems)
Set the units per symbol count.
 
SCH_FIELD & GetValueField()
Return reference to the value field.
 
std::vector< SCH_PIN * > GetPins() const override
 
std::vector< SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
 
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
 
virtual void SetName(const wxString &aName)
 
SCH_FIELD & GetReferenceField()
Return reference to the reference designator field.
 
ITERATOR_BASE< SCH_ITEM, MULTIVECTOR< SCH_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
 
ITERATOR begin(int aType=UNDEFINED_TYPE)
 
Describe the page size and margins of a paper page on which to eventually print or plot.
 
void SetHeightMils(double aHeightInMils)
 
const VECTOR2D GetSizeIU(double aIUScale) const
Gets the page size in internal units.
 
void SetWidthMils(double aWidthInMils)
 
Container for project specific data.
 
virtual std::map< wxString, wxString > & GetTextVars() const
 
Holds all the data relating to one schematic.
 
void SetSize(const VECTOR2I &aSize)
 
Class for a wire to bus entry.
 
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
 
void SetPosition(const VECTOR2I &aPosition) override
 
void SetText(const wxString &aText) override
 
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
 
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
 
Base class for any item which can be embedded within the SCHEMATIC container class,...
 
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool doClone=false) const
Routine to create a new copy of given item.
 
void SetLayer(SCH_LAYER_ID aLayer)
 
virtual void SetUnit(int aUnit)
 
void SetPosition(const VECTOR2I &aPosition) override
 
void SetShape(LABEL_FLAG_SHAPE aShape)
 
void SetPosition(const VECTOR2I &aPosition) override
 
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
 
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
 
Segment description base class to describe items which have 2 end points (track, wire,...
 
void SetStartPoint(const VECTOR2I &aPosition)
 
void SetLineWidth(const int aSize)
 
VECTOR2I GetEndPoint() const
 
VECTOR2I GetStartPoint() const
 
void SetLineStyle(const LINE_STYLE aStyle)
 
void SetEndPoint(const VECTOR2I &aPosition)
 
void SetNumber(const wxString &aNumber)
 
const PAGE_INFO & GetPageSettings() const
 
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
 
void AddBusAlias(std::shared_ptr< BUS_ALIAS > aAlias)
Add a bus alias definition.
 
void SetPageSettings(const PAGE_INFO &aPageSettings)
 
EE_RTREE & Items()
Get the full RTree, usually for iterating.
 
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
 
void Update(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
Update aItem's bounding box in the tree.
 
void SetPosition(const VECTOR2I &aPos) override
 
void SetStroke(const STROKE_PARAMS &aStroke) override
 
void AddPoint(const VECTOR2I &aPosition)
 
VECTOR2I GetPosition() const override
 
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
 
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
 
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
 
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
 
Define a sheet pin (label) used in sheets to create hierarchical schematics.
 
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
 
wxString GetFileName() const
Return the filename corresponding to this sheet.
 
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
 
std::vector< SCH_FIELD > & GetFields()
Return a reference to the vector holding the sheet's fields.
 
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this sheet.
 
SCH_SCREEN * GetScreen() const
 
VECTOR2I GetPosition() const override
 
void SetFields(const std::vector< SCH_FIELD > &aFields)
Set multiple schematic fields.
 
void SetScreen(SCH_SCREEN *aScreen)
Set the SCH_SCREEN associated with this sheet to aScreen.
 
static bool ClassOf(const EDA_ITEM *aItem)
 
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
 
BOX2I GetBodyAndPinsBoundingBox() const override
Return a bounding box for the symbol body and pins but not the fields.
 
void SetPosition(const VECTOR2I &aPosition) override
 
void UpdatePins()
Updates the cache of SCH_PIN objects for each pin.
 
void SetRef(const SCH_SHEET_PATH *aSheet, const wxString &aReference)
Set the reference for the given sheet path for this symbol.
 
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
 
void SetOrientation(int aOrientation)
Compute the new transform matrix based on aOrientation for the symbol which is applied to the current...
 
SCH_FIELD * AddField(const SCH_FIELD &aField)
Add a field to the symbol.
 
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
 
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
 
VECTOR2I GetPosition() const override
 
void SetPosition(const VECTOR2I &aPosition) override
 
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
 
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_LINE_CHAIN Reverse() const
Reverse point order in the line chain.
 
void SetPoint(int aIndex, const VECTOR2I &aPos)
Move a point to a specific location.
 
int FindSegment(const VECTOR2I &aP, int aThreshold=1) const
Search for segment containing point aP.
 
int Intersect(const SEG &aSeg, INTERSECTIONS &aIp) const
Find all intersection points between our line chain and the segment aSeg.
 
void Replace(int aStartIndex, int aEndIndex, const VECTOR2I &aP)
Replace points with indices in range [start_index, end_index] with a single point aP.
 
virtual size_t GetPointCount() const override
 
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.
 
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Find a point on the line chain that is closest to point aP.
 
std::vector< INTERSECTION > INTERSECTIONS
 
const std::vector< VECTOR2I > & CPoints() const
 
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
 
SPIN_STYLE MirrorX()
Mirror the label spin style across the X axis or simply swaps up and bottom.
 
SPIN_STYLE MirrorY()
Mirror the label spin style across the Y axis or simply swaps left and right.
 
Simple container to manage line stroke parameters.
 
virtual void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
 
virtual void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
 
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
 
#define DEFAULT_WIRE_WIDTH_MILS
The default bus width in mils. (can be changed in preference menu)
 
static constexpr EDA_ANGLE ANGLE_0
 
static constexpr EDA_ANGLE ANGLE_90
 
static constexpr EDA_ANGLE ANGLE_VERTICAL
 
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
 
static constexpr EDA_ANGLE ANGLE_45
 
static constexpr EDA_ANGLE ANGLE_270
 
static constexpr EDA_ANGLE ANGLE_180
 
static constexpr EDA_ANGLE ANGLE_135
 
#define IGNORE_PARENT_GROUP
 
@ FILLED_WITH_BG_BODYCOLOR
 
@ FILLED_SHAPE
Fill with object color.
 
static const std::string KiCadSchematicFileExtension
 
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
 
SCH_LAYER_ID
Eeschema drawing layers.
 
MULTIVECTOR< SCH_ITEM, SCH_SHAPE_T, SCH_PIN_T > LIB_ITEMS_CONTAINER
 
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.
 
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
 
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
 
@ PT_INPUT
usual pin input: must be connected
 
@ PT_BIDI
input or output (like port for a microprocessor)
 
@ PT_OPENCOLLECTOR
pin type open collector
 
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
 
@ PT_UNSPECIFIED
unknown electrical properties: creates always a warning when connected
 
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin.
 
@ PIN_UP
The pin extends upwards from the connection point: Probably on the bottom side of the symbol.
 
@ PIN_RIGHT
The pin extends rightwards from the connection point.
 
@ PIN_LEFT
The pin extends leftwards from the connection point: Probably on the right side of the symbol.
 
@ PIN_DOWN
The pin extends downwards from the connection: Probably on the top side of the symbol.
 
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
 
std::vector< SCH_FIELD > SCH_FIELDS
A container for several SCH_FIELD items.
 
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
 
bool ReplaceIllegalFileNameChars(std::string *aName, int aReplaceChar)
Checks aName for illegal file name characters.
 
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
 
LINE_STYLE
Dashed line types.
 
JUSTIFICATION Justification
Note: Justification has no effect on single lines of text.
 
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
 
ATTRIBUTE_LOCATION AttributeLocation
 
bool HasLocation
Flag to know if this ATTRIBUTE_VALUE has a location i.e.
 
Represent a cutout in a closed shape (e.g.
 
std::vector< VERTEX > Vertices
 
long ScaleRatioNumerator
Documentation symbols can be arbitrarily scaled when added to a design.
 
long ScaleRatioDenominator
Documentation symbols can be arbitrarily scaled when added to a design.
 
POINT Origin
Origin of the component (this is used as the reference point when placing the component in the design...
 
LAYER_ID LayerID
Move all objects in the Symdef to this layer.
 
DOCUMENTATION_SYMBOL_ID ID
 
SYMDEF_ID SymdefID
Normally documentation symbols only have TEXT, FIGURE and TEXT_LOCATION objects which are all drawn o...
 
long Modifier1
It seems this is related to weight. 400=Normal, 700=Bold.
 
wxString Name
This is undefined (wxEmptyString) if the net is unnamed.
 
long SignalNum
This is undefined if the net has been given a name.
 
bool HidePinNames
Specifies whether to display the pin names/identifier in the schematic symbol or not.
 
std::map< GATE_ID, GATE > GateSymbols
 
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
Some attributes are defined within the part definition, whilst others are defined in the part.
 
std::map< PART_DEFINITION_PIN_ID, PIN > Pins
 
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
Some attributes are defined within the part definition, whilst others are defined in the part itself.
 
Represent a point in x,y coordinates.
 
SHAPE_POLY_SET ConvertToPolySet(const std::function< VECTOR2I(const VECTOR2I &)> aCadstarToKicadPointCallback, int aAccuracy) const
 
std::vector< VERTEX > Vertices
 
std::vector< CUTOUT > Cutouts
Not Applicable to OPENSHAPE Type.
 
std::map< FIGURE_ID, FIGURE > Figures
 
std::map< ATTRIBUTE_ID, TEXT_LOCATION > TextLocations
This contains location of any attributes, including designator position.
 
POINT Origin
Origin of the component (this is used as the reference point when placing the component in the design...
 
wxString Alternate
This is in addition to ReferenceName.
 
std::map< TEXT_ID, TEXT > Texts
 
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
These attributes might also have a location.
 
wxString BuildLibName() const
 
long Width
Defaults to 0 if using system fonts or, if using CADSTAR font, default to equal height (1:1 aspect ra...
 
Corresponds to CADSTAR "origin".
 
ALIGNMENT Alignment
In CADSTAR The default alignment for a TEXT object (when "(No Alignment()" is selected) Bottom Left o...
 
JUSTIFICATION Justification
Note: Justification has no effect on single lines of text.
 
< Nodename = "VARIANT" or "VMASTER" (master variant
 
Represents a vertex in a shape.
 
SHAPE_ARC BuildArc(const VECTOR2I &aPrevPoint, const std::function< VECTOR2I(const VECTOR2I &)> aCadstarToKicadPointCallback) const
 
CADSTAR Parts Library (*.lib) model - a data structure describing the contents of the file format.
 
std::vector< CADSTAR_PART_ENTRY > m_PartEntries
 
std::string m_ComponentStem
 
std::map< std::string, std::vector< CADSTAR_PART_PIN > > m_HiddenPins
Pins with an implied electrical connection to a net, not part of any symbol (Note: we probably will n...
 
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_SchAttributes
Dollar sign ($) line $[!
 
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_SchAndPcbAttributes
At symbol (@) line [@[!
 
std::vector< CADSTAR_PART_SYMBOL_ENTRY > m_Symbols
Symbols that form this part.
 
std::map< std::string, std::string > m_UserAttributes
Star (*) line *<User-defined name> This line is ignored by CADSTAR.
 
std::map< long, std::string > m_PinNamesMap
Map of pin identifiers to alphanumeric pin names.
 
std::optional< std::string > m_AcceptancePartName
 
std::optional< std::string > m_Pcb_alternate
 
std::optional< std::string > m_Version
 
std::optional< std::string > m_Description
 
std::optional< std::string > m_Number
 
std::string m_Pcb_component
 
std::optional< std::string > m_SpiceModel
 
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_PcbAttributes
Percentage sign (%) line %[!
 
std::optional< std::string > m_Value
 
std::map< std::string, CADSTAR_ATTRIBUTE_VALUE > m_PartAttributes
Tilde (~) line ~[!
 
std::map< long, std::string > m_PinLabelsMap
Map of pin identifiers to alphanumeric pin labels.
 
std::vector< CADSTAR_PART_PIN > m_Pins
 
std::optional< std::string > m_SymbolAlternateName
 
TYPE Type
Determines what the associated layer is, whether parent, child or clone.
 
ATTRIBUTE_LOCATION BlockLabel
 
LAYER_ID LayerID
The sheet block is on (TODO: verify this is true)
 
LAYER_ID AssocLayerID
Parent or Child linked sheet.
 
std::map< TERMINAL_ID, TERMINAL > Terminals
 
std::map< FIGURE_ID, FIGURE > Figures
 
LAYER_ID LayerID
Sheet on which bus is located.
 
ATTRIBUTE_LOCATION AttrLoc
 
std::map< NETELEMENT_ID, DANGLER > Danglers
 
std::map< NETELEMENT_ID, SYM_TERM > Terminals
 
std::vector< CONNECTION_SCH > Connections
 
std::map< NETELEMENT_ID, BUS_TERM > BusTerminals
 
std::map< NETELEMENT_ID, BLOCK_TERM > BlockTerminals
 
std::map< NETELEMENT_ID, JUNCTION_SCH > Junctions
 
ATTRIBUTE_LOCATION AttrLoc
 
LAYER_ID LayerID
Sheet on which symbol is located.
 
SYMBOL_ID VariantParentSymbolID
 
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
 
GATE_ID GateID
The gate this symbol represents within the associated Part.
 
long ScaleRatioNumerator
Symbols can be arbitrarily scaled in CADSTAR.
 
std::map< TERMINAL_ID, SYMPINNAME_LABEL > PinNames
Identifier of the pin in the PCB Equivalent to KiCad's Pin Number.
 
std::map< TERMINAL_ID, PIN_NUM > PinNumbers
This seems to only appear in older designs and is similar to PinNames but only allowing numerical val...
 
long ScaleRatioDenominator
 
SYMBOLVARIANT SymbolVariant
 
std::map< TERMINAL_ID, PIN_NUM_LABEL_LOC > PinLabelLocations
 
std::map< TERMINAL_ID, PIN_NUM_LABEL_LOC > PinNumberLocations
 
std::map< TERMINAL_ID, TERMINAL > Terminals
 
POINT Position
Pad position within the component's coordinate frame.
 
@ USER
The field ID hasn't been set yet; field is invalid.
 
@ 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 int sign(T val)
 
VECTOR2< int32_t > VECTOR2I
 
constexpr int LexicographicalCompare(const VECTOR2< T > &aA, const VECTOR2< T > &aB)
 
Definition of file extensions used in Kicad.