|
KiCad PCB EDA Suite
|
#include <ltspice_schematic.h>
Classes | |
| struct | ARC |
| The ARC is represented inside a rectangle whose opposite site are given. More... | |
| struct | BUSTAP |
| struct | CIRCLE |
| The CIRCLE is represented in Ltpsice inside a rectangle whose two opposite points and line style are given. More... | |
| struct | DATAFLAG |
| struct | FLAG |
| struct | IOPIN |
| IOPIN is special contact on symbol used for IO operations. More... | |
| struct | LINE |
| struct | LT_ASC |
| A struct to hold .asc file definition. More... | |
| struct | LT_PIN |
| struct | LT_SYMBOL |
| A struct to hold SYMBOL definition. More... | |
| struct | LT_WINDOW |
| struct | RECTANGLE |
| A 4-sided polygon with opposite equal sides, used in representing shapes. More... | |
| struct | TEXT |
| struct | WIRE |
| A metallic connection, used for transfer, between two points or pin. More... | |
Public Types | |
| enum class | LINESTYLE { SOLID = 0 , DASH = 1 , DOT = 2 , DASHDOT = 3 , DASHDOTDOT = 4 } |
| enum class | LINEWIDTH { Normal = 5 , Wide = 10 } |
| enum class | POLARITY { PIN_INPUT , OUTPUT , BIDIR } |
| Polarity enum represents polarity of pin. More... | |
| enum class | SYMBOLTYPE { CELL , BLOCK } |
| Type of Symbol loaded from asc and asy file. More... | |
| enum class | JUSTIFICATION { NONE , BOTTOM , LEFT , RIGHT , CENTER , TOP , VBOTTOM , VLEFT , VRIGHT , VCENTER , VTOP , INVISIBLE } |
| Defines in what ways the PIN or TEXT can be justified. More... | |
| enum class | ORIENTATION { R0 , R90 , R180 , R270 , M0 , M90 , M180 , M270 } |
| Defines different types or rotation and mirror operation can be applied to a LT_SYMBOL. More... | |
Public Member Functions | |
| LTSPICE_SCHEMATIC (const wxString &aFilename, const wxFileName &aLTspiceDataDir, REPORTER *aReporter, PROGRESS_REPORTER *aProgressReporter) | |
| ~LTSPICE_SCHEMATIC () | |
| void | Load (SCHEMATIC *aSchematic, SCH_SHEET *aRootSheet, const wxFileName &aLibraryFileName, REPORTER *aReporter) |
| The main function responsible for loading the .asc and .asy files. | |
| wxString | GetSchematicFileName (const wxString &aAscKey) const |
| Return "amp.kicad_sch" for "foo/amp" when both keys are one .asc, else "foo_amp.kicad_sch". | |
| wxString | GetSymbolName (const wxString &aSymbolName) const |
| Return "amp" for "foo/amp" when both keys are one .asy, else "foo_amp". | |
| void | GetAscAndAsyFilePaths (const wxDir &aDir, bool aRecursive, std::map< wxString, wxString > &aMapOfAscFiles, std::map< wxString, wxString > &aMapOfAsyFiles, const std::vector< wxString > &aBaseDirs={}) |
| Used to get file path for Asc and Asy files. | |
| std::vector< LTSPICE_FILE > | GetSchematicElements (const wxString &aAscFile) |
| Used to get symbols list present in asc file. | |
| bool | IsAsySubsheet (const wxString &aAsyFile) |
| Check if the asy file content indicates that we need to load subsheet. | |
| std::map< wxString, wxString > | ReadAsyFiles (const std::vector< LTSPICE_FILE > &aSourceFiles, const std::map< wxString, wxString > &aAsyFileMap) |
| The function returns a map. | |
| std::map< wxString, LT_ASC > | ParseAscFiles (const std::map< wxString, wxString > &aAscFilesContent) |
| Build Intermediate data structure. | |
| LT_SYMBOL | ParseSymbol (const wxString &aSymbolName, const wxString &aAsyFileContent, LT_ASC &aAscFile) |
| LT_SYMBOL | MakeDummySymbol (const wxString &aAscFileName) |
| const wxFileName & | GetLTspiceDataDir () |
Static Private Member Functions | |
| static void | aggregateAttributeValue (wxArrayString &aTokens, int aIndex) |
| Join value present across multiple tokens into one. | |
| static int | integerCheck (const wxString &aToken, int aLineNumber, const wxString &aFileName) |
| Used to check if the given token in integer or not. | |
| static VECTOR2I | pointCheck (const wxString &aTokenX, const wxString &aTokenY, int aLineNumber, const wxString &aFileName) |
| static void | tokensSizeRangeCheck (size_t aActualSize, int aExpectedMin, int aExpectedMax, int aLineNumber, const wxString &aFileName) |
| Used to check size of the token generated from split function. | |
| static void | removeCarriageReturn (wxString &elementFromLine) |
| static LINESTYLE | getLineStyle (int aValue) |
| static LINEWIDTH | getLineWidth (const wxString &aValue) |
| static POLARITY | getPolarity (const wxString &aValue) |
| static ORIENTATION | getSymbolRotationOrMirror (const wxString &aValue) |
| static JUSTIFICATION | getTextJustification (const wxString &aValue) |
| static JUSTIFICATION | getPinJustification (const wxString &aValue) |
| static SYMBOLTYPE | getSymbolType (const wxString &aValue) |
Private Attributes | |
| REPORTER * | m_reporter |
| wxFileName | m_ltspiceDataDir |
| std::map< wxString, wxString > | m_ascFileCache |
| std::map< wxString, wxString > | m_asyFileCache |
| std::map< wxString, wxString > | m_ascNamesMap |
| std::map< wxString, wxString > | m_asyNamesMap |
Definition at line 53 of file ltspice_schematic.h.
|
strong |
Defines in what ways the PIN or TEXT can be justified.
| Enumerator | |
|---|---|
| NONE | |
| BOTTOM | |
| LEFT | |
| RIGHT | |
| CENTER | |
| TOP | |
| VBOTTOM | |
| VLEFT | |
| VRIGHT | |
| VCENTER | |
| VTOP | |
| INVISIBLE | |
Definition at line 96 of file ltspice_schematic.h.
|
strong |
| Enumerator | |
|---|---|
| SOLID | |
| DASH | |
| DOT | |
| DASHDOT | |
| DASHDOTDOT | |
Definition at line 56 of file ltspice_schematic.h.
|
strong |
| Enumerator | |
|---|---|
| Normal | |
| Wide | |
Definition at line 65 of file ltspice_schematic.h.
|
strong |
Defines different types or rotation and mirror operation can be applied to a LT_SYMBOL.
| Enumerator | |
|---|---|
| R0 | |
| R90 | |
| R180 | |
| R270 | |
| M0 | |
| M90 | |
| M180 | |
| M270 | |
Definition at line 115 of file ltspice_schematic.h.
|
strong |
Polarity enum represents polarity of pin.
| Enumerator | |
|---|---|
| PIN_INPUT | |
| OUTPUT | |
| BIDIR | |
Definition at line 74 of file ltspice_schematic.h.
|
strong |
Type of Symbol loaded from asc and asy file.
NOTE: Currently we have only found CELL and BLOCK type of symbol components others, we are not able to reproduce till now.
| Enumerator | |
|---|---|
| CELL | |
| BLOCK | |
Definition at line 87 of file ltspice_schematic.h.
|
inlineexplicit |
Definition at line 278 of file ltspice_schematic.h.
References m_ltspiceDataDir, and m_reporter.
|
inline |
Definition at line 284 of file ltspice_schematic.h.
|
staticprivate |
Join value present across multiple tokens into one.
| aTokens | an array of tokenised data. |
| aIndex | from where the tokens should be concatenated. |
Definition at line 515 of file ltspice_schematic.cpp.
Referenced by ParseAscFiles(), and ParseSymbol().
| void LTSPICE_SCHEMATIC::GetAscAndAsyFilePaths | ( | const wxDir & | aDir, |
| bool | aRecursive, | ||
| std::map< wxString, wxString > & | aMapOfAscFiles, | ||
| std::map< wxString, wxString > & | aMapOfAsyFiles, | ||
| const std::vector< wxString > & | aBaseDirs = {} ) |
Used to get file path for Asc and Asy files.
| aDir | is the path to search. |
| aRecursive | recursively searches aDir if true. |
| aMapOfAscFiles | map of string containing content from asc files. |
| aMapOfAsyFiles | map of string containing content from asy files. |
| aBaseDirs |
Definition at line 349 of file ltspice_schematic.cpp.
References _, GetAscAndAsyFilePaths(), m_reporter, path, and RPT_SEVERITY_WARNING.
Referenced by GetAscAndAsyFilePaths(), and Load().
|
staticprivate |
| aValue | integer value between 0-3 |
Definition at line 523 of file ltspice_schematic.cpp.
References _, DASH, DASHDOT, DASHDOTDOT, DOT, SOLID, and THROW_IO_ERROR.
Referenced by ParseAscFiles(), and ParseSymbol().
|
staticprivate |
| aValue | string value |
Definition at line 540 of file ltspice_schematic.cpp.
References _, Normal, THROW_IO_ERROR, and Wide.
Referenced by ParseAscFiles(), and ParseSymbol().
|
inline |
Definition at line 358 of file ltspice_schematic.h.
References m_ltspiceDataDir.
|
staticprivate |
| aValue | string value |
Definition at line 617 of file ltspice_schematic.cpp.
References _, BOTTOM, LEFT, NONE, RIGHT, THROW_IO_ERROR, TOP, VBOTTOM, VCENTER, VLEFT, VRIGHT, and VTOP.
Referenced by ParseSymbol().
|
staticprivate |
| aValue | string value |
Definition at line 554 of file ltspice_schematic.cpp.
References _, BIDIR, OUTPUT, PIN_INPUT, and THROW_IO_ERROR.
Referenced by ParseAscFiles().
| std::vector< LTSPICE_FILE > LTSPICE_SCHEMATIC::GetSchematicElements | ( | const wxString & | aAscFile | ) |
Used to get symbols list present in asc file.
| aAscFile | is the file to be read. |
Definition at line 443 of file ltspice_schematic.cpp.
Referenced by Load().
| wxString LTSPICE_SCHEMATIC::GetSchematicFileName | ( | const wxString & | aAscKey | ) | const |
Return "amp.kicad_sch" for "foo/amp" when both keys are one .asc, else "foo_amp.kicad_sch".
Definition at line 84 of file ltspice_schematic.cpp.
References getShortestKey(), FILEEXT::KiCadSchematicFileExtension, m_ascNamesMap, name, and ReplaceIllegalFileNameChars().
Referenced by Load().
| wxString LTSPICE_SCHEMATIC::GetSymbolName | ( | const wxString & | aSymbolName | ) | const |
Return "amp" for "foo/amp" when both keys are one .asy, else "foo_amp".
Definition at line 97 of file ltspice_schematic.cpp.
References LIB_ID::FixIllegalChars(), getShortestKey(), m_asyNamesMap, name, and UTF8::wx_str().
|
staticprivate |
| aValue | string value |
Definition at line 572 of file ltspice_schematic.cpp.
References _, M0, M180, M270, M90, R0, R180, R270, R90, and THROW_IO_ERROR.
Referenced by ParseAscFiles().
|
staticprivate |
| aValue | string value |
Definition at line 639 of file ltspice_schematic.cpp.
References _, BLOCK, CELL, and THROW_IO_ERROR.
Referenced by ParseSymbol().
|
staticprivate |
| aValue | string value |
Definition at line 593 of file ltspice_schematic.cpp.
References _, BOTTOM, CENTER, INVISIBLE, LEFT, RIGHT, THROW_IO_ERROR, TOP, VBOTTOM, VCENTER, VLEFT, VRIGHT, and VTOP.
Referenced by ParseAscFiles(), and ParseSymbol().
|
staticprivate |
Used to check if the given token in integer or not.
| aToken | token to be verified. |
| aLineNumber | gives on which line number the check is called. |
| aFileName | gives in which file the check is been called. |
| IO_ERROR | if the token is not an integer. |
Definition at line 486 of file ltspice_schematic.cpp.
References _, result, and THROW_IO_ERRORF.
Referenced by ParseAscFiles(), ParseSymbol(), and pointCheck().
| bool LTSPICE_SCHEMATIC::IsAsySubsheet | ( | const wxString & | aAsyFile | ) |
Check if the asy file content indicates that we need to load subsheet.
| aAsyFile | contents of .asy file. |
Definition at line 472 of file ltspice_schematic.cpp.
Referenced by Load().
| void LTSPICE_SCHEMATIC::Load | ( | SCHEMATIC * | aSchematic, |
| SCH_SHEET * | aRootSheet, | ||
| const wxFileName & | aLibraryFileName, | ||
| REPORTER * | aReporter ) |
The main function responsible for loading the .asc and .asy files.
| aSchematic | is the schematic object. |
| aRootSheet | is the root sheet referencing variable. |
| aLibraryFileName | is the name of the library which gets created when the plugin runs. |
| aReporter | is an optional REPORTER object to write load status information. |
Definition at line 105 of file ltspice_schematic.cpp.
References _, A0, A1, A2, A3, A4, A5, LTSPICE_SCHEMATIC::LT_ASC::BoundingBox, SCHEMATIC::BuildUnorderedSheetList(), alg::contains(), SCH_IO_LTSPICE_PARSER::CreateItems(), GetAscAndAsyFilePaths(), BOX2< Vec >::GetCenter(), BOX2< Vec >::GetEnd(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetOrigin(), PROJECT::GetProjectPath(), GetSchematicElements(), GetSchematicFileName(), SCH_SHEET::GetScreen(), getShortestKey(), PAGE_INFO::GetSizeIU(), BOX2< Vec >::GetWidth(), grid, IsAsySubsheet(), SCH_SCREEN::Items(), KiROUND(), m_ascFileCache, m_ascNamesMap, m_asyFileCache, m_asyNamesMap, m_ltspiceDataDir, BOX2< Vec >::Merge(), ParseAscFiles(), pin, SCHEMATIC::Project(), REPORTER::Report(), RPT_SEVERITY_ERROR, SafeReadFile(), schIUScale, SCH_SCREEN::SetFileName(), SCH_SCREEN::SetPageSettings(), SCH_SHEET_PATH::size(), SCH_IO_LTSPICE_PARSER::ToKicadCoords(), IO_ERROR::What(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SCH_IO_LTSPICE::LoadSchematicFile().
| LTSPICE_SCHEMATIC::LT_SYMBOL LTSPICE_SCHEMATIC::MakeDummySymbol | ( | const wxString & | aAscFileName | ) |
Definition at line 905 of file ltspice_schematic.cpp.
References LTSPICE_SCHEMATIC::LT_SYMBOL::AsyKey, LTSPICE_SCHEMATIC::RECTANGLE::BotRight, CELL, DASH, LTSPICE_SCHEMATIC::RECTANGLE::LineStyle, LTSPICE_SCHEMATIC::RECTANGLE::LineWidth, LTSPICE_SCHEMATIC::LT_SYMBOL::Name, R0, LTSPICE_SCHEMATIC::LT_SYMBOL::Rectangles, LTSPICE_SCHEMATIC::LT_SYMBOL::SymbolOrientation, LTSPICE_SCHEMATIC::LT_SYMBOL::SymbolType, LTSPICE_SCHEMATIC::RECTANGLE::TopLeft, and Wide.
Referenced by ParseAscFiles().
| std::map< wxString, LTSPICE_SCHEMATIC::LT_ASC > LTSPICE_SCHEMATIC::ParseAscFiles | ( | const std::map< wxString, wxString > & | aAscFilesContent | ) |
Build Intermediate data structure.
| aAscFilesContent | map of filenames and content from asc files. |
The Arc is enclosed in the square given by above coordinates and its start and end coordinates are given. The arc is drawn counterclockwise from the starting point to the ending point.
Definition at line 926 of file ltspice_schematic.cpp.
References _, aggregateAttributeValue(), LTSPICE_SCHEMATIC::ARC::ArcEnd, LTSPICE_SCHEMATIC::LT_ASC::Arcs, LTSPICE_SCHEMATIC::ARC::ArcStart, LTSPICE_SCHEMATIC::LT_SYMBOL::AsyKey, LTSPICE_SCHEMATIC::ARC::BotRight, LTSPICE_SCHEMATIC::RECTANGLE::BotRight, LTSPICE_SCHEMATIC::LT_ASC::BoundingBox, LTSPICE_SCHEMATIC::LT_ASC::Bustap, circle(), LTSPICE_SCHEMATIC::LT_ASC::Circles, LTSPICE_SCHEMATIC::LT_ASC::DataFlags, LTSPICE_SCHEMATIC::BUSTAP::End, LTSPICE_SCHEMATIC::LINE::End, LTSPICE_SCHEMATIC::WIRE::End, flag, LTSPICE_SCHEMATIC::LT_ASC::Flags, LTSPICE_SCHEMATIC::LT_WINDOW::FontSize, getLineStyle(), getLineWidth(), getPolarity(), getShortestKey(), getSymbolRotationOrMirror(), getTextJustification(), integerCheck(), LTSPICE_SCHEMATIC::LT_ASC::Iopins, LTSPICE_SCHEMATIC::LT_WINDOW::Justification, LTSPICE_SCHEMATIC::LT_ASC::Lines, LTSPICE_SCHEMATIC::ARC::LineStyle, LTSPICE_SCHEMATIC::LINE::LineStyle, LTSPICE_SCHEMATIC::RECTANGLE::LineStyle, LTSPICE_SCHEMATIC::ARC::LineWidth, LTSPICE_SCHEMATIC::LINE::LineWidth, LTSPICE_SCHEMATIC::RECTANGLE::LineWidth, LTSPICE_SCHEMATIC::IOPIN::Location, m_asyFileCache, m_asyNamesMap, m_reporter, MakeDummySymbol(), BOX2< Vec >::Merge(), name, LTSPICE_SCHEMATIC::LT_SYMBOL::Offset, ParseSymbol(), pointCheck(), LTSPICE_SCHEMATIC::IOPIN::Polarity, LTSPICE_SCHEMATIC::LT_WINDOW::Position, LTSPICE_SCHEMATIC::LT_ASC::Rectangles, removeCarriageReturn(), RPT_SEVERITY_ERROR, LTSPICE_SCHEMATIC::LT_ASC::SheetNumber, LTSPICE_SCHEMATIC::LT_ASC::SheetSize, LTSPICE_SCHEMATIC::BUSTAP::Start, LTSPICE_SCHEMATIC::LINE::Start, LTSPICE_SCHEMATIC::WIRE::Start, LTSPICE_SCHEMATIC::LT_SYMBOL::SymbolOrientation, LTSPICE_SCHEMATIC::LT_ASC::Symbols, text, LTSPICE_SCHEMATIC::LT_ASC::Texts, THROW_IO_ERROR, tokensSizeRangeCheck(), LTSPICE_SCHEMATIC::ARC::TopLeft, LTSPICE_SCHEMATIC::RECTANGLE::TopLeft, LTSPICE_SCHEMATIC::LT_ASC::Version, LTSPICE_SCHEMATIC::LT_ASC::VersionMinor, IO_ERROR::What(), LTSPICE_SCHEMATIC::LT_WINDOW::WindowNumber, LTSPICE_SCHEMATIC::LT_SYMBOL::Windows, and LTSPICE_SCHEMATIC::LT_ASC::Wires.
Referenced by Load().
| LTSPICE_SCHEMATIC::LT_SYMBOL LTSPICE_SCHEMATIC::ParseSymbol | ( | const wxString & | aSymbolName, |
| const wxString & | aAsyFileContent, | ||
| LT_ASC & | aAscFile ) |
The Circle is enclosed in the square which is represented by bottomRight and topLeft coordinates.
The Arc is enclosed in the square given by above coordinates and its start and end coordinates are given. The arc is drawn counterclockwise from the starting point to the ending point.
Definition at line 660 of file ltspice_schematic.cpp.
References aggregateAttributeValue(), LTSPICE_SCHEMATIC::ARC::ArcEnd, LTSPICE_SCHEMATIC::LT_SYMBOL::Arcs, LTSPICE_SCHEMATIC::ARC::ArcStart, LTSPICE_SCHEMATIC::ARC::BotRight, LTSPICE_SCHEMATIC::RECTANGLE::BotRight, CELL, circle(), LTSPICE_SCHEMATIC::LT_SYMBOL::Circles, LTSPICE_SCHEMATIC::LINE::End, LTSPICE_SCHEMATIC::LT_WINDOW::FontSize, getLineStyle(), getLineWidth(), getPinJustification(), getSymbolType(), getTextJustification(), integerCheck(), LTSPICE_SCHEMATIC::LT_WINDOW::Justification, LTSPICE_SCHEMATIC::LT_SYMBOL::Lines, LTSPICE_SCHEMATIC::ARC::LineStyle, LTSPICE_SCHEMATIC::LINE::LineStyle, LTSPICE_SCHEMATIC::RECTANGLE::LineStyle, LTSPICE_SCHEMATIC::ARC::LineWidth, LTSPICE_SCHEMATIC::LINE::LineWidth, LTSPICE_SCHEMATIC::RECTANGLE::LineWidth, LTSPICE_SCHEMATIC::LT_SYMBOL::Name, name, pin, LTSPICE_SCHEMATIC::LT_SYMBOL::Pins, pointCheck(), LTSPICE_SCHEMATIC::LT_WINDOW::Position, R0, LTSPICE_SCHEMATIC::LT_SYMBOL::Rectangles, removeCarriageReturn(), LTSPICE_SCHEMATIC::LINE::Start, LTSPICE_SCHEMATIC::LT_SYMBOL::SymAttributes, LTSPICE_SCHEMATIC::LT_SYMBOL::SymbolOrientation, LTSPICE_SCHEMATIC::LT_SYMBOL::SymbolType, text, LTSPICE_SCHEMATIC::LT_SYMBOL::Texts, tokensSizeRangeCheck(), LTSPICE_SCHEMATIC::ARC::TopLeft, LTSPICE_SCHEMATIC::RECTANGLE::TopLeft, LTSPICE_SCHEMATIC::LT_WINDOW::WindowNumber, and LTSPICE_SCHEMATIC::LT_SYMBOL::Windows.
Referenced by ParseAscFiles().
|
staticprivate |
Definition at line 497 of file ltspice_schematic.cpp.
References integerCheck().
Referenced by ParseAscFiles(), and ParseSymbol().
| std::map< wxString, wxString > LTSPICE_SCHEMATIC::ReadAsyFiles | ( | const std::vector< LTSPICE_FILE > & | aSourceFiles, |
| const std::map< wxString, wxString > & | aAsyFileMap ) |
The function returns a map.
This map has all the asy files in form of string. For asy files the key will be symbol name.
| aSourceFiles | contains all the symbols for which we we have to load the .asy files. |
| aAsyFileMap |
Definition at line 425 of file ltspice_schematic.cpp.
References getShortestKey(), SafeReadFile(), and source.
|
staticprivate |
Definition at line 653 of file ltspice_schematic.cpp.
Referenced by ParseAscFiles(), and ParseSymbol().
|
staticprivate |
Used to check size of the token generated from split function.
| aActualSize | actual size of array of token. |
| aExpectedMin | expected lower range(i.e size) of array of token. |
| aExpectedMax | expected higher range(i.e size) of array of token. |
| aLineNumber | gives on which line number the check is called. |
| aFileName | gives in which file the check is been called. |
| IO_ERROR | if the actualSize is not within expected lower range..higher range. |
Definition at line 505 of file ltspice_schematic.cpp.
References _, and THROW_IO_ERRORF.
Referenced by ParseAscFiles(), and ParseSymbol().
|
private |
Definition at line 443 of file ltspice_schematic.h.
Referenced by Load().
|
private |
Definition at line 446 of file ltspice_schematic.h.
Referenced by GetSchematicFileName(), and Load().
|
private |
Definition at line 444 of file ltspice_schematic.h.
Referenced by Load(), and ParseAscFiles().
|
private |
Definition at line 447 of file ltspice_schematic.h.
Referenced by GetSymbolName(), Load(), and ParseAscFiles().
|
private |
Definition at line 441 of file ltspice_schematic.h.
Referenced by GetLTspiceDataDir(), Load(), and LTSPICE_SCHEMATIC().
|
private |
Definition at line 440 of file ltspice_schematic.h.
Referenced by GetAscAndAsyFilePaths(), LTSPICE_SCHEMATIC(), and ParseAscFiles().