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 NETCLASS *aNetClass, const 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_ARCmakeARC (WIRE *wire, QARC *aQarc, int aNetcode)
 Create an ARC 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::map< PCB_LAYER_ID, int > m_kicadLayer2pcb
 maps BOARD layer number to PCB layer numbers
 
std::map< int, 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 3650 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 3675 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 77 of file specctra.cpp.

References LSET::AllCuMask(), LSET::CuStack(), BOARD::GetCopperLayerCount(), BOARD::GetLayerName(), m_kicadLayer2pcb, m_layerIds, m_pcbLayer2kicad, and TO_UTF8.

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 237 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 3948 of file specctra.h.

References m_nets.

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

◆ doANCESTOR()

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

Definition at line 3266 of file specctra.cpp.

References DSN::ANCESTOR::comment, DSN::ANCESTOR::filename, readTIME(), T, and DSN::ANCESTOR::time_stamp.

Referenced by doHISTORY().

◆ doBOUNDARY()

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

Definition at line 1029 of file specctra.cpp.

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

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 1743 of file specctra.cpp.

References DSN::CLASSES::class_ids, and T.

Referenced by doCLASS_CLASS().

◆ doCOMP_ORDER()

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

Definition at line 2849 of file specctra.cpp.

References DSN::COMP_ORDER::m_placement_ids, and T.

Referenced by doNET(), and doTOPOLOGY().

◆ doCOMPONENT()

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

Definition at line 2004 of file specctra.cpp.

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

Referenced by doPLACEMENT().

◆ doCONNECT()

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

Definition at line 935 of file specctra.cpp.

References T.

Referenced by doWIRE().

◆ doCONTROL()

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

Definition at line 1269 of file specctra.cpp.

References DSN::ELEM_HOLDER::Append(), doTOKPROP(), T, 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 626 of file specctra.cpp.

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

Referenced by doSTRUCTURE().

◆ doLAYER_RULE()

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

Definition at line 1844 of file specctra.cpp.

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

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 2803 of file specctra.cpp.

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

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 1319 of file specctra.cpp.

References T.

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 559 of file specctra.cpp.

References T, 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 1217 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 791 of file specctra.cpp.

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

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 1225 of file specctra.cpp.

References T, and DSN::TOKPROP::value.

Referenced by doCONTROL().

◆ doTOPOLOGY()

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

Definition at line 2651 of file specctra.cpp.

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

Referenced by doCLASS().

◆ doUNIT()

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

Definition at line 588 of file specctra.cpp.

References T, and 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 1238 of file specctra.cpp.

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

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 970 of file specctra.cpp.

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

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

◆ doWIRE()

◆ doWIRE_VIA()

◆ doWIRING()

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

◆ exportNETCLASS()

◆ 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 3705 of file specctra.cpp.

References m_pcb, 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 3719 of file specctra.cpp.

References 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 1034 of file specctra_export.cpp.

References DSN::PATH::AppendPoint(), SHAPE_LINE_CHAIN::CPoint(), m_brd_outlines, m_pcb, DSN::mapPt(), 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 100 of file specctra.cpp.

References m_layerIds.

Referenced by makeARC(), 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 1793 of file specctra_export.cpp.

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

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 1085 of file specctra_export.cpp.

References _, DSN::KEEPOUT::AddWindow(), LSET::AllCuMask(), ANGLE_180, DSN::PATH::AppendPoint(), DSN::VIA::AppendVia(), EDA_ANGLE::AsDegrees(), NETINFO_LIST::begin(), buildLayerMaps(), clearance, DSN::PIN_REF::component_id, NETCLASS::Default, deleteNETs(), empty(), NETINFO_LIST::end(), exportNETCLASS(), fillBOUNDARY(), BOARD::FindNet(), BOARD::Footprints(), BOARD::GetCopperLayerCount(), BOARD::GetDesignSettings(), BOARD::GetLayerType(), NETCLASS::GetName(), BOARD::GetNetInfo(), NETINFO_ITEM::GetNetname(), image, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::IsEndContour(), LAYER, DSN::PATH::layer_id, DSN::LAYER::layer_type, LT_JUMPER, LT_MIXED, LT_POWER, LT_SIGNAL, m_bot_via_layer, DSN::PLACE::m_component_id, m_kicadLayer2pcb, m_layerIds, DSN::KEEPOUT::m_name, DSN::NET::m_net_id, DSN::WIRE::m_net_id, DSN::WIRE_VIA::m_net_id, m_nets, BOARD_DESIGN_SETTINGS::m_NetSettings, DSN::WIRE_VIA::m_padstack_id, m_padstackset, DSN::PLACE::m_part_number, m_pcb, m_pcbLayer2kicad, DSN::NET::m_pins, DSN::COMPONENT::m_places, DSN::PLACE::m_side, m_top_via_layer, DSN::WIRE_VIA::m_vertexes, DSN::WIRE_VIA::m_via_type, DSN::WIRE::m_wire_type, makeIMAGE(), MakePCB(), makeVia(), DSN::mapPt(), DSN::LAYER::name, name, NET, EDA_ANGLE::Normalize(), path, PCB_VIA_T, pin, DSN::PIN_REF::pin_id, PLACE, DSN::LAYER::properties, registered, scale, DSN::PLACE::SetRotation(), DSN::KEEPOUT::SetShape(), DSN::WINDOW::SetShape(), DSN::WIRE::SetShape(), DSN::PLACE::SetVertex(), THROW_IO_ERROR, TO_UTF8, BOARD::Tracks(), UNDEFINED_LAYER, via, WIRE, DSN::WIRING::wires, VECTOR2< T >::x, VECTOR2< T >::y, and BOARD::Zones().

Referenced by DSN::ExportBoardToSpecctraFile().

◆ FromSESSION()

◆ GetPCB()

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

Definition at line 3697 of file specctra.h.

References m_pcb.

Referenced by main().

◆ GetSESSION()

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

Definition at line 3708 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 250 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 269 of file specctra.cpp.

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

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

◆ makeARC()

◆ 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 607 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, ARC_HIGH_DEF, EDA_ANGLE::AsDegrees(), UTF8::c_str(), CIRCLE, circle(), SHAPE_LINE_CHAIN::Clear(), PCB_TYPE_COLLECTOR::Collect(), ConvertArcToPolyline(), SHAPE_LINE_CHAIN::CPoint(), LSET::CuStack(), 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, 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, makePADSTACK(), DSN::mapPt(), move, EDA_ANGLE::Normalize(), SHAPE_POLY_SET::Outline(), pad, path, PCB_PAD_T, PCB_SHAPE_T, PIN, pin, SHAPE_LINE_CHAIN::PointCount(), radius, RECTANGLE, ZONE::Rotate(), scale, SEGMENT, DSN::KEEPOUT::SetShape(), DSN::WINDOW::SetShape(), 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 243 of file specctra_export.cpp.

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

Referenced by makeIMAGE().

◆ MakePCB()

◆ makeTRACK()

◆ makeVIA()

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

◆ 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 982 of file specctra_export.cpp.

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

Referenced by exportNETCLASS(), and FromBOARD().

◆ 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 112 of file specctra.cpp.

References T.

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 154 of file specctra.cpp.

References T.

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 1813 of file specctra_export.cpp.

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

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 3691 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 3702 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 3985 of file specctra.h.

◆ m_bot_via_layer

int DSN::SPECCTRA_DB::m_bot_via_layer
private

Definition at line 4017 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 3988 of file specctra.h.

Referenced by BuiltBoardOutlines(), and fillBOUNDARY().

◆ m_filename

wxString DSN::SPECCTRA_DB::m_filename
private

Definition at line 3990 of file specctra.h.

◆ m_footprintsAreFlipped

bool DSN::SPECCTRA_DB::m_footprintsAreFlipped
private

Definition at line 3993 of file specctra.h.

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

◆ m_kicadLayer2pcb

std::map<PCB_LAYER_ID, int> DSN::SPECCTRA_DB::m_kicadLayer2pcb
private

maps BOARD layer number to PCB layer numbers

Definition at line 3999 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 3997 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 4013 of file specctra.h.

Referenced by deleteNETs(), and FromBOARD().

◆ m_padstackset

PADSTACKSET DSN::SPECCTRA_DB::m_padstackset
private

Definition at line 4010 of file specctra.h.

Referenced by FromBOARD(), and makeIMAGE().

◆ m_pcb

PCB* DSN::SPECCTRA_DB::m_pcb
private

◆ m_pcbLayer2kicad

std::map<int, PCB_LAYER_ID> DSN::SPECCTRA_DB::m_pcbLayer2kicad
private

maps PCB layer number to BOARD layer numbers

Definition at line 4000 of file specctra.h.

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

◆ m_quote_char

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

Definition at line 3991 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 4003 of file specctra.h.

Referenced by FromSESSION(), makeARC(), 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 4006 of file specctra.h.

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

◆ m_sf

STRING_FORMATTER DSN::SPECCTRA_DB::m_sf
private

Definition at line 3995 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 4016 of file specctra.h.

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

◆ scanPADs

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

Definition at line 4008 of file specctra.h.


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