26 #ifndef PCBNEW_IMPORTERS_IMPORT_FABMASTER_H_ 27 #define PCBNEW_IMPORTERS_IMPORT_FABMASTER_H_ 40 #include <unordered_map> 44 #include <wx/filename.h> 68 bool Read(
const std::string& aFile );
94 std::deque<single_row>
rows;
133 return std::hash<std::string>{}( aPad.
name );
138 std::unordered_map<std::string, FM_PAD>
pads;
225 const std::unique_ptr<GRAPHIC_ITEM>& rhs)
const 227 if( lhs->refdes != rhs->refdes )
228 return lhs->refdes < rhs->refdes;
230 if( lhs->layer != rhs->layer )
231 return lhs->layer < rhs->layer;
233 return lhs->seq < rhs->seq;
303 return lhs->
id < rhs->
id;
308 std::map<std::string, FABMASTER_LAYER>
layers;
325 std::size_t
operator()(
const std::unique_ptr<FABMASTER_PAD_SHAPE>& aPad )
const 327 return std::hash<std::string>{}( aPad->name );
332 std::unordered_map<std::string, FABMASTER_PAD_SHAPE>
pad_shapes;
353 return std::hash<std::string>{}( aSym.
name );
375 std::unordered_map<std::string, SYMBOL>
symbols;
395 return lhs.
id < rhs.
id;
415 std::vector<std::unique_ptr<FM_VIA>>
vias;
431 bool operator()(
const std::unique_ptr<TRACE>& lhs,
const std::unique_ptr<TRACE>& rhs)
const 433 return lhs->id < rhs->id;
471 return std::hash<std::string>{}( aCmp.
refdes );
477 std::map<std::string, std::vector<std::unique_ptr<COMPONENT>>>
components;
497 const std::unique_ptr<PIN>& rhs)
const 499 return lhs->pin_number < rhs->pin_number;
558 double readDouble(
const std::string& aStr )
const;
559 int readInt(
const std::string& aStr )
const;
580 bool loadEtch(
BOARD* aBoard,
const std::unique_ptr<TRACE>& aLine);
581 bool loadZone(
BOARD* aBoard,
const std::unique_ptr<FABMASTER::TRACE>& aLine);
582 bool loadPolygon(
BOARD* aBoard,
const std::unique_ptr<FABMASTER::TRACE>& aLine);
int execute_recordbuffer(int filetype)
SHAPE_ARC result
! KiCad-style arc representation
std::string height
! COMP_HEIGHT
size_t processSimpleLayers(size_t aRow)
std::string name
! SYM_NAME
bool Read(const std::string &aFile)
std::string padstack
! PAD_STACK_NAME
std::vector< std::string > single_row
bool operator()(const std::unique_ptr< PIN > &lhs, const std::unique_ptr< PIN > &rhs) const
std::map< std::string, std::map< int, GEOM_GRAPHIC > > comp_graphics
std::string graphic_data6
std::size_t operator()(const FM_PAD &aPad) const
std::size_t operator()(const FABMASTER::SYMBOL &aSym) const
std::unordered_map< std::string, SYMBOL > symbols
std::string name
! LAYER_SUBCLASS
std::map< std::string, std::vector< std::unique_ptr< COMPONENT > > > components
A progress reporter interface for use in multi-threaded environments.
std::string refdes
! REFDES
bool operator()(const GEOM_GRAPHIC &lhs, const GEOM_GRAPHIC &rhs) const
std::string layer
! SUBCLASS
bool ital
! GRAPHIC_DATA_6[4] != 0.0
int pin_y
! PIN_Y - Absolute board units
std::map< std::string, PCB_LAYER_ID > layer_map
bool loadGraphics(BOARD *aBoard)
PROGRESS_REPORTER * m_progressReporter
optional; may be nullptr
GRAPHIC_LINE * processLine(const GRAPHIC_DATA &aData, double aScale)
bool fill
! GRAPHIC_DATA_5
double readDouble(const std::string &aStr) const
Reads the double/integer value from a std string independent of the user locale.
PCB_LAYER_ID getLayer(const std::string &aLayerName)
int thickness
! GRAPHIC_DATA_6[6]
std::unique_ptr< graphic_element > elements
bool LoadBoard(BOARD *aBoard, PROGRESS_REPORTER *aProgressReporter)
int end_x
! GRAPHIC_DATA_3
int pin_x
! PIN_X - Absolute board units
bool operator()(const NETNAME &lhs, const NETNAME &rhs) const
std::string subclass
! SUBCLASS
std::string material
! LAYER_MATERIAL
int start_y
! GRAPHIC_DATA_2
std::string graphic_data2
bool loadEtch(BOARD *aBoard, const std::unique_ptr< TRACE > &aLine)
bool loadZone(BOARD *aBoard, const std::unique_ptr< FABMASTER::TRACE > &aLine)
std::string symbol
! SYMBOL
std::map< std::string, FABMASTER_LAYER > layers
std::size_t operator()(const FABMASTER::COMPONENT &aCmp) const
std::string tol
! COMP_TOL
bool shield
! LAYER_SHIELD_LAYER
std::string refdes
! REFDES
std::vector< std::unique_ptr< FM_VIA > > vias
graphic_element segment
! GRAPHIC_DATA (can be either LINE or ARC)
int center_x
! GRAPHIC_DATA_5
bool loadNets(BOARD *aBoard)
A!LAYER_SORT!LAYER_SUBCLASS!LAYER_ARTWORK!LAYER_USE!LAYER_CONDUCTOR!LAYER_DIELECTRIC_CONSTANT !...
std::string refdes
! REFDES
std::string graphic_data10
std::string insert_code
! COMP_INSERTION_CODE
std::string name
! SYM_NAME
std::set< std::unique_ptr< TRACE >, TRACE::BY_ID > traces
int subseq
! RECORD_TAG[1]
double rotation
! PIN_ROTATION
size_t processFootprints(size_t aRow)
A!REFDES!COMP_CLASS!COMP_PART_NUMBER!COMP_HEIGHT!COMP_DEVICE_LABEL!COMP_INSERTION_CODE!...
std::string name
! SYM_NAME
std::string graphic_data1
bool test_point
! TEST_POINT
int end_y
! GRAPHIC_DATA_4 ! width is GRAPHIC_DATA_5
int readInt(const std::string &aStr) const
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape() DO NOT REORDER, legacy_plugin is dependent on ...
section_type detectType(size_t aOffset)
std::vector< GEOM_GRAPHIC > board_graphics
GRAPHIC_ITEM * processGraphic(const GRAPHIC_DATA &aData, double aScale)
Specialty functions for processing graphical data rows into the internal database.
std::size_t operator()(const std::unique_ptr< FABMASTER_PAD_SHAPE > &aPad) const
bool loadFootprints(BOARD *aBoard)
std::map< int, graphic_element > elements
double er
! LAYER_DIELECTRIC_CONSTANT
bool loadVias(BOARD *aBoard)
int height
! GRAPHIC_DATA_6[2]
bool operator()(const FABMASTER_LAYER *lhs, const FABMASTER_LAYER *rhs) const
std::map< std::pair< std::string, std::string >, NETNAME > pin_nets
size_t processGeometry(size_t aRow)
A!GRAPHIC_DATA_NAME!GRAPHIC_DATA_NUMBER!RECORD_TAG!GRAPHIC_DATA_1!GRAPHIC_DATA_2!GRAPHIC_DATA_3!...
bool operator()(const std::unique_ptr< TRACE > &lhs, const std::unique_ptr< TRACE > &rhs) const
std::string graphic_data5
Represent a set of closed polygons.
int sym_id
! RECORD_TAG[0]
double rotation
! GRAPHIC_DATA_3
std::set< std::unique_ptr< GRAPHIC_ITEM >, GRAPHIC_ITEM::SEQ_CMP > graphic_element
size_t processVias(size_t aRow)
A!VIA_X!VIA_Y!PAD_STACK_NAME!NET_NAME!TEST_POINT!
std::string graphic_datanum
std::string refdes
! REFDES
std::string use
! LAYER_USE
size_t processPadStacks(size_t aRow)
A!PADNAME!RECNUMBER!LAYER!FIXFLAG!VIAFLAG!PADSHAPE1!PADWIDTH!PADHGHT! PADXOFF!PADYOFF!...
int center_y
! GRAPHIC_DATA_6
GRAPHIC_RECTANGLE * processRectangle(const GRAPHIC_DATA &aData, double aScale)
std::string name
! PAD_SHAPE_NAME
std::string refdes
!< NET_NAME
std::string pin_num
!< REFDES
GRAPHIC_TYPE type
! Type of graphic item
std::set< std::unique_ptr< TRACE >, TRACE::BY_ID > zones
SHAPE_POLY_SET loadShapePolySet(const graphic_element &aLine)
size_t processSymbols(size_t aRow)
std::string layer
! SUBCLASS
std::set< std::unique_ptr< TRACE >, TRACE::BY_ID > polygons
int getColFromName(size_t aRow, const std::string &aStr)
std::string net
! NET_NAME
int radius
! GRAPHIC_DATA_7 ! width is GRAPHIC_DATA_8
std::string voltage
! COMP_VOLTAGE
std::string text
! GRAPHIC_DATA_7
bool mirror
! VIA_MIRROR (VIA_MIRROR is an optional component)
std::string lclass
! CLASS
std::map< std::string, std::set< std::unique_ptr< PIN >, PIN::BY_NUM > > pins
std::string refdes
! REFDES
std::set< std::string > netnames
COMPCLASS cclass
! COMP_CLASS
unsigned m_totalCount
for progress reporting
std::string pinnum
! PIN_NUMBER
std::string graphic_data9
std::string graphic_data7
size_t processPins(size_t aRow)
A!SYM_NAME!SYM_MIRROR!PIN_NAME!PIN_NUMBER!PIN_X!PIN_Y!PAD_STACK_NAME!REFDES!PIN_ROTATION!...
int end_x
! GRAPHIC_DATA_3
std::unordered_map< std::string, FM_PAD > pads
double rotate
! SYM_ROTATE (degrees)
size_t processCustomPads(size_t aRow)
A!SUBCLASS!PAD_SHAPE_NAME!GRAPHIC_DATA_NAME!GRAPHIC_DATA_NUMBER!RECORD_TAG!GRAPHIC_DATA_1!...
GRAPHIC_ARC * processArc(const GRAPHIC_DATA &aData, double aScale)
std::unordered_map< std::string, FABMASTER_PAD_SHAPE > pad_shapes
std::string value
! COMP_VALUE
std::string padstack
! PAD_STACK_NAME
int layerid
! pcbnew layer (assigned)
std::string netname
! NET_NAME
int start_x
! GRAPHIC_DATA_1
bool conductive
! LAYER_CONDUCTOR
EDA_TEXT_HJUSTIFY_T orient
! GRAPHIC_DATA_5
Information pertinent to a Pcbnew printed circuit board.
std::string graphic_data4
PCB_LAYER_ID
A quick note on layer IDs:
int end_y
! GRAPHIC_DATA_4
std::string graphic_data8
std::string pn
! COMP_PART_NUMBER
int end_y
! GRAPHIC_DATA_4
unsigned m_lastProgressCount
bool disable
! if true, prevent the layer elements from being used
std::string pin_number
! PIN_NUMBER
size_t processNets(size_t aRow)
A!NET_NAME!REFDES!PIN_NUMBER!PIN_NAME!PIN_GROUND!PIN_POWER!
size_t processLayers(size_t aRow)
A!LAYER_SORT!LAYER_SUBCLASS!LAYER_ARTWORK!LAYER_USE!LAYER_CONDUCTOR!LAYER_DIELECTRIC_CONSTANT!...
std::map< int, graphic_element > elements
std::string subclass
!< CLASS
bool operator()(const std::unique_ptr< GRAPHIC_ITEM > &lhs, const std::unique_ptr< GRAPHIC_ITEM > &rhs) const
COMPCLASS parseCompClass(const std::string &aCompClass)
bool loadPolygon(BOARD *aBoard, const std::unique_ptr< FABMASTER::TRACE > &aLine)
std::string dev_label
! COMP_DEVICE_LABEL
bool orderZones(BOARD *aBoard)
Sets zone priorities based on zone BB size.
int width
! Various sections depending on type
size_t processTraces(size_t aRow)
A!CLASS!SUBCLASS!GRAPHIC_DATA_NAME!GRAPHIC_DATA_NUMBER!RECORD_TAG!GRAPHIC_DATA_1!GRAPHIC_DATA_2!...
std::string pin_name
!< PIN_NUMBER
std::string refdes
! REFDES
std::string name
! SYM_NAME
int end_x
! GRAPHIC_DATA_3
SYMTYPE parseSymType(const std::string &aSymType)
bool mirror
! GRAPHIC_DATA_4
std::string graphic_dataname
GRAPHIC_SHAPE shape
! Shape of the graphic_item
bool clockwise
! GRAPHIC_DATA_9
bool loadZones(BOARD *aBoard)
Loads sections of the database into the board.
bool positive
! LAYER_ARTWORK (either POSITIVE or NEGATIVE)
std::string padstack
! PAD_STACK
! Not actually in Fabmaster but we use for 360° arcs
int subseq_id
! RECORD_TAG[2] (RECORD_TAG is of the form "x y z")
bool loadLayers(BOARD *aBoard)
std::string graphic_data3
double thermal_cond
! LAYER_THERMAL_CONDUCTIVITY
int seq_id
! RECORD_TAG[1] (RECORD_TAG is of the form "x y z")
double thickness
! LAYER_THICKNESS
std::set< std::unique_ptr< TRACE >, TRACE::BY_ID > refdes
std::string pin_name
! PIN_NAME
bool loadOutline(BOARD *aBoard, const std::unique_ptr< TRACE > &aLine)
double processScaleFactor(size_t aRow)
Processes data from text vectors into internal database for further ordering.
double conductivity
! LAYER_ELECTRICAL_CONDUCTIVITY
size_t processPadStackLayers(size_t aRow)
A!SUBCLASS!PAD_SHAPE_NAME!GRAPHIC_DATA_NAME!GRAPHIC_DATA_NUMBER!RECORD_TAG!GRAPHIC_DATA_1!...
GRAPHIC_TEXT * processText(const GRAPHIC_DATA &aData, double aScale)
std::deque< single_row > rows