KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DSN::SPECCTRA_DB Class Reference

A DSN data tree, usually coming from a DSN file. More...

#include <specctra.h>

Inheritance diagram for DSN::SPECCTRA_DB:

Public Member Functions

 SPECCTRA_DB ()
 
virtual ~SPECCTRA_DB ()
 
void SetPCB (PCB *aPcb)
 Delete any existing PCB and replaces it with the given one.
 
PCBGetPCB ()
 
void SetSESSION (SESSION *aSession)
 Delete any existing SESSION and replaces it with the given one.
 
SESSIONGetSESSION ()
 
void LoadPCB (const wxString &aFilename)
 A recursive descent parser for a SPECCTRA DSN "design" file.
 
void LoadSESSION (const wxString &aFilename)
 A recursive descent parser for a SPECCTRA DSN "session" file.
 
void ExportPCB (const wxString &aFilename, bool aNameChange=false)
 Write the internal PCB instance out as a SPECTRA DSN format file.
 
void FromBOARD (BOARD *aBoard)
 Add the entire BOARD to the PCB but does not write it out.
 
void FromSESSION (BOARD *aBoard)
 Add the entire #SESSION info to a BOARD but does not write it out.
 
void ExportSESSION (const wxString &aFilename)
 Write the internal #SESSION instance out as a #SPECTRA DSN format file.
 
bool BuiltBoardOutlines (BOARD *aBoard)
 Build the board outlines and store it in m_brd_outlines.
 
void FlipFOOTPRINTs (BOARD *aBoard)
 Flip the footprints which are on the back side of the board to the front.
 
void RevertFOOTPRINTs (BOARD *aBoard)
 Flip the footprints which were on the back side of the board back to the back.
 

Static Public Member Functions

static PCBMakePCB ()
 Make a PCB with all the default ELEMs and parts on the heap.
 

Private Member Functions

void buildLayerMaps (BOARD *aBoard)
 Create a few data translation structures for layer name and number mapping between the DSN::PCB structure and the KiCad BOARD structure.
 
int findLayerName (const std::string &aLayerName) const
 Return the PCB layer index for a given layer name, within the specctra sessionfile.
 
void readCOMPnPIN (std::string *component_id, std::string *pid_id)
 Read a <pin_reference> and splits it into the two parts which are on either side of the hyphen.
 
void readTIME (time_t *time_stamp)
 Read a <time_stamp> which consists of 8 lexer tokens: "month date hour : minute : second year".
 
void doPCB (PCB *growth)
 
void doPARSER (PARSER *growth)
 
void doRESOLUTION (UNIT_RES *growth)
 
void doUNIT (UNIT_RES *growth)
 
void doSTRUCTURE (STRUCTURE *growth)
 
void doSTRUCTURE_OUT (STRUCTURE_OUT *growth)
 
void doLAYER_NOISE_WEIGHT (LAYER_NOISE_WEIGHT *growth)
 
void doSPECCTRA_LAYER_PAIR (SPECCTRA_LAYER_PAIR *growth)
 
void doBOUNDARY (BOUNDARY *growth)
 
void doRECTANGLE (RECTANGLE *growth)
 
void doPATH (PATH *growth)
 
void doSTRINGPROP (STRINGPROP *growth)
 
void doTOKPROP (TOKPROP *growth)
 
void doVIA (VIA *growth)
 
void doCONTROL (CONTROL *growth)
 
void doLAYER (LAYER *growth)
 
void doRULE (RULE *growth)
 
void doKEEPOUT (KEEPOUT *growth)
 
void doCIRCLE (CIRCLE *growth)
 
void doQARC (QARC *growth)
 
void doWINDOW (WINDOW *growth)
 
void doCONNECT (CONNECT *growth)
 
void doREGION (REGION *growth)
 
void doCLASS_CLASS (CLASS_CLASS *growth)
 
void doLAYER_RULE (LAYER_RULE *growth)
 
void doCLASSES (CLASSES *growth)
 
void doGRID (GRID *growth)
 
void doPLACE (PLACE *growth)
 
void doCOMPONENT (COMPONENT *growth)
 
void doPLACEMENT (PLACEMENT *growth)
 
void doPROPERTIES (PROPERTIES *growth)
 
void doPADSTACK (PADSTACK *growth)
 
void doSHAPE (SHAPE *growth)
 
void doIMAGE (IMAGE *growth)
 
void doLIBRARY (LIBRARY *growth)
 
void doPIN (PIN *growth)
 
void doNET (NET *growth)
 
void doNETWORK (NETWORK *growth)
 
void doCLASS (CLASS *growth)
 
void doTOPOLOGY (TOPOLOGY *growth)
 
void doFROMTO (FROMTO *growth)
 
void doCOMP_ORDER (COMP_ORDER *growth)
 
void doWIRE (WIRE *growth)
 
void doWIRE_VIA (WIRE_VIA *growth)
 
void doWIRING (WIRING *growth)
 
void doSESSION (SESSION *growth)
 
void doANCESTOR (ANCESTOR *growth)
 
void doHISTORY (HISTORY *growth)
 
void doROUTE (ROUTE *growth)
 
void doWAS_IS (WAS_IS *growth)
 
void doNET_OUT (NET_OUT *growth)
 
void doSUPPLY_PIN (SUPPLY_PIN *growth)
 
void fillBOUNDARY (BOARD *aBoard, BOUNDARY *aBoundary)
 Make the board perimeter for the DSN file by filling the BOUNDARY element in the specctra element tree.
 
IMAGEmakeIMAGE (BOARD *aBoard, FOOTPRINT *aFootprint)
 Allocates an I::MAGE on the heap and creates all the PINs according to the PADs in the FOOTPRINT.
 
PADSTACKmakePADSTACK (BOARD *aBoard, PAD *aPad)
 Create a PADSTACK which matches the given pad.
 
PADSTACKmakeVia (int aCopperDiameter, int aDrillDiameter, int aTopLayer, int aBotLayer)
 Make a round through hole PADSTACK using the given KiCad diameter in deci-mils.
 
PADSTACKmakeVia (const ::PCB_VIA *aVia)
 Make any kind of PADSTACK using the given KiCad VIA.
 
void deleteNETs ()
 Delete all the NETs that may be in here.
 
void exportNETCLASS (const std::shared_ptr< NETCLASS > &aNetClass, BOARD *aBoard)
 Export aNetClass to the DSN file.
 
PCB_TRACKmakeTRACK (WIRE *wire, PATH *aPath, int aPointIndex, int aNetcode)
 Create a TRACK form the #PATH and BOARD info.
 
PCB_VIAmakeVIA (WIRE_VIA *aVia, PADSTACK *aPadstack, const POINT &aPoint, int aNetCode, int aViaDrillDefault)
 Instantiate a KiCad VIA on the heap and initializes it with internal values consistent with the given PADSTACK, #POINT, and netcode.
 

Private Attributes

PCBm_pcb
 
SHAPE_POLY_SET m_brd_outlines
 
SESSIONm_session
 
wxString m_filename
 
std::string m_quote_char
 
bool m_footprintsAreFlipped
 
STRING_FORMATTER m_sf
 
STRINGS m_layerIds
 indexed by PCB layer number
 
std::vector< int > m_kicadLayer2pcb
 maps BOARD layer number to PCB layer numbers
 
std::vector< PCB_LAYER_IDm_pcbLayer2kicad
 maps PCB layer number to BOARD layer numbers
 
UNIT_RESm_routeResolution
 used during FromSESSION() only, memory for it is not owned here.
 
BOARDm_sessionBoard
 a copy to avoid passing as an argument, memory for it is not owned here.
 
PADSTACKSET m_padstackset
 
std::vector< NET * > m_nets
 we don't want ownership here permanently, so we don't use boost::ptr_vector
 
int m_top_via_layer
 specctra cu layers, 0 based index:
 
int m_bot_via_layer
 

Static Private Attributes

static const KEYWORD keywords []
 specctra DSN keywords
 
static const KICAD_T scanPADs []
 

Detailed Description

A DSN data tree, usually coming from a DSN file.

Is essentially a SPECCTRA_PARSER class.

Definition at line 3640 of file specctra.h.

Constructor & Destructor Documentation

◆ SPECCTRA_DB()

DSN::SPECCTRA_DB::SPECCTRA_DB ( )
inline

◆ ~SPECCTRA_DB()

virtual DSN::SPECCTRA_DB::~SPECCTRA_DB ( )
inlinevirtual

Definition at line 3665 of file specctra.h.

References deleteNETs(), m_pcb, and m_session.

Member Function Documentation

◆ buildLayerMaps()

void DSN::SPECCTRA_DB::buildLayerMaps ( BOARD aBoard)
private

Create a few data translation structures for layer name and number mapping between the DSN::PCB structure and the KiCad BOARD structure.

Parameters
aBoardThe BOARD to create the maps for.

Definition at line 76 of file specctra.cpp.

References B_Cu, F_Cu, FIRST_LAYER, BOARD::GetCopperLayerCount(), BOARD::GetLayerName(), m_kicadLayer2pcb, m_layerIds, m_pcbLayer2kicad, TO_UTF8, and ToLAYER_ID().

Referenced by FromBOARD(), and FromSESSION().

◆ BuiltBoardOutlines()

bool DSN::SPECCTRA_DB::BuiltBoardOutlines ( BOARD aBoard)

Build the board outlines and store it in m_brd_outlines.

Because it calls GetBoardPolygonOutlines() it must be called before flipping footprints

Returns
false if the board outlines cannot be built (not closed outlines)

Definition at line 234 of file specctra_export.cpp.

References BOARD::GetBoardPolygonOutlines(), and m_brd_outlines.

Referenced by DSN::ExportBoardToSpecctraFile().

◆ deleteNETs()

void DSN::SPECCTRA_DB::deleteNETs ( )
inlineprivate

Delete all the NETs that may be in here.

Definition at line 3938 of file specctra.h.

References m_nets.

Referenced by FromBOARD(), and ~SPECCTRA_DB().

◆ doANCESTOR()

void DSN::SPECCTRA_DB::doANCESTOR ( ANCESTOR growth)
private

◆ doBOUNDARY()

void DSN::SPECCTRA_DB::doBOUNDARY ( BOUNDARY growth)
private

Definition at line 1037 of file specctra.cpp.

References doPATH(), doRECTANGLE(), path, DSN::BOUNDARY::paths, RECTANGLE, and DSN::BOUNDARY::rectangle.

Referenced by doSTRUCTURE().

◆ doCIRCLE()

void DSN::SPECCTRA_DB::doCIRCLE ( CIRCLE growth)
private

◆ doCLASS()

◆ doCLASS_CLASS()

void DSN::SPECCTRA_DB::doCLASS_CLASS ( CLASS_CLASS growth)
private

◆ doCLASSES()

void DSN::SPECCTRA_DB::doCLASSES ( CLASSES growth)
private

Definition at line 1751 of file specctra.cpp.

References DSN::CLASSES::class_ids.

Referenced by doCLASS_CLASS().

◆ doCOMP_ORDER()

void DSN::SPECCTRA_DB::doCOMP_ORDER ( COMP_ORDER growth)
private

Definition at line 2857 of file specctra.cpp.

References DSN::COMP_ORDER::m_placement_ids.

Referenced by doNET(), and doTOPOLOGY().

◆ doCOMPONENT()

void DSN::SPECCTRA_DB::doCOMPONENT ( COMPONENT growth)
private

Definition at line 2012 of file specctra.cpp.

References doPLACE(), DSN::COMPONENT::m_image_id, DSN::COMPONENT::m_places, and PLACE.

Referenced by doPLACEMENT().

◆ doCONNECT()

void DSN::SPECCTRA_DB::doCONNECT ( CONNECT growth)
private

Definition at line 943 of file specctra.cpp.

Referenced by doWIRE().

◆ doCONTROL()

void DSN::SPECCTRA_DB::doCONTROL ( CONTROL growth)
private

Definition at line 1277 of file specctra.cpp.

References DSN::ELEM_HOLDER::Append(), doTOKPROP(), and DSN::CONTROL::via_at_smd.

Referenced by doSTRUCTURE().

◆ doFROMTO()

void DSN::SPECCTRA_DB::doFROMTO ( FROMTO growth)
private

◆ doGRID()

void DSN::SPECCTRA_DB::doGRID ( GRID growth)
private

◆ doHISTORY()

void DSN::SPECCTRA_DB::doHISTORY ( HISTORY growth)
private

◆ doIMAGE()

◆ doKEEPOUT()

◆ doLAYER()

◆ doLAYER_NOISE_WEIGHT()

void DSN::SPECCTRA_DB::doLAYER_NOISE_WEIGHT ( LAYER_NOISE_WEIGHT growth)
private

Definition at line 634 of file specctra.cpp.

References doSPECCTRA_LAYER_PAIR(), and DSN::LAYER_NOISE_WEIGHT::layer_pairs.

Referenced by doSTRUCTURE().

◆ doLAYER_RULE()

void DSN::SPECCTRA_DB::doLAYER_RULE ( LAYER_RULE growth)
private

Definition at line 1852 of file specctra.cpp.

References doRULE(), DSN::LAYER_RULE::m_layer_ids, DSN::LAYER_RULE::m_rule, and RULE.

Referenced by doCLASS(), doCLASS_CLASS(), doFROMTO(), and doNET().

◆ doLIBRARY()

void DSN::SPECCTRA_DB::doLIBRARY ( LIBRARY growth)
private

◆ doNET()

◆ doNET_OUT()

void DSN::SPECCTRA_DB::doNET_OUT ( NET_OUT growth)
private

◆ doNETWORK()

void DSN::SPECCTRA_DB::doNETWORK ( NETWORK growth)
private

Definition at line 2811 of file specctra.cpp.

References CLASS, doCLASS(), doNET(), DSN::NETWORK::m_classes, DSN::NETWORK::m_nets, and NET.

Referenced by doPCB().

◆ doPADSTACK()

◆ doPARSER()

◆ doPATH()

void DSN::SPECCTRA_DB::doPATH ( PATH growth)
private

◆ doPCB()

◆ doPIN()

void DSN::SPECCTRA_DB::doPIN ( PIN growth)
private

◆ doPLACE()

◆ doPLACEMENT()

void DSN::SPECCTRA_DB::doPLACEMENT ( PLACEMENT growth)
private

◆ doPROPERTIES()

void DSN::SPECCTRA_DB::doPROPERTIES ( PROPERTIES growth)
private

Definition at line 1327 of file specctra.cpp.

Referenced by doLAYER(), and doPLACE().

◆ doQARC()

void DSN::SPECCTRA_DB::doQARC ( QARC growth)
private

◆ doRECTANGLE()

void DSN::SPECCTRA_DB::doRECTANGLE ( RECTANGLE growth)
private

◆ doREGION()

◆ doRESOLUTION()

void DSN::SPECCTRA_DB::doRESOLUTION ( UNIT_RES growth)
private

Definition at line 568 of file specctra.cpp.

References DSN::UNIT_RES::units, and DSN::UNIT_RES::value.

Referenced by doPCB(), doPLACEMENT(), doROUTE(), doSTRUCTURE(), and doWIRING().

◆ doROUTE()

void DSN::SPECCTRA_DB::doROUTE ( ROUTE growth)
private

◆ doRULE()

void DSN::SPECCTRA_DB::doRULE ( RULE growth)
private

◆ doSESSION()

◆ doSHAPE()

void DSN::SPECCTRA_DB::doSHAPE ( SHAPE growth)
private

◆ doSPECCTRA_LAYER_PAIR()

void DSN::SPECCTRA_DB::doSPECCTRA_LAYER_PAIR ( SPECCTRA_LAYER_PAIR growth)
private

◆ doSTRINGPROP()

void DSN::SPECCTRA_DB::doSTRINGPROP ( STRINGPROP growth)
private

Definition at line 1225 of file specctra.cpp.

References DSN::STRINGPROP::value.

Referenced by doREGION(), and doSTRUCTURE().

◆ doSTRUCTURE()

◆ doSTRUCTURE_OUT()

void DSN::SPECCTRA_DB::doSTRUCTURE_OUT ( STRUCTURE_OUT growth)
private

Definition at line 799 of file specctra.cpp.

References doLAYER(), doRULE(), DSN::STRUCTURE_OUT::m_layers, DSN::STRUCTURE_OUT::m_rules, and RULE.

Referenced by doROUTE().

◆ doSUPPLY_PIN()

void DSN::SPECCTRA_DB::doSUPPLY_PIN ( SUPPLY_PIN growth)
private

◆ doTOKPROP()

void DSN::SPECCTRA_DB::doTOKPROP ( TOKPROP growth)
private

Definition at line 1233 of file specctra.cpp.

References DSN::TOKPROP::value.

Referenced by doCONTROL().

◆ doTOPOLOGY()

void DSN::SPECCTRA_DB::doTOPOLOGY ( TOPOLOGY growth)
private

Definition at line 2659 of file specctra.cpp.

References doCOMP_ORDER(), doFROMTO(), DSN::TOPOLOGY::m_comp_orders, and DSN::TOPOLOGY::m_fromtos.

Referenced by doCLASS().

◆ doUNIT()

void DSN::SPECCTRA_DB::doUNIT ( UNIT_RES growth)
private

Definition at line 596 of file specctra.cpp.

References DSN::UNIT_RES::units.

Referenced by doIMAGE(), doLIBRARY(), doPADSTACK(), doPCB(), doPLACEMENT(), doSTRUCTURE(), and doWIRING().

◆ doVIA()

void DSN::SPECCTRA_DB::doVIA ( VIA growth)
private

Definition at line 1246 of file specctra.cpp.

References DSN::VIA::m_padstacks, and DSN::VIA::m_spares.

Referenced by doSTRUCTURE().

◆ doWAS_IS()

void DSN::SPECCTRA_DB::doWAS_IS ( WAS_IS growth)
private

◆ doWINDOW()

void DSN::SPECCTRA_DB::doWINDOW ( WINDOW growth)
private

Definition at line 978 of file specctra.cpp.

References doCIRCLE(), doPATH(), doQARC(), doRECTANGLE(), KI_FALLTHROUGH, RECTANGLE, and DSN::WINDOW::shape.

Referenced by doKEEPOUT(), doSHAPE(), and doWIRE().

◆ doWIRE()

◆ doWIRE_VIA()

◆ doWIRING()

void DSN::SPECCTRA_DB::doWIRING ( WIRING growth)
private

◆ exportNETCLASS()

void DSN::SPECCTRA_DB::exportNETCLASS ( const std::shared_ptr< NETCLASS > &  aNetClass,
BOARD aBoard 
)
private

◆ ExportPCB()

void DSN::SPECCTRA_DB::ExportPCB ( const wxString &  aFilename,
bool  aNameChange = false 
)

Write the internal PCB instance out as a SPECTRA DSN format file.

Parameters
aFilenameThe file to save to.
aNameChangeIf true, causes the pcb's name to change to "aFilename" and also to to be changed in the output file.
Exceptions
IO_ERROR,ifan i/o error occurs saving the file.

Definition at line 3696 of file specctra.cpp.

References DSN::PCB::Format(), m_pcb, DSN::PCB::m_pcbname, m_quote_char, and TO_UTF8.

Referenced by DSN::ExportBoardToSpecctraFile().

◆ ExportSESSION()

void DSN::SPECCTRA_DB::ExportSESSION ( const wxString &  aFilename)

Write the internal #SESSION instance out as a #SPECTRA DSN format file.

Parameters
aFilenameThe file to save to.

Definition at line 3710 of file specctra.cpp.

References DSN::SESSION::Format(), m_quote_char, and m_session.

◆ fillBOUNDARY()

void DSN::SPECCTRA_DB::fillBOUNDARY ( BOARD aBoard,
BOUNDARY aBoundary 
)
private

Make the board perimeter for the DSN file by filling the BOUNDARY element in the specctra element tree.

Parameters
aBoardThe BOARD to get information from in order to make the BOUNDARY.
aBoundaryThe empty BOUNDARY to fill in.

Definition at line 1037 of file specctra_export.cpp.

References DSN::PATH::AppendPoint(), SHAPE_LINE_CHAIN::CPoint(), SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::HoleCount(), m_brd_outlines, DSN::STRUCTURE::m_keepouts, m_pcb, DSN::PCB::m_structure, DSN::mapPt(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), path, DSN::BOUNDARY::paths, SHAPE_LINE_CHAIN::PointCount(), DSN::PATH::SetLayerId(), DSN::KEEPOUT::SetShape(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by FromBOARD().

◆ findLayerName()

int DSN::SPECCTRA_DB::findLayerName ( const std::string &  aLayerName) const
private

Return the PCB layer index for a given layer name, within the specctra sessionfile.

Returns
the layer index within the specctra session file, or -1 if aLayerName is not found.

Definition at line 125 of file specctra.cpp.

References m_layerIds.

Referenced by makeTRACK(), and makeVIA().

◆ FlipFOOTPRINTs()

void DSN::SPECCTRA_DB::FlipFOOTPRINTs ( BOARD aBoard)

Flip the footprints which are on the back side of the board to the front.

Definition at line 1806 of file specctra_export.cpp.

References B_Cu, BOARD::Footprints(), and m_footprintsAreFlipped.

Referenced by DSN::ExportBoardToSpecctraFile().

◆ FromBOARD()

void DSN::SPECCTRA_DB::FromBOARD ( BOARD aBoard)

Add the entire BOARD to the PCB but does not write it out.

Note
The BOARD given to this function must have all the FOOTPRINTs on the component side of the BOARD.
See also
PCB_EDIT_FRAME::ExportToSpecctra() for an example before calling this function.
Parameters
aBoardThe BOARD to convert to a PCB.

Definition at line 1088 of file specctra_export.cpp.

References _, DSN::LIBRARY::AddPadstack(), DSN::KEEPOUT::AddWindow(), ANGLE_180, DSN::PATH::AppendPoint(), DSN::VIA::AppendVia(), DSN::LIBRARY::AppendVia(), EDA_ANGLE::AsDegrees(), B_Cu, NETINFO_LIST::begin(), buildLayerMaps(), DSN::PIN_REF::component_id, deleteNETs(), empty(), NETINFO_LIST::end(), exportNETCLASS(), fillBOUNDARY(), BOARD::FindNet(), BOARD::Footprints(), BOARD::GetCopperLayerCount(), BOARD::GetDesignSettings(), BOARD::GetLayerType(), BOARD::GetNetInfo(), NETINFO_ITEM::GetNetname(), image, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::IsEndContour(), DSN::PATH::layer_id, DSN::LAYER::layer_type, DSN::PLACEMENT::LookupCOMPONENT(), DSN::LIBRARY::LookupIMAGE(), DSN::LIBRARY::LookupVia(), LT_JUMPER, LT_MIXED, LT_POWER, LT_SIGNAL, m_bot_via_layer, DSN::PLACE::m_component_id, DSN::STRUCTURE::m_keepouts, m_kicadLayer2pcb, m_layerIds, DSN::STRUCTURE::m_layers, DSN::PCB::m_library, DSN::KEEPOUT::m_name, DSN::NET::m_net_id, DSN::WIRE::m_net_id, DSN::WIRE_VIA::m_net_id, DSN::NETWORK::m_nets, m_nets, BOARD_DESIGN_SETTINGS::m_NetSettings, DSN::PCB::m_network, DSN::WIRE_VIA::m_padstack_id, m_padstackset, DSN::PCB::m_parser, DSN::PLACE::m_part_number, m_pcb, m_pcbLayer2kicad, DSN::NET::m_pins, DSN::PCB::m_placement, DSN::COMPONENT::m_places, DSN::STRUCTURE::m_planes, DSN::PCB::m_resolution, DSN::RULE::m_rules, DSN::STRUCTURE::m_rules, DSN::PLACE::m_side, DSN::PCB::m_structure, m_top_via_layer, DSN::PCB::m_unit, DSN::WIRE_VIA::m_vertexes, DSN::STRUCTURE::m_via, DSN::WIRE_VIA::m_via_type, DSN::LIBRARY::m_vias, DSN::WIRE::m_wire_type, DSN::PCB::m_wiring, makeIMAGE(), MakePCB(), makeVia(), DSN::mapPt(), name, DSN::LAYER::name, EDA_ANGLE::Normalize(), path, PCB_VIA_T, pin, DSN::PIN_REF::pin_id, DSN::LAYER::properties, registered, scale, DSN::STRUCTURE::SetBOUNDARY(), DSN::PLACE::SetRotation(), DSN::WINDOW::SetShape(), DSN::KEEPOUT::SetShape(), DSN::WIRE::SetShape(), DSN::PLACE::SetVertex(), DSN::PARSER::space_in_quoted_tokens, THROW_IO_ERROR, TO_UTF8, BOARD::Tracks(), UNDEFINED_LAYER, DSN::UNIT_RES::units, DSN::UNIT_RES::value, via, DSN::WIRING::wire_vias, DSN::WIRING::wires, and BOARD::Zones().

Referenced by DSN::ExportBoardToSpecctraFile().

◆ FromSESSION()

◆ GetPCB()

PCB * DSN::SPECCTRA_DB::GetPCB ( )
inline

Definition at line 3687 of file specctra.h.

References m_pcb.

Referenced by main().

◆ GetSESSION()

SESSION * DSN::SPECCTRA_DB::GetSESSION ( )
inline

Definition at line 3698 of file specctra.h.

References m_session.

Referenced by main().

◆ LoadPCB()

void DSN::SPECCTRA_DB::LoadPCB ( const wxString &  aFilename)

A recursive descent parser for a SPECCTRA DSN "design" file.

A design file is nearly a full description of a PCB (seems to be missing only the silkscreen stuff).

Parameters
aFilenameThe name of the dsn file to load.
Exceptions
IO_ERRORif there is a lexer or parser error.

Definition at line 259 of file specctra.cpp.

References doPCB(), m_pcb, and SetPCB().

◆ LoadSESSION()

void DSN::SPECCTRA_DB::LoadSESSION ( const wxString &  aFilename)

A recursive descent parser for a SPECCTRA DSN "session" file.

A session file is a file that is fed back from the router to the layout tool (Pcbnew) and should be used to update a BOARD object with the new tracks, vias, and component locations.

Parameters
aFilenameThe name of the dsn file to load.
Exceptions
IO_ERRORif there is a lexer or parser error.

Definition at line 278 of file specctra.cpp.

References doSESSION(), m_session, and SetSESSION().

Referenced by DSN::ImportSpecctraSession(), and main().

◆ makeIMAGE()

IMAGE * DSN::SPECCTRA_DB::makeIMAGE ( BOARD aBoard,
FOOTPRINT aFootprint 
)
private

Allocates an I::MAGE on the heap and creates all the PINs according to the PADs in the FOOTPRINT.

Parameters
aBoardThe owner of the FOOTPRINT.
aFootprintThe FOOTPRINT from which to build the IMAGE.
Returns
not tested for duplication yet.

Definition at line 604 of file specctra_export.cpp.

References SHAPE_POLY_SET::AddOutline(), DSN::KEEPOUT::AddWindow(), LSET::AllCuMask(), ANGLE_0, ANGLE_360, SHAPE_POLY_SET::Append(), DSN::PATH::AppendPoint(), ARC_HIGH_DEF, EDA_ANGLE::AsDegrees(), B_Cu, UTF8::c_str(), SHAPE_LINE_CHAIN::Clear(), PCB_TYPE_COLLECTOR::Collect(), ConvertArcToPolyline(), SHAPE_LINE_CHAIN::CPoint(), ERROR_INSIDE, LIB_ID::Format(), EDA_SHAPE::GetArcAngle(), PCB_SHAPE::GetCenter(), BOARD::GetCopperLayerCount(), COLLECTOR::GetCount(), BOARD::GetDesignSettings(), EDA_SHAPE::GetEnd(), FOOTPRINT::GetFPID(), FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), EDA_SHAPE::GetRadius(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), PCB_SHAPE::GetWidth(), image, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::IsEndContour(), DSN::isRoundKeepout(), ZONE::IterateWithHoles(), DSN::PATH::layer_id, BOARD_DESIGN_SETTINGS::m_HoleClearance, m_kicadLayer2pcb, m_layerIds, DSN::PADSTACK::m_padstack_id, m_padstackset, m_pcb, DSN::PCB::m_structure, makePADSTACK(), DSN::mapPt(), move, EDA_ANGLE::Normalize(), SHAPE_POLY_SET::Outline(), pad, path, PCB_PAD_T, PCB_SHAPE_T, pin, SHAPE_POLY_SET::PM_FAST, SHAPE_LINE_CHAIN::PointCount(), ZONE::Rotate(), scale, DSN::CIRCLE::SetDiameter(), DSN::CIRCLE::SetLayerId(), DSN::WINDOW::SetShape(), DSN::KEEPOUT::SetShape(), DSN::CIRCLE::SetVertex(), SHAPE_POLY_SET::Simplify(), TO_UTF8, TransformCircleToPolygon(), VECTOR2< T >::x, VECTOR2< T >::y, and FOOTPRINT::Zones().

Referenced by FromBOARD().

◆ makePADSTACK()

PADSTACK * DSN::SPECCTRA_DB::makePADSTACK ( BOARD aBoard,
PAD aPad 
)
private

Create a PADSTACK which matches the given pad.

Note
Only pads which do not satisfy the function isKeepout() should be passed to this function.
Parameters
aBoardThe owner of the PAD's footprint.
aPadThe PAD which needs to be made into a PADSTACK.
Returns
The created padstack, including its m_padstack_id.

Definition at line 240 of file specctra_export.cpp.

References std::abs(), PADSTACK::ALL_LAYERS, LSET::AllCuMask(), ANGLE_0, DSN::ELEM_HOLDER::Append(), DSN::PATH::AppendPoint(), BuildConvexHull(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), delta, ERROR_INSIDE, PAD::GetBoundingBox(), PAD::GetChamferPositions(), PAD::GetChamferRectRatio(), BOARD::GetCopperLayerCount(), PAD::GetDelta(), BOARD::GetDesignSettings(), SHAPE_POLY_SET::GetHash(), BOX2< Vec >::GetHeight(), PAD::GetLayerSet(), PAD::GetOffset(), PAD::GetRoundRectCornerRadius(), PAD::GetShape(), PAD::GetSize(), BOX2< Vec >::GetWidth(), PAD::IsOnLayer(), DSN::isRoundKeepout(), DSN::IU2um(), KiROUND(), m_layerIds, BOARD_DESIGN_SETTINGS::m_MaxError, m_pcbLayer2kicad, DSN::makePath(), DSN::mapPt(), PAD::MergePrimitivesAsPolygon(), SHAPE_POLY_SET::Outline(), path, SHAPE_LINE_CHAIN::PointCount(), scale, DSN::RECTANGLE::SetCorners(), DSN::CIRCLE::SetDiameter(), DSN::PATH::SetLayerId(), DSN::CIRCLE::SetLayerId(), DSN::RECTANGLE::SetLayerId(), DSN::PADSTACK::SetPadstackId(), DSN::WINDOW::SetShape(), DSN::CIRCLE::SetVertex(), HASH_128::ToString(), TransformRoundChamferedRectToPolygon(), VECTOR2< T >::x, DSN::POINT::x, VECTOR2< T >::y, and DSN::POINT::y.

Referenced by makeIMAGE().

◆ MakePCB()

◆ makeTRACK()

◆ makeVia() [1/2]

PADSTACK * DSN::SPECCTRA_DB::makeVia ( const ::PCB_VIA aVia)
private

Make any kind of PADSTACK using the given KiCad VIA.

Parameters
aViaThe VIA to build the padstack from.
Returns
The padstack, which is on the heap only, user must save or delete it.

◆ makeVia() [2/2]

PADSTACK * DSN::SPECCTRA_DB::makeVia ( int  aCopperDiameter,
int  aDrillDiameter,
int  aTopLayer,
int  aBotLayer 
)
private

Make a round through hole PADSTACK using the given KiCad diameter in deci-mils.

Parameters
aCopperDiameterThe diameter of the copper pad.
aDrillDiameterThe drill diameter, used on re-import of the session file.
aTopLayerThe DSN::PCB top most layer index.
aBotLayerThe DSN::PCB bottom most layer index.
Returns
The padstack, which is on the heap only, user must save or delete it.

Definition at line 985 of file specctra_export.cpp.

References DSN::ELEM_HOLDER::Append(), DSN::IU2um(), m_layerIds, name, scale, DSN::CIRCLE::SetDiameter(), DSN::CIRCLE::SetLayerId(), DSN::PADSTACK::SetPadstackId(), and DSN::WINDOW::SetShape().

Referenced by exportNETCLASS(), and FromBOARD().

◆ makeVIA()

PCB_VIA * DSN::SPECCTRA_DB::makeVIA ( WIRE_VIA aVia,
PADSTACK aPadstack,
const POINT aPoint,
int  aNetCode,
int  aViaDrillDefault 
)
private

◆ readCOMPnPIN()

void DSN::SPECCTRA_DB::readCOMPnPIN ( std::string *  component_id,
std::string *  pid_id 
)
private

Read a <pin_reference> and splits it into the two parts which are on either side of the hyphen.

This function is specialized because pin_reference may or may not be using double quotes. Both of these are legal: U2-14 or "U2"-"14". The lexer treats the first one as a single T_SYMBOL, so in that case we have to split it into two here.

The caller should have already read in the first token comprising the pin_reference and it will be tested through CurTok().

Parameters
component_idWhere to put the text preceding the '-' hyphen.
pid_idWhere to put the text which trails the '-'.
Exceptions
IO_ERROR,ifthe next token or two do no make up a pin_reference, or there is an error reading from the input stream.

Definition at line 137 of file specctra.cpp.

Referenced by doNET(), doSUPPLY_PIN(), and doWAS_IS().

◆ readTIME()

void DSN::SPECCTRA_DB::readTIME ( time_t *  time_stamp)
private

Read a <time_stamp> which consists of 8 lexer tokens: "month date hour : minute : second year".

This function is specialized because time_stamps occur more than once in a session file. The caller should not have already read in the first token comprising the time stamp.

Parameters
time_stampWhere to put the parsed time value.
Exceptions
IO_ERROR,ifthe next token or 8 do no make up a time stamp, or there is an error reading from the input stream.

Definition at line 179 of file specctra.cpp.

Referenced by doANCESTOR(), and doHISTORY().

◆ RevertFOOTPRINTs()

void DSN::SPECCTRA_DB::RevertFOOTPRINTs ( BOARD aBoard)

Flip the footprints which were on the back side of the board back to the back.

Definition at line 1826 of file specctra_export.cpp.

References BOARD::Footprints(), and m_footprintsAreFlipped.

Referenced by DSN::ExportBoardToSpecctraFile().

◆ SetPCB()

void DSN::SPECCTRA_DB::SetPCB ( PCB aPcb)
inline

Delete any existing PCB and replaces it with the given one.

Definition at line 3681 of file specctra.h.

References m_pcb.

Referenced by DSN::ExportBoardToSpecctraFile(), and LoadPCB().

◆ SetSESSION()

void DSN::SPECCTRA_DB::SetSESSION ( SESSION aSession)
inline

Delete any existing SESSION and replaces it with the given one.

Definition at line 3692 of file specctra.h.

References m_session.

Referenced by LoadSESSION().

Member Data Documentation

◆ keywords

const KEYWORD DSN::SPECCTRA_DB::keywords[]
staticprivate

specctra DSN keywords

Definition at line 3970 of file specctra.h.

◆ m_bot_via_layer

int DSN::SPECCTRA_DB::m_bot_via_layer
private

Definition at line 4002 of file specctra.h.

Referenced by exportNETCLASS(), FromBOARD(), and SPECCTRA_DB().

◆ m_brd_outlines

SHAPE_POLY_SET DSN::SPECCTRA_DB::m_brd_outlines
private

Definition at line 3973 of file specctra.h.

Referenced by BuiltBoardOutlines(), and fillBOUNDARY().

◆ m_filename

wxString DSN::SPECCTRA_DB::m_filename
private

Definition at line 3975 of file specctra.h.

◆ m_footprintsAreFlipped

bool DSN::SPECCTRA_DB::m_footprintsAreFlipped
private

Definition at line 3978 of file specctra.h.

Referenced by FlipFOOTPRINTs(), RevertFOOTPRINTs(), and SPECCTRA_DB().

◆ m_kicadLayer2pcb

std::vector<int> DSN::SPECCTRA_DB::m_kicadLayer2pcb
private

maps BOARD layer number to PCB layer numbers

Definition at line 3984 of file specctra.h.

Referenced by buildLayerMaps(), FromBOARD(), and makeIMAGE().

◆ m_layerIds

STRINGS DSN::SPECCTRA_DB::m_layerIds
private

indexed by PCB layer number

Definition at line 3982 of file specctra.h.

Referenced by buildLayerMaps(), findLayerName(), FromBOARD(), makeIMAGE(), makePADSTACK(), and makeVia().

◆ m_nets

std::vector<NET*> DSN::SPECCTRA_DB::m_nets
private

we don't want ownership here permanently, so we don't use boost::ptr_vector

Definition at line 3998 of file specctra.h.

Referenced by deleteNETs(), and FromBOARD().

◆ m_padstackset

PADSTACKSET DSN::SPECCTRA_DB::m_padstackset
private

Definition at line 3995 of file specctra.h.

Referenced by FromBOARD(), and makeIMAGE().

◆ m_pcb

PCB* DSN::SPECCTRA_DB::m_pcb
private

◆ m_pcbLayer2kicad

std::vector<PCB_LAYER_ID> DSN::SPECCTRA_DB::m_pcbLayer2kicad
private

maps PCB layer number to BOARD layer numbers

Definition at line 3985 of file specctra.h.

Referenced by buildLayerMaps(), FromBOARD(), makePADSTACK(), makeTRACK(), and makeVIA().

◆ m_quote_char

std::string DSN::SPECCTRA_DB::m_quote_char
private

Definition at line 3976 of file specctra.h.

Referenced by doCLASS(), doPARSER(), doRULE(), ExportPCB(), ExportSESSION(), and SPECCTRA_DB().

◆ m_routeResolution

UNIT_RES* DSN::SPECCTRA_DB::m_routeResolution
private

used during FromSESSION() only, memory for it is not owned here.

Definition at line 3988 of file specctra.h.

Referenced by FromSESSION(), makeTRACK(), makeVIA(), and SPECCTRA_DB().

◆ m_session

SESSION* DSN::SPECCTRA_DB::m_session
private

◆ m_sessionBoard

BOARD* DSN::SPECCTRA_DB::m_sessionBoard
private

a copy to avoid passing as an argument, memory for it is not owned here.

Definition at line 3991 of file specctra.h.

Referenced by FromSESSION(), makeTRACK(), makeVIA(), and SPECCTRA_DB().

◆ m_sf

STRING_FORMATTER DSN::SPECCTRA_DB::m_sf
private

Definition at line 3980 of file specctra.h.

◆ m_top_via_layer

int DSN::SPECCTRA_DB::m_top_via_layer
private

specctra cu layers, 0 based index:

Definition at line 4001 of file specctra.h.

Referenced by exportNETCLASS(), FromBOARD(), and SPECCTRA_DB().

◆ scanPADs

const KICAD_T DSN::SPECCTRA_DB::scanPADs[]
staticprivate

Definition at line 3993 of file specctra.h.


The documentation for this class was generated from the following files: