|
TraceMaker
C++ API of the engine
|
Classes | |
| class | BoardEditor |
| struct | LoadedBoard |
| struct | SrjPoint |
| struct | SrjObstacle |
| struct | SrjConnection |
| struct | SrjNet |
| One electrical net: the connections and obstacles that tscircuit's connectivity map (lib/utils/getConnectivityMapFromSimpleRouteJson.ts) puts in one group. More... | |
| struct | SrjRules |
| struct | SrjPlane |
| A bus whose termination is a plane: every connection of the bus ends in a plane on layer. More... | |
| struct | SrjProblem |
| struct | SrjImportOptions |
| struct | SrjBoardFiles |
| struct | SrjExport |
Functions | |
| bool | flip_supported (const LoadedBoard &board, std::size_t index, std::string *why=nullptr) |
| True if BoardEditor::flip_footprint mirrors every item of footprint index exactly: no copper on inner layers, no padstacks, no text on copper, and nothing it does not know (zones, text boxes, dimensions, private layers, ...). | |
| std::string | flip_layer_name (const model::Board &board, std::string_view name) |
| KiCad's FlipLayer for outer layers: the first and last copper layer of board (by their names in the file) and F.X <-> B.X for the other side-specific layers; any other name unchanged. | |
| std::string | format_angle (double deg) |
| Formats an angle the way KiCad writes it: shortest decimal, no trailing zeros ("90", "45.5"). | |
| LoadedBoard | read_board_file (const std::string &path) |
| Throws sexpr::ParseError or std::runtime_error on malformed files. | |
| model::Board | read_board (const sexpr::Document &doc) |
| Reads the board as the document would be written: pending edits are applied first (the returned board's node ids then refer to the re-parsed text, so do not use them to edit doc further). | |
| model::Netlist | read_netlist_file (const std::string &path) |
| Parses a KiCad s-expression netlist (format "E", from kicad-cli sch export netlist –format kicadsexpr). | |
| model::Netlist | netlist_from_schematic (const std::string &sch_path, const std::string &tmp_dir) |
| Runs kicad-cli sch export netlist on a schematic and parses the result. Throws if kicad-cli fails. | |
| model::DesignRules | read_design_rules (const std::string &board_path) |
| board_path is the .kicad_pcb; the project and rule files are looked up next to it with the same stem. | |
| std::optional< Coord > | parse_length (std::string_view s) |
| Parses a KiCad length with an optional unit suffix ("0.2mm", "8mil", "0.01in", "150um", "0.2") to nm. | |
| SrjProblem | read_srj (const std::string &text) |
| Parses SRJ text. | |
| SrjProblem | read_srj_file (const std::string &path) |
| std::string | srj_layer_name (int z, int layer_count) |
| "top", "inner1", ..., "bottom" for a stack index, and back (-1 if the name is not a layer of the stack). | |
| int | srj_layer_index (const std::string &name, int layer_count) |
| SrjBoardFiles | srj_to_kicad (const SrjProblem &problem, const SrjImportOptions &opt={}) |
| The board is the problem mirrored in y at the same coordinates (x, -y), one footprint per componentId. | |
| SrjExport | srj_export (const std::string &problem_text, const model::Board &routed) |
| Writes the tracks and vias of routed (a board made by srj_to_kicad from problem_text, then routed) as SRJ traces: one trace per pair of consecutive points of a connection, following the copper between their pads, then the copper no such path used. | |
Variables | |
| constexpr double | kSrjDefaultClearanceMm = 0.15 |
| tscircuit's fallbacks for what a problem leaves out: its router's default obstacle margin (defaultObstacleMargin ?
| |
| constexpr double | kSrjDefaultViaPadMm = 0.3 |
| std::string tmk::io::flip_layer_name | ( | const model::Board & | board, |
| std::string_view | name ) |
KiCad's FlipLayer for outer layers: the first and last copper layer of board (by their names in the file) and F.X <-> B.X for the other side-specific layers; any other name unchanged.
| bool tmk::io::flip_supported | ( | const LoadedBoard & | board, |
| std::size_t | index, | ||
| std::string * | why = nullptr ) |
True if BoardEditor::flip_footprint mirrors every item of footprint index exactly: no copper on inner layers, no padstacks, no text on copper, and nothing it does not know (zones, text boxes, dimensions, private layers, ...).
why receives the first reason it cannot.
| std::string tmk::io::format_angle | ( | double | deg | ) |
Formats an angle the way KiCad writes it: shortest decimal, no trailing zeros ("90", "45.5").
| model::Netlist tmk::io::netlist_from_schematic | ( | const std::string & | sch_path, |
| const std::string & | tmp_dir ) |
Runs kicad-cli sch export netlist on a schematic and parses the result. Throws if kicad-cli fails.
| std::optional< Coord > tmk::io::parse_length | ( | std::string_view | s | ) |
Parses a KiCad length with an optional unit suffix ("0.2mm", "8mil", "0.01in", "150um", "0.2") to nm.
| model::Board tmk::io::read_board | ( | const sexpr::Document & | doc | ) |
Reads the board as the document would be written: pending edits are applied first (the returned board's node ids then refer to the re-parsed text, so do not use them to edit doc further).
| LoadedBoard tmk::io::read_board_file | ( | const std::string & | path | ) |
Throws sexpr::ParseError or std::runtime_error on malformed files.
| model::DesignRules tmk::io::read_design_rules | ( | const std::string & | board_path | ) |
board_path is the .kicad_pcb; the project and rule files are looked up next to it with the same stem.
Missing files give KiCad's defaults and a warning, never an exception.
| model::Netlist tmk::io::read_netlist_file | ( | const std::string & | path | ) |
Parses a KiCad s-expression netlist (format "E", from kicad-cli sch export netlist –format kicadsexpr).
| SrjProblem tmk::io::read_srj | ( | const std::string & | text | ) |
Parses SRJ text.
Throws std::runtime_error on malformed input or a field whose meaning is unknown where it matters (e.g. a layer name outside top/innerN/bottom).
| SrjProblem tmk::io::read_srj_file | ( | const std::string & | path | ) |
| SrjExport tmk::io::srj_export | ( | const std::string & | problem_text, |
| const model::Board & | routed ) |
Writes the tracks and vias of routed (a board made by srj_to_kicad from problem_text, then routed) as SRJ traces: one trace per pair of consecutive points of a connection, following the copper between their pads, then the copper no such path used.
Nets are matched by name, pads by position.
| int tmk::io::srj_layer_index | ( | const std::string & | name, |
| int | layer_count ) |
| std::string tmk::io::srj_layer_name | ( | int | z, |
| int | layer_count ) |
"top", "inner1", ..., "bottom" for a stack index, and back (-1 if the name is not a layer of the stack).
| SrjBoardFiles tmk::io::srj_to_kicad | ( | const SrjProblem & | problem, |
| const SrjImportOptions & | opt = {} ) |
The board is the problem mirrored in y at the same coordinates (x, -y), one footprint per componentId.
The output depends only on the problem and the options (UUIDs are counted, not drawn), so it is byte-identical across runs.
|
inlineconstexpr |