KiCad PCB EDA Suite
Loading...
Searching...
No Matches
import_net_reconciler.cpp File Reference
#include "import_net_reconciler.h"
#include <board.h>
#include <footprint.h>
#include <import_net_names.h>
#include <netinfo.h>
#include <netlist_reader/pcb_netlist.h>
#include <pad.h>
#include <pcb_field.h>
#include <board_design_settings.h>
#include <reporter.h>
#include <template_fieldnames.h>
#include <map>
#include <set>
#include <vector>

Go to the source code of this file.

Functions

int ReconcileImportedReferences (BOARD &aBoard, NETLIST &aNetlist)
 Give an imported board footprint the reference its schematic symbol uses.
 
NET_RECONCILE_RESULT ReconcileImportedNetNames (BOARD &aBoard, NETLIST &aNetlist, REPORTER &aReporter)
 Give each net of an imported board the name its schematic uses.
 
int FillImportedFootprintFields (BOARD &aBoard, NETLIST &aNetlist)
 Copy what an imported board footprint lacks from the schematic symbol it is linked to.
 

Function Documentation

◆ FillImportedFootprintFields()

int FillImportedFootprintFields ( BOARD & aBoard,
NETLIST & aNetlist )

Copy what an imported board footprint lacks from the schematic symbol it is linked to.

A footprint takes the symbol's value only when its own is empty and gains only the symbol fields it does not have, the same set Update PCB from Schematic copies. Nothing the board already holds changes.

Parameters
[in]aBoardis the imported board whose footprints are completed.
[in]aNetlistis the netlist of the imported schematic.
Returns
the number of footprints that gained a value or a field.

Definition at line 267 of file import_net_reconciler.cpp.

References FOOTPRINT::Add(), B_Fab, F_Cu, F_Fab, FOOTPRINT, NETLIST::GetComponent(), NETLIST::GetCount(), GetDefaultFieldName(), BOARD::GetDesignSettings(), FOOTPRINT::GetField(), COMPONENT::GetFields(), FOOTPRINT::GetLayer(), FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), COMPONENT::GetReference(), COMPONENT::GetValue(), FOOTPRINT::GetValue(), FOOTPRINT::HasField(), name, REFERENCE, PCB_TEXT::Rotate(), BOARD_ITEM::SetLayer(), PCB_FIELD::SetName(), PCB_TEXT::SetPosition(), EDA_TEXT::SetText(), FOOTPRINT::SetValue(), EDA_TEXT::SetVisible(), PCB_TEXT::StyleFromSettings(), UNTRANSLATED, USER, and VALUE.

Referenced by BOOST_AUTO_TEST_CASE(), and PCB_EDIT_FRAME::KiwayMailIn().

◆ ReconcileImportedNetNames()

NET_RECONCILE_RESULT ReconcileImportedNetNames ( BOARD & aBoard,
NETLIST & aNetlist,
REPORTER & aReporter )

Give each net of an imported board the name its schematic uses.

A board net is renamed only when its pads, on the footprints both documents share, are exactly the pins of one schematic net. A net the two documents divide differently keeps its name and is reported, so a real difference between them stays visible. A pad that has no net but whose schematic net joins nothing else takes that net's name.

Shared by the project manager's import and the kicad-cli import job.

Parameters
[in]aBoardis the imported board whose nets are renamed.
[in]aNetlistis the netlist of the imported schematic.
[in]aReporterreceives the counts and the first differences.

Definition at line 136 of file import_net_reconciler.cpp.

References _, BOARD::Add(), ApplyImportedNetNameMap(), BOARD::FindNet(), NETLIST::GetComponent(), NETLIST::GetCount(), COMPONENT::GetNet(), COMPONENT::GetNetCount(), COMPONENT::GetReference(), name, pad, pin, REPORTER::Report(), result, and RPT_SEVERITY_INFO.

Referenced by PCB_EDIT_FRAME::KiwayMailIn().

◆ ReconcileImportedReferences()

int ReconcileImportedReferences ( BOARD & aBoard,
NETLIST & aNetlist )

Give an imported board footprint the reference its schematic symbol uses.

Only a footprint whose reference no symbol has is renamed, and only when exactly one unmatched symbol reference equals it ignoring case or once the importer's "UNK" prefix is removed. Run this before the net names are reconciled, since both match footprints by reference.

Parameters
[in]aBoardis the imported board whose footprints are renamed.
[in]aNetlistis the netlist of the imported schematic.
Returns
the number of footprints renamed.

Definition at line 68 of file import_net_reconciler.cpp.

References BOARD::Footprints(), NETLIST::GetComponent(), NETLIST::GetCount(), and COMPONENT::GetReference().

Referenced by BOOST_AUTO_TEST_CASE(), and PCB_EDIT_FRAME::KiwayMailIn().