Pcbnew header housekeeping round 3.

This commit is contained in:
Wayne Stambaugh 2021-06-04 13:44:22 -04:00
parent 2b4564571c
commit f57ef55cd6
9 changed files with 487 additions and 468 deletions

View File

@ -102,60 +102,7 @@ struct VRML_COLOR
// Handle the board ans its board items to convert them to a VRML representation: // Handle the board ans its board items to convert them to a VRML representation:
class EXPORTER_PCB_VRML class EXPORTER_PCB_VRML
{ {
private:
VRML_COLOR vrml_colors_list[VRML_COLOR_LAST];
double m_layer_z[PCB_LAYER_ID_COUNT];
SHAPE_POLY_SET m_pcbOutlines; // stores the board main outlines
int m_precision; // precision factor when exportin fp shapes
// to separate files
SGNODE* m_sgmaterial[VRML_COLOR_LAST];
public: public:
IFSG_TRANSFORM m_OutputPCB;
VRML_LAYER m_holes;
VRML_LAYER m_3D_board;
VRML_LAYER m_top_copper;
VRML_LAYER m_bot_copper;
VRML_LAYER m_top_silk;
VRML_LAYER m_bot_silk;
VRML_LAYER m_top_soldermask;
VRML_LAYER m_bot_soldermask;
VRML_LAYER m_top_paste;
VRML_LAYER m_bot_paste;
VRML_LAYER m_plated_holes;
std::list< SGNODE* > m_components;
S3D_CACHE* m_Cache3Dmodels;
BOARD* m_Pcb;
/* true to use VRML inline{} syntax for footprint 3D models, like:
* Inline { url "F:/tmp/pic_programmer/shapes3D/DIP-18_W7.62mm_Socket.wrl" }
* false to merge VRML 3D modeles in the .wrl board file
*/
bool m_UseInlineModelsInBrdfile;
// 3D subdirectory to copy footprint vrml 3D models when not merged in board file
wxString m_Subdir3DFpModels;
// true to use relative paths in VRML inline{} for footprint 3D models
// used only if m_UseInlineModelsInBrdfile = true
bool m_UseRelPathIn3DModelFilename;
// true to reuse component definitions
bool m_ReuseDef;
// scaling from 0.1 inch to desired VRML unit
double m_WorldScale = 1.0;
// scaling from mm to desired VRML world scale
double m_BoardToVrmlScale;
double m_tx; // global translation along X
double m_ty; // global translation along Y
double m_brd_thickness; // depth of the PCB
EXPORTER_PCB_VRML(); EXPORTER_PCB_VRML();
~EXPORTER_PCB_VRML(); ~EXPORTER_PCB_VRML();
@ -202,7 +149,7 @@ public:
void ExportVrmlPadHole( PAD* aPad ); void ExportVrmlPadHole( PAD* aPad );
// Exoprt a set of polygons without holes. // Export a set of polygons without holes.
// Polygons in SHAPE_POLY_SET must be without hole, i.e. holes must be linked // Polygons in SHAPE_POLY_SET must be without hole, i.e. holes must be linked
// previously to their main outline. // previously to their main outline.
void ExportVrmlPolygonSet( VRML_LAYER* aVlayer, const SHAPE_POLY_SET& aOutlines ); void ExportVrmlPolygonSet( VRML_LAYER* aVlayer, const SHAPE_POLY_SET& aOutlines );
@ -228,4 +175,58 @@ private:
VRML_LAYER* layer, double aHeight, bool aTopPlane ); VRML_LAYER* layer, double aHeight, bool aTopPlane );
SGNODE* getSGColor( VRML_COLOR_INDEX colorIdx ); SGNODE* getSGColor( VRML_COLOR_INDEX colorIdx );
public:
IFSG_TRANSFORM m_OutputPCB;
VRML_LAYER m_holes;
VRML_LAYER m_3D_board;
VRML_LAYER m_top_copper;
VRML_LAYER m_bot_copper;
VRML_LAYER m_top_silk;
VRML_LAYER m_bot_silk;
VRML_LAYER m_top_soldermask;
VRML_LAYER m_bot_soldermask;
VRML_LAYER m_top_paste;
VRML_LAYER m_bot_paste;
VRML_LAYER m_plated_holes;
std::list< SGNODE* > m_components;
S3D_CACHE* m_Cache3Dmodels;
BOARD* m_Pcb;
/* true to use VRML inline{} syntax for footprint 3D models, like:
* Inline { url "F:/tmp/pic_programmer/shapes3D/DIP-18_W7.62mm_Socket.wrl" }
* false to merge VRML 3D modules in the .wrl board file
*/
bool m_UseInlineModelsInBrdfile;
// 3D subdirectory to copy footprint vrml 3D models when not merged in board file
wxString m_Subdir3DFpModels;
// true to use relative paths in VRML inline{} for footprint 3D models
// used only if m_UseInlineModelsInBrdfile = true
bool m_UseRelPathIn3DModelFilename;
// true to reuse component definitions
bool m_ReuseDef;
// scaling from 0.1 inch to desired VRML unit
double m_WorldScale = 1.0;
// scaling from mm to desired VRML world scale
double m_BoardToVrmlScale;
double m_tx; // global translation along X
double m_ty; // global translation along Y
double m_brd_thickness; // depth of the PCB
private:
VRML_COLOR vrml_colors_list[VRML_COLOR_LAST];
double m_layer_z[PCB_LAYER_ID_COUNT];
SHAPE_POLY_SET m_pcbOutlines; // stores the board main outlines
int m_precision; // precision factor when exporting fp shapes
// to separate files
SGNODE* m_sgmaterial[VRML_COLOR_LAST];
}; };

View File

@ -39,19 +39,10 @@ class OUTPUTFORMATTER;
/** /**
* EXCELLON_WRITER is a class mainly used to create Excellon drill files * Create Excellon drill, drill map, and drill report files.
* However, this class is also used to create drill maps and drill report
*/ */
class EXCELLON_WRITER: public GENDRILL_WRITER_BASE class EXCELLON_WRITER: public GENDRILL_WRITER_BASE
{ {
private:
FILE* m_file; // The output file
bool m_minimalHeader; // True to use minimal header
bool m_mirror;
bool m_useRouteModeForOval; // True to use a route command for oval holes
// False to use a G85 canned mode for oval holes
public: public:
EXCELLON_WRITER( BOARD* aPcb ); EXCELLON_WRITER( BOARD* aPcb );
@ -60,8 +51,7 @@ public:
} }
/** /**
* Return the plot offset (usually the position * Return the plot offset (usually the position of the auxiliary axis.
* of the auxiliary axis
*/ */
wxPoint GetOffset() { return m_offset; } wxPoint GetOffset() { return m_offset; }
@ -74,28 +64,27 @@ public:
} }
/** /**
* Function SetFormat * Initialize internal parameters to match the given format.
* Initialize internal parameters to match the given format *
* @param aMetric = true for metric coordinates, false for imperial units * @param aMetric set to true for metric coordinates, false for imperial units.
* @param aZerosFmt = DECIMAL_FORMAT, SUPPRESS_LEADING, SUPPRESS_TRAILING, KEEP_ZEROS * @param aZerosFmt is the zero format DECIMAL_FORMAT, SUPPRESS_LEADING, SUPPRESS_TRAILING,
* @param aLeftDigits = number of digits for integer part of coordinates * or KEEP_ZEROS.
* if <= 0 (default), a suitable value will be used, depending on units * @param aLeftDigits is the number of digits for integer part of coordinates
* @param aRightDigits = number of digits for mantissa part of coordinates * if <= 0 (default), a suitable value will be used, depending on units.
* if <= 0 (default), a suitable value will be used, depending on units * @param aRightDigits is number of digits for mantissa part of coordinates
* if <= 0 (default), a suitable value will be used, depending on units.
*/ */
void SetFormat( bool aMetric, ZEROS_FMT aZerosFmt = DECIMAL_FORMAT, void SetFormat( bool aMetric, ZEROS_FMT aZerosFmt = DECIMAL_FORMAT,
int aLeftDigits = 0, int aRightDigits = 0 ); int aLeftDigits = 0, int aRightDigits = 0 );
/** /**
* Function SetOptions * Initialize internal parameters to match drill options.
* Initialize internal parameters to match drill options *
* @param aMirror = true to create mirrored coordinates (Y coordinates negated) * @param aMirror set to true to create mirrored coordinates (Y coordinates negated).
* @param aMinimalHeader = true to use a minimal header (no comments, no info) * @param aMinimalHeader set to true to use a minimal header (no comments, no info).
* @param aOffset = drill coordinates offset * @param aOffset is the drill coordinates offset.
* @param aMerge_PTH_NPTH = true to create only one file containing PTH and NPTH * @param aMerge_PTH_NPTH set to true to create only one file containing PTH and NPTH
* false to create 2 separate files : one for PTH and one for NPTH * false to create 2 separate files : one for PTH and one for NPTH.
*/ */
void SetOptions( bool aMirror, bool aMinimalHeader, wxPoint aOffset, bool aMerge_PTH_NPTH ) void SetOptions( bool aMirror, bool aMinimalHeader, wxPoint aOffset, bool aMerge_PTH_NPTH )
{ {
@ -106,33 +95,34 @@ public:
} }
/** /**
* Function CreateDrillandMapFilesSet * Create the full set of Excellon drill file for the board.
* Creates the full set of Excellon drill file for the board *
* filenames are computed from the board name, and layers id * File names are computed from the board name and layer ID.
* @param aPlotDirectory = the output folder *
* @param aGenDrill = true to generate the EXCELLON drill file * @param aPlotDirectory is the output folder.
* @param aGenMap = true to generate a drill map file * @param aGenDrill set to true to generate the EXCELLON drill file.
* @param aReporter = a REPORTER to return activity or any message (can be NULL) * @param aGenMap set to true to generate a drill map file.
* @param aReporter is a #REPORTER to return activity or any message (can be NULL)
*/ */
void CreateDrillandMapFilesSet( const wxString& aPlotDirectory, void CreateDrillandMapFilesSet( const wxString& aPlotDirectory, bool aGenDrill, bool aGenMap,
bool aGenDrill, bool aGenMap, REPORTER* aReporter = nullptr );
REPORTER * aReporter = NULL );
private: private:
/** /**
* Function CreateDrillFile * Create an Excellon drill file.
* Creates an Excellon drill file *
* @param aFile = an opened file to write to will be closed by CreateDrillFile * @param aFile is an opened file to write to will be closed by CreateDrillFile.
* @param aLayerPair = the layer pair for the current holes * @param aLayerPair is the layer pair for the current holes.
* @param aHolesType = the holes type (PTH, NPTH, mixed) * @param aHolesType is the holes type (PTH, NPTH, mixed).
* @return hole count * @return the hole count.
*/ */
int createDrillFile( FILE * aFile, DRILL_LAYER_PAIR aLayerPair, int createDrillFile( FILE* aFile, DRILL_LAYER_PAIR aLayerPair, TYPE_FILE aHolesType );
TYPE_FILE aHolesType );
/** Print the DRILL file header. The full header is somethink like: /**
* Print the DRILL file header.
*
* The full header is something like:
* M48 * M48
* ;DRILL file {PCBNEW (2007-11-29-b)} date 17/1/2008-21:02:35 * ;DRILL file {PCBNEW (2007-11-29-b)} date 17/1/2008-21:02:35
* ;FORMAT={ <precision> / absolute / <units> / <numbers format>} * ;FORMAT={ <precision> / absolute / <units> / <numbers format>}
@ -141,25 +131,31 @@ private:
* ; #@! TF.GenerationSoftware,Kicad,Pcbnew,2017.04 * ; #@! TF.GenerationSoftware,Kicad,Pcbnew,2017.04
* FMAT,2 * FMAT,2
* INCH,TZ * INCH,TZ
* @param aLayerPair = the layer pair for the current holes *
* @param aHolesType = the holes type in file (PTH, NPTH, mixed) * @param aLayerPair is the layer pair for the current holes.
* @param aHolesType is the holes type in file (PTH, NPTH, mixed).
*/ */
void writeEXCELLONHeader( DRILL_LAYER_PAIR aLayerPair, TYPE_FILE aHolesType ); void writeEXCELLONHeader( DRILL_LAYER_PAIR aLayerPair, TYPE_FILE aHolesType );
void writeEXCELLONEndOfFile(); void writeEXCELLONEndOfFile();
/** Created a line like: /**
* X48000Y19500 * Create a line like according to the selected format.
* According to the selected format
*/ */
void writeCoordinates( char* aLine, double aCoordX, double aCoordY ); void writeCoordinates( char* aLine, double aCoordX, double aCoordY );
/** /**
* write a comment string giving the hole attribute like * Write a comment string giving the hole attribute.
* "; #@! TO.P,viatype\n" *
* @param aAttribute is the hole attribute * @param aAttribute is the hole attribute.
*/ */
void writeHoleAttribute( HOLE_ATTRIBUTE aAttribute ); void writeHoleAttribute( HOLE_ATTRIBUTE aAttribute );
FILE* m_file; // The output file
bool m_minimalHeader; // True to use minimal header
bool m_mirror;
bool m_useRouteModeForOval; // True to use a route command for oval holes
// False to use a G85 canned mode for oval holes
}; };
#endif // #ifndef _GENDRILL_EXCELLON_WRITER_ #endif // #ifndef _GENDRILL_EXCELLON_WRITER_

View File

@ -74,30 +74,15 @@ public:
}; };
/* the HOLE_INFO class handle hole which must be drilled (diameter, position and layers) /**
* For buried or micro vias, the hole is not on all layers. * Handle hole which must be drilled (diameter, position and layers).
* So we must generate a drill file for each layer pair (adjacent layers) *
* Not plated holes are always through holes, and must be output on a specific drill file * For buried or micro vias, the hole is not on all layers. So we must generate a drill file
* because they are drilled after the Pcb process is finished. * for each layer pair (adjacent layers). Not plated holes are always through holes, and must
* be output on a specific drill file because they are drilled after the PCB process is finished.
*/ */
class HOLE_INFO class HOLE_INFO
{ {
public:
BOARD_ITEM* m_ItemParent; // The pad or via parent of this hole
int m_Hole_Diameter; // hole value, and for oblong: min(hole size x, hole size y)
int m_Tool_Reference; // Tool reference for this hole = 1 ... n (values <=0 must not be used)
wxSize m_Hole_Size; // hole size for oblong holes
double m_Hole_Orient; // Hole rotation (= pad rotation) for oblong holes
int m_Hole_Shape; // hole shape: round (0) or oval (1)
wxPoint m_Hole_Pos; // hole position
PCB_LAYER_ID m_Hole_Bottom_Layer; // hole ending layer (usually back layer)
PCB_LAYER_ID m_Hole_Top_Layer; // hole starting layer (usually front layer):
// m_Hole_Top_Layer < m_Hole_Bottom_Layer
bool m_Hole_NotPlated; // hole not plated. Must be in a specific drill file or section
HOLE_ATTRIBUTE m_HoleAttribute; // Attribute, used in Excellon drill file and to sort holes
// by type.
public: public:
HOLE_INFO() HOLE_INFO()
{ {
@ -111,17 +96,32 @@ public:
m_Hole_Top_Layer = F_Cu; m_Hole_Top_Layer = F_Cu;
m_HoleAttribute = HOLE_ATTRIBUTE::HOLE_UNKNOWN; m_HoleAttribute = HOLE_ATTRIBUTE::HOLE_UNKNOWN;
} }
public:
BOARD_ITEM* m_ItemParent; // The pad or via parent of this hole
int m_Hole_Diameter; // hole value, and for oblong: min(hole size x, hole
// size y).
int m_Tool_Reference; // Tool reference for this hole = 1 ... n (values <=0
// must not be used).
wxSize m_Hole_Size; // hole size for oblong holes
double m_Hole_Orient; // Hole rotation (= pad rotation) for oblong holes
int m_Hole_Shape; // hole shape: round (0) or oval (1)
wxPoint m_Hole_Pos; // hole position
PCB_LAYER_ID m_Hole_Bottom_Layer; // hole ending layer (usually back layer)
PCB_LAYER_ID m_Hole_Top_Layer; // hole starting layer (usually front layer):
// m_Hole_Top_Layer < m_Hole_Bottom_Layer
bool m_Hole_NotPlated; // hole not plated. Must be in a specific drill file or
// section.
HOLE_ATTRIBUTE m_HoleAttribute; // Attribute, used in Excellon drill file and to sort holes
// by type.
}; };
/* the DRILL_PRECISION helper class to handle drill precision format in excellon files /**
* Helper to handle drill precision format in excellon files.
*/ */
class DRILL_PRECISION class DRILL_PRECISION
{ {
public:
int m_Lhs; // Left digit number (integer value of coordinates)
int m_Rhs; // Right digit number (decimal value of coordinates)
public: public:
DRILL_PRECISION( int l = 2, int r = 4 ) DRILL_PRECISION( int l = 2, int r = 4 )
{ {
@ -136,16 +136,18 @@ public:
text << m_Lhs << wxT( ":" ) << m_Rhs; text << m_Lhs << wxT( ":" ) << m_Rhs;
return text; return text;
} }
int m_Lhs; // Left digit number (integer value of coordinates)
int m_Rhs; // Right digit number (decimal value of coordinates)
}; };
typedef std::pair<PCB_LAYER_ID, PCB_LAYER_ID> DRILL_LAYER_PAIR; typedef std::pair<PCB_LAYER_ID, PCB_LAYER_ID> DRILL_LAYER_PAIR;
/** /**
* GENDRILL_WRITER_BASE is a class to create drill maps and drill report, * Create drill maps and drill reports and drill files.
* and a helper class to created drill files. *
* drill files are created by specialized derived classes, depenfing on the * Drill files are created by specialized derived classes, depending on the file format.
* file format.
*/ */
class GENDRILL_WRITER_BASE class GENDRILL_WRITER_BASE
{ {
@ -153,7 +155,7 @@ public:
enum ZEROS_FMT { // Zero format in coordinates enum ZEROS_FMT { // Zero format in coordinates
DECIMAL_FORMAT, // Floating point coordinates DECIMAL_FORMAT, // Floating point coordinates
SUPPRESS_LEADING, // Suppress leading zeros SUPPRESS_LEADING, // Suppress leading zeros
SUPPRESS_TRAILING, // Suppress trainling zeros SUPPRESS_TRAILING, // Suppress trailing zeros
KEEP_ZEROS // keep zeros KEEP_ZEROS // keep zeros
}; };
@ -163,67 +165,38 @@ public:
MIXED_FILE // PHT+NPTH (mixed) MIXED_FILE // PHT+NPTH (mixed)
}; };
protected:
BOARD* m_pcb;
wxString m_drillFileExtension; // .drl or .gbr, depending on format
bool m_unitsMetric; // true = mm, false = inches
ZEROS_FMT m_zeroFormat; // the zero format option for output file
DRILL_PRECISION m_precision; // The current coordinate precision (not used in decimal format)
double m_conversionUnits; // scaling factor to convert the board unites to
// Excellon/Gerber units (i.e inches or mm)
wxPoint m_offset; // Drill offset coordinates
bool m_merge_PTH_NPTH; // True to generate only one drill file
std::vector<HOLE_INFO> m_holeListBuffer; // Buffer containing holes
std::vector<DRILL_TOOL> m_toolListBuffer; // Buffer containing tools
PLOT_FORMAT m_mapFileFmt; // the format of the map drill file,
// if this map is needed
const PAGE_INFO* m_pageInfo; // the page info used to plot drill maps
// If NULL, use a A4 page format
// This Ctor is protected.
// Use derived classes to build a fully initialized GENDRILL_WRITER_BASE class.
GENDRILL_WRITER_BASE( BOARD* aPcb )
{
m_pcb = aPcb;
m_conversionUnits = 1.0;
m_unitsMetric = true;
m_mapFileFmt = PLOT_FORMAT::PDF;
m_pageInfo = NULL;
m_merge_PTH_NPTH = false;
m_zeroFormat = DECIMAL_FORMAT;
}
public:
virtual ~GENDRILL_WRITER_BASE() virtual ~GENDRILL_WRITER_BASE()
{ {
} }
/** /**
* set the option to make separate drill files for PTH and NPTH * Set the option to make separate drill files for PTH and NPTH.
* @param aMerge = true to make only one file containing PTH and NPTH *
* = false to create 2 separate files * @param aMerge set to true to make only one file containing PTH and NPTH or false to
* create 2 separate files.
*/ */
void SetMergeOption( bool aMerge ) { m_merge_PTH_NPTH = aMerge; } void SetMergeOption( bool aMerge ) { m_merge_PTH_NPTH = aMerge; }
/** /**
* Return the plot offset (usually the position * Return the plot offset (usually the position of the auxiliary axis.
* of the auxiliary axis
*/ */
wxPoint GetOffset() { return m_offset; } wxPoint GetOffset() { return m_offset; }
/** /**
* Sets the page info used to plot drill maps * Set the page info used to plot drill maps.
* If NULL, a A4 page format will be used *
* @param aPageInfo = a reference to the page info, usually used to plot/display the board * If NULL, a A4 page format will be used.
*
* @param aPageInfo is a reference to the page info, usually used to plot/display the board.
*/ */
void SetPageInfo( const PAGE_INFO* aPageInfo ) { m_pageInfo = aPageInfo; } void SetPageInfo( const PAGE_INFO* aPageInfo ) { m_pageInfo = aPageInfo; }
/** /**
* Initialize the format for the drill map file * Initialize the format for the drill map file.
* @param aMapFmt = a PlotFormat value (one of *
* PLOT_FORMAT_HPGL, PLOT_FORMAT_POST, PLOT_FORMAT_GERBER, * @param aMapFmt a PlotFormat value (one of PLOT_FORMAT_HPGL, PLOT_FORMAT_POST,
* PLOT_FORMAT_DXF, PLOT_FORMAT_SVG, PLOT_FORMAT_PDF * PLOT_FORMAT_GERBER, PLOT_FORMAT_DXF, PLOT_FORMAT_SVG, PLOT_FORMAT_PDF
* the most useful are PLOT_FORMAT_PDF and PLOT_FORMAT_POST * the most useful are PLOT_FORMAT_PDF and PLOT_FORMAT_POST.
*/ */
void SetMapFileFormat( PLOT_FORMAT aMapFmt ) void SetMapFileFormat( PLOT_FORMAT aMapFmt )
{ {
@ -231,21 +204,20 @@ public:
} }
/** /**
* Function CreateMapFilesSet * Create the full set of map files for the board, in PS, PDF ... format
* Creates the full set of map files for the board, in PS, PDF ... format * (use SetMapFileFormat() to select the format).
* (use SetMapFileFormat() to select the format) *
* filenames are computed from the board name, and layers id * File names are computed from the board name and layer ID.
* @param aPlotDirectory = the output folder *
* @param aReporter = a REPORTER to return activity or any message (can be NULL) * @param aPlotDirectory is the output folder.
* @param aReporter is a REPORTER to return activity or any message (can be NULL)
*/ */
void CreateMapFilesSet( const wxString& aPlotDirectory, REPORTER* aReporter = NULL ); void CreateMapFilesSet( const wxString& aPlotDirectory, REPORTER* aReporter = nullptr );
/** /**
* Function GenDrillReportFile * Create a plain text report file giving a list of drill values and drill count for through
* Create a plain text report file giving a list of drill values and drill count * holes, oblong holes, and for buried vias, drill values and drill count per layer pair
* for through holes, oblong holes, and for buried vias, * there is only one report for all drill files even when buried or blinds vias exist.
* drill values and drill count per layer pair
* there is only one report for all drill files even when buried or blinds vias exist
* *
* Here is a sample created by this function: * Here is a sample created by this function:
* Drill report for F:/tmp/interf_u/interf_u.brd * Drill report for F:/tmp/interf_u/interf_u.brd
@ -287,51 +259,49 @@ public:
* *
* Total unplated holes count 1 * Total unplated holes count 1
* *
* @param aFullFileName : the name of the file to create * @param aFullFileName is the name of the file to create.
* * @return true if the file is created.
* @return true if the file is created
*/ */
bool GenDrillReportFile( const wxString& aFullFileName ); bool GenDrillReportFile( const wxString& aFullFileName );
protected: protected:
/** /**
* Function GenDrillMapFile
* Plot a map of drill marks for holes. * Plot a map of drill marks for holes.
* Hole list must be created before calling this function, by buildHolesList() *
* for the right holes set (PTH, NPTH, buried/blind vias ...) * Hole list must be created before calling this function, by buildHolesList() for the
* the paper sheet to use to plot the map is set in m_pageInfo * right holes set (PTH, NPTH, buried/blind vias ...) the paper sheet to use to plot the
* ( calls SetPageInfo() to set it ) * map is set in m_pageInfo ( calls SetPageInfo() to set it ). If NULL, A4 format will
* if NULL, A4 format will be used * be used.
* @param aFullFileName : the full filename of the map file to create, *
* @param aFormat : one of the supported plot formats (see enum PlotFormat ) * @param aFullFileName is the full filename of the map file to create.
* @param aFormat is one of the supported plot formats (see enum PlotFormat ).
*/ */
bool genDrillMapFile( const wxString& aFullFileName, PLOT_FORMAT aFormat ); bool genDrillMapFile( const wxString& aFullFileName, PLOT_FORMAT aFormat );
/** /**
* Function BuildHolesList * Create the list of holes and tools for a given board.
* Create the list of holes and tools for a given board *
* The list is sorted by increasing drill size. * The list is sorted by increasing drill size. Only holes included within aLayerPair
* Only holes included within aLayerPair are listed. * are listed. If aLayerPair identifies with [F_Cu, B_Cu], then pad holes are always
* If aLayerPair identifies with [F_Cu, B_Cu], then * included also.
* pad holes are always included also.
* *
* @param aLayerPair is an inclusive range of layers. * @param aLayerPair is an inclusive range of layers.
* @param aGenerateNPTH_list : * @param aGenerateNPTH_list :
* true to create NPTH only list (with no plated holes) * true to create NPTH only list (with no plated holes)
* false to created plated holes list (with no NPTH ) * false to created plated holes list (with no NPTH )
*/ */
void buildHolesList( DRILL_LAYER_PAIR aLayerPair, void buildHolesList( DRILL_LAYER_PAIR aLayerPair, bool aGenerateNPTH_list );
bool aGenerateNPTH_list );
int getHolesCount() const { return m_holeListBuffer.size(); } int getHolesCount() const { return m_holeListBuffer.size(); }
/** Helper function. /**
* Writes the drill marks in HPGL, POSTSCRIPT or other supported formats * Write the drill marks in HPGL, POSTSCRIPT or other supported formats/
* Each hole size has a symbol (circle, cross X, cross + ...) up to *
* PLOTTER::MARKER_COUNT different values. * Each hole size has a symbol (circle, cross X, cross + ...) up to PLOTTER::MARKER_COUNT
* If more than PLOTTER::MARKER_COUNT different values, * different values. If more than PLOTTER::MARKER_COUNT different values, these other
* these other values share the same mark shape * values share the same mark shape.
* @param aPlotter = a PLOTTER instance (HPGL, POSTSCRIPT ... plotter). *
* @param aPlotter is a PLOTTER instance (HPGL, POSTSCRIPT ... plotter).
*/ */
bool plotDrillMarks( PLOTTER* aPlotter ); bool plotDrillMarks( PLOTTER* aPlotter );
@ -339,15 +309,14 @@ protected:
std::vector<DRILL_LAYER_PAIR> getUniqueLayerPairs() const; std::vector<DRILL_LAYER_PAIR> getUniqueLayerPairs() const;
/** /**
* Function printToolSummary * Print m_toolListBuffer[] tools to aOut and returns total hole count.
* prints m_toolListBuffer[] tools to aOut and returns total hole count. *
* @param aOut = the current OUTPUTFORMATTER to print summary * @param aOut is the current OUTPUTFORMATTER to print summary.
* @param aSummaryNPTH = true to print summary for NPTH, false for PTH * @param aSummaryNPTH is true to print summary for NPTH, false for PTH.
*/ */
unsigned printToolSummary( OUTPUTFORMATTER& aOut, bool aSummaryNPTH ) const; unsigned printToolSummary( OUTPUTFORMATTER& aOut, bool aSummaryNPTH ) const;
/** /**
* minor helper function.
* @return a string from aPair to identify the layer layer pair. * @return a string from aPair to identify the layer layer pair.
* string is "<layer1Name>"-"<layer2Name>" * string is "<layer1Name>"-"<layer2Name>"
* used to generate a filename for drill files and drill maps * used to generate a filename for drill files and drill maps
@ -355,39 +324,71 @@ protected:
const std::string layerPairName( DRILL_LAYER_PAIR aPair ) const; const std::string layerPairName( DRILL_LAYER_PAIR aPair ) const;
/** /**
* minor helper function.
* @return a string from aLayer to identify the layer. * @return a string from aLayer to identify the layer.
* string are "front" "back" or "in<aLayer>" * string are "front" "back" or "in<aLayer>"
*/ */
const std::string layerName( PCB_LAYER_ID aLayer ) const; const std::string layerName( PCB_LAYER_ID aLayer ) const;
/** /**
* @param aPair is the layer pair.
* @param aNPTH use true to generate the filename of NPTH holes.
* @param aMerge_PTH_NPTH use true to generate the filename of a file which containd both
* NPH and NPTH holes.
* @return a filename which identify the drill file function. * @return a filename which identify the drill file function.
* it is the board name with the layer pair names added, and for separate * it is the board name with the layer pair names added, and for separate
* (PTH and NPTH) files, "-NPH" or "-NPTH" added * (PTH and NPTH) files, "-NPH" or "-NPTH" added
* @param aPair = the layer pair
* @param aNPTH = true to generate the filename of NPTH holes
* @param aMerge_PTH_NPTH = true to generate the filename of a file which containd both
* NPH and NPTH holes
*/ */
virtual const wxString getDrillFileName( DRILL_LAYER_PAIR aPair, bool aNPTH, virtual const wxString getDrillFileName( DRILL_LAYER_PAIR aPair, bool aNPTH,
bool aMerge_PTH_NPTH ) const; bool aMerge_PTH_NPTH ) const;
/** /**
* @return a wxString containing the .FileFunction attribute.
* the standard X2 FileFunction for drill files is
* %TF.FileFunction,Plated[NonPlated],layer1num,layer2num,PTH[NPTH][Blind][Buried],Drill[Route][Mixed]*%
* There is no X1 version, as the Gerber drill files uses only X2 format
* There is a compatible NC drill version.
* @param aLayerPair is the layer pair (Drill from rom first layer to second layer) * @param aLayerPair is the layer pair (Drill from rom first layer to second layer)
* @param aHoleType is type of drill file (PTH, NPTH, mixed) * @param aHoleType is type of drill file (PTH, NPTH, mixed)
* @param aCompatNCdrill is true when generating NC (Excellon) compatible drill file * @param aCompatNCdrill is true when generating NC (Excellon) compatible drill file
* @return a wxString containing the .FileFunction attribute.
* the standard X2 FileFunction for drill files is
* %TF.FileFunction,Plated[NonPlated],layer1num,layer2num,PTH[NPTH][Blind][Buried],
* Drill[Route][Mixed]*%
* There is no X1 version, as the Gerber drill files uses only X2 format
* There is a compatible NC drill version.
*/ */
const wxString BuildFileFunctionAttributeString( DRILL_LAYER_PAIR aLayerPair, const wxString BuildFileFunctionAttributeString( DRILL_LAYER_PAIR aLayerPair,
TYPE_FILE aHoleType, TYPE_FILE aHoleType,
bool aCompatNCdrill = false ) const; bool aCompatNCdrill = false ) const;
protected:
// Use derived classes to build a fully initialized GENDRILL_WRITER_BASE class.
GENDRILL_WRITER_BASE( BOARD* aPcb )
{
m_pcb = aPcb;
m_conversionUnits = 1.0;
m_unitsMetric = true;
m_mapFileFmt = PLOT_FORMAT::PDF;
m_pageInfo = nullptr;
m_merge_PTH_NPTH = false;
m_zeroFormat = DECIMAL_FORMAT;
}
BOARD* m_pcb;
wxString m_drillFileExtension; // .drl or .gbr, depending on format
bool m_unitsMetric; // true = mm, false = inches
ZEROS_FMT m_zeroFormat; // the zero format option for output file
DRILL_PRECISION m_precision; // The current coordinate precision (not
// used in decimal format).
double m_conversionUnits; // scaling factor to convert the board
// unites to Excellon/Gerber units (i.e
// inches or mm)
wxPoint m_offset; // Drill offset coordinates
bool m_merge_PTH_NPTH; // True to generate only one drill file
std::vector<HOLE_INFO> m_holeListBuffer; // Buffer containing holes
std::vector<DRILL_TOOL> m_toolListBuffer; // Buffer containing tools
PLOT_FORMAT m_mapFileFmt; // the format of the map drill file,
// if this map is needed
const PAGE_INFO* m_pageInfo; // the page info used to plot drill maps
// If NULL, use a A4 page format
}; };
#endif // #define GENDRILL_FILE_WRITER_BASE_H #endif // #define GENDRILL_FILE_WRITER_BASE_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 Jean_Pierre Charras <jp.charras at wanadoo.fr> * Copyright (C) 2019 Jean_Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -34,7 +34,7 @@ class FOOTPRINT;
class PAD; class PAD;
/** /**
* PLACEFILE_GERBER_WRITER is a class mainly used to create Gerber drill files * PLACEFILE_GERBER_WRITER is a class mainly used to create Gerber drill files.
*/ */
class PLACEFILE_GERBER_WRITER class PLACEFILE_GERBER_WRITER
{ {
@ -47,10 +47,11 @@ public:
/** /**
* Function SetOptions
* Initialize internal parameters to match drill options * Initialize internal parameters to match drill options
* note: PTH and NPTH are always separate files in Gerber format *
* @param aOffset = drill coordinates offset * @note PTH and NPTH are always separate files in Gerber format.
*
* @param aOffset is the drill coordinates offset.
*/ */
void SetOptions( wxPoint aOffset ) void SetOptions( wxPoint aOffset )
{ {
@ -58,24 +59,40 @@ public:
} }
/** /**
* Creates an pnp gerber file * Create an pnp gerber file.
* @param aFullFilename = the full filename *
* @param aLayer = layer (F_Cu or B_Cu) to generate * @param aFullFilename is the full filename.
* @param aIncludeBrdEdges = true to include board outlines * @param aLayer is the layer (F_Cu or B_Cu) to generate.
* @return component count, or -1 if the file cannot be created * @param aIncludeBrdEdges use true to include board outlines.
* @return component count, or -1 if the file cannot be created.
*/ */
int CreatePlaceFile( wxString& aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges ); int CreatePlaceFile( wxString& aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges );
/** /**
* @return a filename which identify the drill file function.
* @param aFullBaseFilename = a full filename. it will be modified * @param aFullBaseFilename = a full filename. it will be modified
* to add "-pnp" and set the extension * to add "-pnp" and set the extension
* @param aLayer = layer (F_Cu or B_Cu) to generate * @param aLayer = layer (F_Cu or B_Cu) to generate
* @return a filename which identify the drill file function.
*/ */
const wxString GetPlaceFileName( const wxString& aFullBaseFilename, const wxString GetPlaceFileName( const wxString& aFullBaseFilename,
PCB_LAYER_ID aLayer ) const; PCB_LAYER_ID aLayer ) const;
private: private:
/**
* Convert a KiCad footprint orientation to gerber rotation both are in degrees.
*/
double mapRotationAngle( double aAngle );
/**
* Find the pad(s) 1 (or pad "A1") of a footprint.
*
* Useful to plot a marker at this (these) position(s).
*
* @param aPadList is the list to fill.
* @param aFootprint is the footprint to test,
*/
void findPads1( std::vector<PAD*>& aPadList, FOOTPRINT* aFootprint ) const;
BOARD* m_pcb; BOARD* m_pcb;
PCB_LAYER_ID m_layer; // The board layer currently used (typically F_Cu or B_Cu) PCB_LAYER_ID m_layer; // The board layer currently used (typically F_Cu or B_Cu)
wxPoint m_offset; // Drill offset coordinates wxPoint m_offset; // Drill offset coordinates
@ -83,20 +100,6 @@ private:
bool m_plotPad1Marker; // True to plot a flashed marker shape at pad 1 position bool m_plotPad1Marker; // True to plot a flashed marker shape at pad 1 position
bool m_plotOtherPadsMarker; // True to plot a marker shape at other pads position bool m_plotOtherPadsMarker; // True to plot a marker shape at other pads position
// This is a flashed 0 sized round pad // This is a flashed 0 sized round pad
/**
* convert a kicad footprint orientation to gerber rotation
* both are in degrees
*/
double mapRotationAngle( double aAngle );
/**
* Find the pad(s) 1 (or pad "A1") of a footprint
* Usefull to plot a marker at this (these) position(s)
* @param aPadList is the list to fill
* @param aFootprint is the footprint to test
*/
void findPads1( std::vector<PAD*>& aPadList, FOOTPRINT* aFootprint ) const;
}; };
#endif // #ifndef PLACEFILE_GERBER_WRITER_H #endif // #ifndef PLACEFILE_GERBER_WRITER_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -67,24 +67,6 @@ public:
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
private: private:
PCB_BASE_FRAME* m_parent;
std::unique_ptr<GRAPHICS_IMPORTER_PCBNEW> m_importer;
std::unique_ptr<GRAPHICS_IMPORT_MGR> m_gfxImportMgr;
static int m_originUnits;
VECTOR2D m_origin; // This is the offset to add to imported coordinates
// Always in mm
static wxString m_filename;
static bool m_shouldGroupItems;
static bool m_placementInteractive;
static LAYER_NUM m_layer;
double m_lineWidth; // always in mm: line width when a line width
// is not specified
static int m_lineWidthUnits;
static double m_scaleImport; // a scale factor to change the size of imported
// items m_scaleImport =1.0 means keep original size
static int m_dxfUnits;
// Virtual event handlers // Virtual event handlers
void onUnitPositionSelection( wxCommandEvent& event ) override; void onUnitPositionSelection( wxCommandEvent& event ) override;
void onUnitWidthSelection( wxCommandEvent& event ) override; void onUnitWidthSelection( wxCommandEvent& event ) override;
@ -110,6 +92,24 @@ private:
double getPCBdefaultLineWidthMM(); double getPCBdefaultLineWidthMM();
void showPCBdefaultLineWidth(); void showPCBdefaultLineWidth();
void showPcbImportOffsets(); void showPcbImportOffsets();
PCB_BASE_FRAME* m_parent;
std::unique_ptr<GRAPHICS_IMPORTER_PCBNEW> m_importer;
std::unique_ptr<GRAPHICS_IMPORT_MGR> m_gfxImportMgr;
static int m_originUnits;
VECTOR2D m_origin; // This is the offset to add to imported coordinates
// Always in mm
static wxString m_filename;
static bool m_shouldGroupItems;
static bool m_placementInteractive;
static LAYER_NUM m_layer;
double m_lineWidth; // always in mm: line width when a line width
// is not specified
static int m_lineWidthUnits;
static double m_scaleImport; // a scale factor to change the size of imported
// items m_scaleImport =1.0 means keep original size
static int m_dxfUnits;
}; };
#endif // __DIALOG_IMPORT_GFX_H__ #endif // __DIALOG_IMPORT_GFX_H__

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -58,6 +58,28 @@ struct SPLINE_CTRL_POINT
class DXF2BRD_ENTITY_DATA class DXF2BRD_ENTITY_DATA
{ {
public: public:
DXF2BRD_ENTITY_DATA() { Clear(); };
// Reset the entity parameters
void Clear()
{
m_EntityType = DL_UNKNOWN;
m_EntityParseStatus = 0;
m_EntityFlag = 0;
m_SplineDegree = 1;
m_SplineKnotsCount = 0;
m_SplineControlCount = 0;
m_SplineFitCount = 0;
m_SplineTangentStartX = 0.0;
m_SplineTangentStartY = 0.0;
m_SplineTangentEndX = 0.0;
m_SplineTangentEndY = 0.0;
m_BulgeVertex = 0.0;
m_SplineKnotsList.clear();
m_SplineControlPointList.clear();
m_SplineFitPointList.clear();
}
int m_EntityType; // the DXF type of entity int m_EntityType; // the DXF type of entity
int m_EntityParseStatus; // Inside a entity: status of parsing: int m_EntityParseStatus; // Inside a entity: status of parsing:
// 0 = no entity // 0 = no entity
@ -86,28 +108,6 @@ public:
std::vector<SPLINE_CTRL_POINT> m_SplineControlPointList; std::vector<SPLINE_CTRL_POINT> m_SplineControlPointList;
// fit points list, code 11, 21 & 31 (only X and Y cood) // fit points list, code 11, 21 & 31 (only X and Y cood)
std::vector<VECTOR2D> m_SplineFitPointList; std::vector<VECTOR2D> m_SplineFitPointList;
DXF2BRD_ENTITY_DATA() { Clear(); };
// Reset the entity parameters
void Clear()
{
m_EntityType = DL_UNKNOWN;
m_EntityParseStatus = 0;
m_EntityFlag = 0;
m_SplineDegree = 1;
m_SplineKnotsCount = 0;
m_SplineControlCount = 0;
m_SplineFitCount = 0;
m_SplineTangentStartX = 0.0;
m_SplineTangentStartY = 0.0;
m_SplineTangentEndX = 0.0;
m_SplineTangentEndY = 0.0;
m_BulgeVertex = 0.0;
m_SplineKnotsList.clear();
m_SplineControlPointList.clear();
m_SplineFitPointList.clear();
}
}; };
// Magic constants as defined by dxf specification for line weight // Magic constants as defined by dxf specification for line weight
@ -162,7 +162,8 @@ public:
bool m_bold; bool m_bold;
bool m_italic; bool m_italic;
DXF_IMPORT_STYLE( wxString aName, double aTextHeight, double aWidthFactor, bool aBold, bool aItalic ) DXF_IMPORT_STYLE( wxString aName, double aTextHeight, double aWidthFactor, bool aBold,
bool aItalic )
{ {
m_name = aName; m_name = aName;
m_textHeight = aTextHeight; m_textHeight = aTextHeight;
@ -222,31 +223,6 @@ struct DXF_ARBITRARY_AXIS
class DXF_IMPORT_PLUGIN : public GRAPHICS_IMPORT_PLUGIN, public DL_CreationAdapter class DXF_IMPORT_PLUGIN : public GRAPHICS_IMPORT_PLUGIN, public DL_CreationAdapter
{ {
private:
double m_xOffset; // X coord offset for conversion (in mm)
double m_yOffset; // Y coord offset for conversion (in mm)
double m_defaultThickness; // default line thickness for conversion (in mm)
int m_brdLayer; // The board layer to place imported DXF items
int m_version; // the dxf version, not used here
std::string m_codePage; // The code page, not used here
bool m_importAsFPShapes; // Use footprint items instead of board items when true.
// true when the items are imported in the footprint editor
wxString m_messages; // messages generated during dxf file parsing.
// Each message ends by '\n'
DXF2BRD_ENTITY_DATA m_curr_entity; // the current entity parameters when parsing a DXF entity
double m_minX, m_maxX; // handles image size in mm
double m_minY, m_maxY; // handles image size in mm
DXF_IMPORT_UNITS m_currentUnit; // current unit during import
GRAPHICS_IMPORTER_BUFFER m_internalImporter;
std::vector<std::unique_ptr<DXF_IMPORT_LAYER>> m_layers; // List of layers as we import, used just to grab props for objects
std::vector<std::unique_ptr<DXF_IMPORT_BLOCK>> m_blocks; // List of blocks as we import
std::vector<std::unique_ptr<DXF_IMPORT_STYLE>> m_styles; // List of blocks as we import
DXF_IMPORT_BLOCK* m_currentBlock;
public: public:
DXF_IMPORT_PLUGIN(); DXF_IMPORT_PLUGIN();
~DXF_IMPORT_PLUGIN(); ~DXF_IMPORT_PLUGIN();
@ -273,9 +249,10 @@ public:
virtual void SetImporter( GRAPHICS_IMPORTER* aImporter ) override; virtual void SetImporter( GRAPHICS_IMPORTER* aImporter ) override;
/** /**
* Allows the import DXF items converted to board graphic items or footprint * Allow the import DXF items converted to board graphic items or footprint graphic items.
* graphic items. *
* @param aImportAsFootprintGraphic = true to import in a footprint, false to import on a board * @param aImportAsFootprintGraphic use true to import in a footprint or false to import on
* a board.
*/ */
void ImportAsFootprintGraphic( bool aImportAsFootprintGraphic ) void ImportAsFootprintGraphic( bool aImportAsFootprintGraphic )
{ {
@ -283,9 +260,11 @@ public:
} }
/** /**
* Set the default units when importing DXFs * Set the default units when importing DXFs.
* DXFs can lack units by design which requires the importing software to make the decision *
* @param aUnits is the default unit of the DXF to assume * DXFs can lack units by design which requires the importing software to make the decision.
*
* @param aUnits is the default unit of the DXF to assume.
*/ */
void SetUnit( DXF_IMPORT_UNITS aUnit ) void SetUnit( DXF_IMPORT_UNITS aUnit )
{ {
@ -294,9 +273,11 @@ public:
/** /**
* Set the default line width when importing dxf items like lines to Pcbnew. * Set the default line width when importing dxf items like lines to Pcbnew.
* because dxf files have no line width explicit parameter, it will be most *
* of time the line width of imported lines * DXF files have no line width explicit parameter, it will be most of time the line width
* @param aWidth = line width in mm * of imported lines.
*f
* @param aWidth is the line width in mm.
*/ */
void SetDefaultLineWidthMM( double aWidth ) void SetDefaultLineWidthMM( double aWidth )
{ {
@ -307,10 +288,12 @@ public:
/** /**
* Set the coordinate offset between the imported dxf items and Pcbnew. * Set the coordinate offset between the imported dxf items and Pcbnew.
* because dxf files have the Y axis from bottom to top; *
* aOffsetX = 0, and aOffsetY = - vertical page size to import a full page * DXF files have the Y axis from bottom to top aOffsetX = 0, and aOffsetY = - vertical
* @param aOffsetX = the X offset in mm * page size to import a full page.
* @param aOffsetY = the Y offset in mm *
* @param aOffsetX is the X offset in mm.
* @param aOffsetY is the Y offset in mm.
*/ */
void SetOffset( double aOffsetX, double aOffsetY ) void SetOffset( double aOffsetX, double aOffsetY )
{ {
@ -320,15 +303,15 @@ public:
/** /**
* Set the layer number to import dxf items. * Set the layer number to import dxf items.
* the layer should be a technical layer, not a copper layer *
* The layer should be a technical layer, not a copper layer.
*/ */
void SetBrdLayer( int aBrdLayer ) { m_brdLayer = aBrdLayer; } void SetBrdLayer( int aBrdLayer ) { m_brdLayer = aBrdLayer; }
/** /**
* Implementation of the method used for communicate * Implementation of the method used for communicate with this filter.
* with this filter.
* *
* @param aFile = the full filename. * @param aFile is the full filename.
*/ */
bool ImportDxfFile( const wxString& aFile ); bool ImportDxfFile( const wxString& aFile );
@ -353,45 +336,48 @@ private:
DXF_ARBITRARY_AXIS getArbitraryAxis( DL_Extrusion* aData ); DXF_ARBITRARY_AXIS getArbitraryAxis( DL_Extrusion* aData );
/*** /**
* Converts a given world coordinate point to object coordinate using the given arbitrary axis vectors * Converts a given world coordinate point to object coordinate using the given arbitrary
* axis vectors.
*/ */
VECTOR3D wcsToOcs( const DXF_ARBITRARY_AXIS& arbitraryAxis, VECTOR3D point ); VECTOR3D wcsToOcs( const DXF_ARBITRARY_AXIS& arbitraryAxis, VECTOR3D point );
/*** /**
* Converts a given object coordinate point to world coordinate using the given arbitrary axis vectors * Converts a given object coordinate point to world coordinate using the given arbitrary
* axis vectors.
*/ */
VECTOR3D ocsToWcs( const DXF_ARBITRARY_AXIS& arbitraryAxis, VECTOR3D point ); VECTOR3D ocsToWcs( const DXF_ARBITRARY_AXIS& arbitraryAxis, VECTOR3D point );
/** /**
* Returns the import layer data * Return the import layer data.
* *
* @param aLayerName is the raw string from dxflib getLayer() * @param aLayerName is the raw string from dxflib getLayer().
* @returns The given layer by name or the placeholder layer inserted in the constructor * @returns The given layer by name or the placeholder layer inserted in the constructor.
*/ */
DXF_IMPORT_LAYER* getImportLayer( const std::string& aLayerName ); DXF_IMPORT_LAYER* getImportLayer( const std::string& aLayerName );
/** /**
* Returns the import layer block * Return the import layer block.
* *
* @param aBlockName is the raw string from dxflib * @param aBlockName is the raw string from dxflib.
* @returns The given block by name or nullptr if not found * @return The given block by name or nullptr if not found.
*/ */
DXF_IMPORT_BLOCK* getImportBlock( const std::string& aBlockName ); DXF_IMPORT_BLOCK* getImportBlock( const std::string& aBlockName );
/** /**
* Returns the import style * Return the import style.
* *
* @param aStyleName is the raw string from dxflib * @param aStyleName is the raw string from dxflib.
* @returns The given style by name or nullptr if not found * @return The given style by name or nullptr if not found.
*/ */
DXF_IMPORT_STYLE* getImportStyle( const std::string& aStyleName ); DXF_IMPORT_STYLE* getImportStyle( const std::string& aStyleName );
// Functions to aid in the creation of a Polyline // Functions to aid in the creation of a Polyline.
void insertLine( const VECTOR2D& aSegStart, const VECTOR2D& aSegEnd, int aWidth ); void insertLine( const VECTOR2D& aSegStart, const VECTOR2D& aSegEnd, int aWidth );
void insertArc( const VECTOR2D& aSegStart, const VECTOR2D& aSegEnd, void insertArc( const VECTOR2D& aSegStart, const VECTOR2D& aSegEnd,
double aBulge, int aWidth ); double aBulge, int aWidth );
// Add a dxf spline (stored in m_curr_entity) to the board, after conversion to segments
// Add a dxf spline (stored in m_curr_entity) to the board, after conversion to segments.
void insertSpline( int aWidth ); void insertSpline( int aWidth );
// Methods from DL_CreationAdapter: // Methods from DL_CreationAdapter:
@ -402,7 +388,7 @@ private:
* Called for every string variable in the DXF file (e.g. "$ACADVER"). * Called for every string variable in the DXF file (e.g. "$ACADVER").
*/ */
virtual void setVariableString( const std::string& key, const std::string& value, virtual void setVariableString( const std::string& key, const std::string& value,
int code ) override; int code ) override;
/** /**
* Called for every int variable in the DXF file (e.g. "$ACADMAINTVER"). * Called for every int variable in the DXF file (e.g. "$ACADMAINTVER").
@ -419,7 +405,8 @@ private:
virtual void addLinetype( const DL_LinetypeData& data ) override; virtual void addLinetype( const DL_LinetypeData& data ) override;
/** /**
* Called for each BLOCK in the DXF file * Called for each BLOCK in the DXF file.
*
* These are re-usable elements that may be placed into the model space. The elements * These are re-usable elements that may be placed into the model space. The elements
* are dereferenced to the model, so we just need to skip the re-parsing for the block * are dereferenced to the model, so we just need to skip the re-parsing for the block
* elements. * elements.
@ -436,23 +423,33 @@ private:
/* Inserts blocks where specified by insert data */ /* Inserts blocks where specified by insert data */
virtual void addInsert( const DL_InsertData& aData ) override; virtual void addInsert( const DL_InsertData& aData ) override;
/** Called for every polyline vertex */ /**
* Called for every polyline vertex.
*/
virtual void addVertex( const DL_VertexData& aData ) override; virtual void addVertex( const DL_VertexData& aData ) override;
virtual void addMText( const DL_MTextData& aData) override; virtual void addMText( const DL_MTextData& aData) override;
virtual void addTextStyle( const DL_StyleData& aData ) override; virtual void addTextStyle( const DL_StyleData& aData ) override;
virtual void endEntity() override; virtual void endEntity() override;
/** Called for every spline */ /**
* Called for every spline.
* */
virtual void addSpline( const DL_SplineData& aData ) override; virtual void addSpline( const DL_SplineData& aData ) override;
/** Called for every spline control point */ /**
* Called for every spline control point.
*/
virtual void addControlPoint( const DL_ControlPointData& aData ) override; virtual void addControlPoint( const DL_ControlPointData& aData ) override;
/** Called for every spline fit point */ /**
* Called for every spline fit point.
*/
virtual void addFitPoint( const DL_FitPointData& aData ) override; virtual void addFitPoint( const DL_FitPointData& aData ) override;
/** Called for every spline knot value */ /**
* Called for every spline knot value.
*/
virtual void addKnot( const DL_KnotData& aData ) override; virtual void addKnot( const DL_KnotData& aData ) override;
// Not yet handled DXF entities: // Not yet handled DXF entities:
@ -497,23 +494,38 @@ private:
virtual void addImage( const DL_ImageData& ) override { ON_UNSUPPORTED( "addImage" ); } virtual void addImage( const DL_ImageData& ) override { ON_UNSUPPORTED( "addImage" ); }
virtual void linkImage( const DL_ImageDefData& ) override {} virtual void linkImage( const DL_ImageDefData& ) override {}
virtual void addHatchLoop( const DL_HatchLoopData& ) override { ON_UNSUPPORTED( "addHatchLoop" ); } virtual void addHatchLoop( const DL_HatchLoopData& ) override
{
ON_UNSUPPORTED( "addHatchLoop" );
}
virtual void addHatchEdge( const DL_HatchEdgeData& ) override { ON_UNSUPPORTED( "addHatchEdge" ); } virtual void addHatchEdge( const DL_HatchEdgeData& ) override
{
ON_UNSUPPORTED( "addHatchEdge" );
}
virtual void addXRecord( const std::string& ) override { ON_UNSUPPORTED( "addXRecord" ); } virtual void addXRecord( const std::string& ) override { ON_UNSUPPORTED( "addXRecord" ); }
virtual void addXRecordString( int, const std::string& ) override { ON_UNSUPPORTED( "addXRecordString" ); }
virtual void addXRecordString( int, const std::string& ) override
{
ON_UNSUPPORTED( "addXRecordString" );
}
virtual void addXRecordReal( int, double ) override { ON_UNSUPPORTED( "addXRecordReal" ); } virtual void addXRecordReal( int, double ) override { ON_UNSUPPORTED( "addXRecordReal" ); }
virtual void addXRecordInt( int, int ) override { ON_UNSUPPORTED( "addXRecordInt" ); } virtual void addXRecordInt( int, int ) override { ON_UNSUPPORTED( "addXRecordInt" ); }
virtual void addXRecordBool( int, bool ) override { ON_UNSUPPORTED( "addXRecordBool" ); } virtual void addXRecordBool( int, bool ) override { ON_UNSUPPORTED( "addXRecordBool" ); }
virtual void addXDataApp( const std::string& ) override { ON_UNSUPPORTED( "addXDataApp" ); } virtual void addXDataApp( const std::string& ) override { ON_UNSUPPORTED( "addXDataApp" ); }
virtual void addXDataString( int, const std::string& ) override { ON_UNSUPPORTED( "addXDataString" ); } virtual void addXDataString( int, const std::string& ) override
{
ON_UNSUPPORTED( "addXDataString" );
}
virtual void addXDataReal( int, double ) override { ON_UNSUPPORTED( "addXDataReal" ); } virtual void addXDataReal( int, double ) override { ON_UNSUPPORTED( "addXDataReal" ); }
virtual void addXDataInt( int, int ) override { ON_UNSUPPORTED( "addXDataInt" ); } virtual void addXDataInt( int, int ) override { ON_UNSUPPORTED( "addXDataInt" ); }
/** /**
* Convert a native unicode string into a DXF encoded string. * Convert a native Unicode string into a DXF encoded string.
* *
* DXF encoding includes the following special sequences: * DXF encoding includes the following special sequences:
* - %%%c for a diameter sign * - %%%c for a diameter sign
@ -523,12 +535,38 @@ private:
static wxString toDxfString( const wxString& aStr ); static wxString toDxfString( const wxString& aStr );
/** /**
* Converts a DXF encoded string into a native Unicode string. * Convert a DXF encoded string into a native Unicode string.
*/ */
static wxString toNativeString( const wxString& aData ); static wxString toNativeString( const wxString& aData );
void writeLine(); void writeLine();
void writeMtext(); void writeMtext();
private:
double m_xOffset; // X coord offset for conversion (in mm)
double m_yOffset; // Y coord offset for conversion (in mm)
double m_defaultThickness; // default line thickness for conversion (in mm)
int m_brdLayer; // The board layer to place imported DXF items
int m_version; // the dxf version, not used here
std::string m_codePage; // The code page, not used here
bool m_importAsFPShapes; // Use footprint items instead of board items when true.
// true when the items are imported in the footprint editor
wxString m_messages; // messages generated during dxf file parsing.
// Each message ends by '\n'
DXF2BRD_ENTITY_DATA m_curr_entity; // the current entity parameters when parsing a DXF entity
double m_minX, m_maxX; // handles image size in mm
double m_minY, m_maxY; // handles image size in mm
DXF_IMPORT_UNITS m_currentUnit; // current unit during import
GRAPHICS_IMPORTER_BUFFER m_internalImporter;
// List of layers as we import, used just to grab props for objects.
std::vector<std::unique_ptr<DXF_IMPORT_LAYER>> m_layers;
std::vector<std::unique_ptr<DXF_IMPORT_BLOCK>> m_blocks; // List of blocks as we import
std::vector<std::unique_ptr<DXF_IMPORT_STYLE>> m_styles; // List of blocks as we import
DXF_IMPORT_BLOCK* m_currentBlock;
}; };
#endif // DXF2BRD_ITEMS_H #endif // DXF2BRD_ITEMS_H

View File

@ -255,6 +255,12 @@ protected:
m_items.emplace_back( std::move( aItem ) ); m_items.emplace_back( std::move( aItem ) );
} }
///< factor to convert millimeters to Internal Units
double m_millimeterToIu;
///< Offset (in mm) for imported coordinates
VECTOR2D m_offsetCoordmm;
private: private:
///< List of imported items ///< List of imported items
std::list<std::unique_ptr<EDA_ITEM>> m_items; std::list<std::unique_ptr<EDA_ITEM>> m_items;
@ -277,13 +283,6 @@ private:
///< Default line thickness for the imported graphics ///< Default line thickness for the imported graphics
double m_lineWidth; double m_lineWidth;
protected:
///< factor to convert millimeters to Internal Units
double m_millimeterToIu;
///< Offset (in mm) for imported coordinates
VECTOR2D m_offsetCoordmm;
}; };
#endif /* GRAPHICS_IMPORTER_H */ #endif /* GRAPHICS_IMPORTER_H */

View File

@ -10,7 +10,7 @@
* *
* Copyright (C) 2012 Jean-Pierre Charras. * Copyright (C) 2012 Jean-Pierre Charras.
* Copyright (C) 2013-2017 Wayne Stambaugh <stambaughw@gmail.com>. * Copyright (C) 2013-2017 Wayne Stambaugh <stambaughw@gmail.com>.
* Copyright (C) 2012-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2012-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -43,16 +43,12 @@ class COMPONENT;
/** /**
* CMP_READER * Read a component footprint link file (*.cmp) format.
* reads a component footprint link file (*.cmp) format.
*/ */
class CMP_READER class CMP_READER
{ {
LINE_READER* m_lineReader; ///< The line reader to read.
public: public:
/** /**
* CMP_READER constructor.
* @param aLineReader is a LINE_READER (in fact a FILE_LINE_READER) * @param aLineReader is a LINE_READER (in fact a FILE_LINE_READER)
* which is owned by me ( and deleted by me) to read * which is owned by me ( and deleted by me) to read
* the component footprint link file. * the component footprint link file.
@ -67,21 +63,14 @@ public:
if( m_lineReader ) if( m_lineReader )
{ {
delete m_lineReader; delete m_lineReader;
m_lineReader = NULL; m_lineReader = nullptr;
} }
} }
/** /**
* Function Load * Read the *.cmp file format contains the component footprint assignments created by CvPcb
* read the *.cmp file format contains the component footprint assignments created by CvPcb
* into \a aNetlist. * into \a aNetlist.
* *
* @param aNetlist is the #NETLIST to read into.
*
* @todo At some point in the future, use the footprint field in the new s-expression
* netlist file to assign a footprint to a component instead of using a secondary
* (*.cmp) file.
*
* Sample file footprint assignment entry: * Sample file footprint assignment entry:
* *
* Cmp-Mod V01 Genere by CvPcb 29/10/2003-13: 11:6 * * Cmp-Mod V01 Genere by CvPcb 29/10/2003-13: 11:6 *
@ -92,6 +81,11 @@ public:
* IdModule = CP6; * IdModule = CP6;
* EndCmp * EndCmp
* *
* @todo At some point in the future, use the footprint field in the new s-expression
* netlist file to assign a footprint to a component instead of using a secondary
* (*.cmp) file.
*
* @param aNetlist is the #NETLIST to read into.
* @throw IO_ERROR if a the #LINE_READER IO error occurs. * @throw IO_ERROR if a the #LINE_READER IO error occurs.
* @throw PARSE_ERROR if an error occurs while parsing the file. * @throw PARSE_ERROR if an error occurs while parsing the file.
* @return true if OK, false if a component reference found in the * @return true if OK, false if a component reference found in the
@ -100,12 +94,14 @@ public:
* print a warning in Pcbnew. * print a warning in Pcbnew.
*/ */
bool Load( NETLIST* aNetlist ); bool Load( NETLIST* aNetlist );
private:
LINE_READER* m_lineReader; ///< The line reader to read.
}; };
/** /**
* NETLIST_READER * A pure virtual class to derive a specific type of netlist reader from.
* is a pure virtual class to derive a specific type of netlist reader from.
*/ */
class NETLIST_READER class NETLIST_READER
{ {
@ -123,18 +119,16 @@ public:
// function. // function.
}; };
/** /**
* Constructor
* @param aLineReader ownership is taken of this #LINE_READER. * @param aLineReader ownership is taken of this #LINE_READER.
* @param aNetlist the #NETLIST object to read into. * @param aNetlist the #NETLIST object to read into.
* @param aFootprintLinkReader ownership is taken of this #CMP_READER. * @param aFootprintLinkReader ownership is taken of this #CMP_READER.
*/ */
NETLIST_READER( LINE_READER* aLineReader, NETLIST_READER( LINE_READER* aLineReader,
NETLIST* aNetlist, NETLIST* aNetlist,
CMP_READER* aFootprintLinkReader = NULL ) CMP_READER* aFootprintLinkReader = nullptr )
{ {
wxASSERT( aLineReader != NULL ); wxASSERT( aLineReader != nullptr );
m_lineReader = aLineReader; m_lineReader = aLineReader;
m_footprintReader = aFootprintLinkReader; m_footprintReader = aFootprintLinkReader;
@ -146,8 +140,7 @@ public:
virtual ~NETLIST_READER(); virtual ~NETLIST_READER();
/** /**
* Function GuessNetlistFileType * Look at \a aFileHeaderLine to see if it matches any of the netlist file types it
* looks at \a aFileHeaderLine to see if it matches any of the netlist file types it
* knows about. * knows about.
* *
* @param aLineReader is the #LINE_READER object containing lines from the netlist to test. * @param aLineReader is the #LINE_READER object containing lines from the netlist to test.
@ -156,8 +149,7 @@ public:
static NETLIST_FILE_T GuessNetlistFileType( LINE_READER* aLineReader ); static NETLIST_FILE_T GuessNetlistFileType( LINE_READER* aLineReader );
/** /**
* Function GetNetlistReader * Attempt to determine the net list file type of \a aNetlistFileName and return the
* attempts to determine the net list file type of \a aNetlistFileName and return the
* appropriate NETLIST_READER type. * appropriate NETLIST_READER type.
* *
* @param aNetlist is the netlist to load \a aNetlistFileName into. * @param aNetlist is the netlist to load \a aNetlistFileName into.
@ -173,8 +165,7 @@ public:
const wxString& aCompFootprintFileName = wxEmptyString ); const wxString& aCompFootprintFileName = wxEmptyString );
/** /**
* Function LoadNetlist * Load the contents of the netlist file into \a aNetlist.
* loads the contents of the netlist file into \a aNetlist.
* *
* @throw IO_ERROR if a file IO error occurs. * @throw IO_ERROR if a file IO error occurs.
* @throw PARSE_ERROR if an error occurs while parsing the file. * @throw PARSE_ERROR if an error occurs while parsing the file.
@ -182,7 +173,6 @@ public:
virtual void LoadNetlist() = 0; virtual void LoadNetlist() = 0;
/** /**
* Function GetLineReader()
* @return the #LINE_READER associated with the #NETLIST_READER. * @return the #LINE_READER associated with the #NETLIST_READER.
*/ */
LINE_READER* GetLineReader(); LINE_READER* GetLineReader();
@ -199,8 +189,7 @@ protected:
/** /**
* LEGACY_NETLIST_READER * Read the KiCad legacy and the old Orcad netlist formats.
* reads the KiCad legacy and the old Orcad netlist formats.
* *
* The KiCad legacy netlist format was derived directly from an old Orcad netlist format. The * The KiCad legacy netlist format was derived directly from an old Orcad netlist format. The
* primary difference is the header was changed so this reader can read both formats. * primary difference is the header was changed so this reader can read both formats.
@ -208,22 +197,20 @@ protected:
class LEGACY_NETLIST_READER : public NETLIST_READER class LEGACY_NETLIST_READER : public NETLIST_READER
{ {
/** /**
* Function loadSymbol * Read the \a aLine containing the description of a component from a legacy format
* read the \a aLine containing the description of a component from a legacy format
* netlist and add it to the netlist. * netlist and add it to the netlist.
* *
* Analyze the first line of a component description in netlist: * Analyze the first line of a component description in netlist:
* ( /40C08647 $noname R20 4.7K {Lib=R} * ( /40C08647 $noname R20 4.7K {Lib=R}
* *
* @param aText contains the first line of description * @param aText contains the first line of description.
* @return the new component created by parsing \a aLine * @return the new component created by parsing \a aLine.
* @throw PARSE_ERROR when \a aLine is not a valid component description. * @throw PARSE_ERROR when \a aLine is not a valid component description.
*/ */
COMPONENT* loadComponent( char* aText ); COMPONENT* loadComponent( char* aText );
/** /**
* Function loadFootprintFilters * Load the footprint filter section of netlist file.
* loads the footprint filter section of netlist file.
* *
* Sample legacy footprint filter section: * Sample legacy footprint filter section:
* { Allowed footprints by component: * { Allowed footprints by component:
@ -256,14 +243,13 @@ public:
LEGACY_NETLIST_READER( LINE_READER* aLineReader, LEGACY_NETLIST_READER( LINE_READER* aLineReader,
NETLIST* aNetlist, NETLIST* aNetlist,
CMP_READER* aFootprintLinkReader = NULL ) : CMP_READER* aFootprintLinkReader = nullptr ) :
NETLIST_READER( aLineReader, aNetlist, aFootprintLinkReader ) NETLIST_READER( aLineReader, aNetlist, aFootprintLinkReader )
{ {
} }
/** /**
* Function LoadNetlist * Read the netlist file in the legacy format into \a aNetlist.
* read the netlist file in the legacy format into \a aNetlist.
* *
* The legacy netlist format is: * The legacy netlist format is:
* \# EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22 * \# EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22
@ -287,26 +273,38 @@ public:
/** /**
* KICAD_NETLIST_PARSER * The parser for reading the KiCad s-expression netlist format.
* is the parser for reading the KiCad s-expression netlist format.
*/ */
class KICAD_NETLIST_PARSER : public NETLIST_LEXER class KICAD_NETLIST_PARSER : public NETLIST_LEXER
{ {
private: public:
NL_T::T token; KICAD_NETLIST_PARSER( LINE_READER* aReader, NETLIST* aNetlist );
LINE_READER* m_lineReader; ///< The line reader used to parse the netlist. Not owned.
NETLIST* m_netlist; ///< The netlist to parse into. Not owned. void SetLineReader( LINE_READER* aLineReader );
void SetNetlist( NETLIST* aNetlist ) { m_netlist = aNetlist; }
/** /**
* Function skipCurrent * Function Parse
* parse the full netlist
*/
void Parse();
// Useful for debug only:
const char* getTokenName( NL_T::T aTok )
{
return NETLIST_LEXER::TokenName( aTok );
}
private:
/**
* Skip the current token level, i.e * Skip the current token level, i.e
* search for the RIGHT parenthesis which closes the current description * search for the RIGHT parenthesis which closes the current description.
*/ */
void skipCurrent(); void skipCurrent();
/** /**
* Function parseComponent * Parse a component description:
* parse a component description:
* (comp (ref P1) * (comp (ref P1)
* (value DB25FEMELLE) * (value DB25FEMELLE)
* (footprint DB25FC) * (footprint DB25FC)
@ -318,8 +316,7 @@ private:
void parseComponent(); void parseComponent();
/** /**
* Function parseNet * Parse a net section
* Parses a section like
* (net (code 20) (name /PC-A0) * (net (code 20) (name /PC-A0)
* (node (ref BUS1) (pin 62)) * (node (ref BUS1) (pin 62))
* (node (ref U3) (pin 3)) * (node (ref U3) (pin 3))
@ -330,8 +327,7 @@ private:
void parseNet(); void parseNet();
/** /**
* Function parseLibPartList * Read the section "libparts" in the netlist:
* reads the section "libparts" in the netlist:
* (libparts * (libparts
* (libpart (lib device) (part C) * (libpart (lib device) (part C)
* (description "Condensateur non polarise") * (description "Condensateur non polarise")
@ -353,40 +349,21 @@ private:
*/ */
void parseLibPartList(); void parseLibPartList();
NL_T::T token;
public: LINE_READER* m_lineReader; ///< The line reader used to parse the netlist. Not owned.
KICAD_NETLIST_PARSER( LINE_READER* aReader, NETLIST* aNetlist ); NETLIST* m_netlist; ///< The netlist to parse into. Not owned.
void SetLineReader( LINE_READER* aLineReader );
void SetNetlist( NETLIST* aNetlist ) { m_netlist = aNetlist; }
/**
* Function Parse
* parse the full netlist
*/
void Parse();
// Useful for debug only:
const char* getTokenName( NL_T::T aTok )
{
return NETLIST_LEXER::TokenName( aTok );
}
}; };
/** /**
* KICAD_NETLIST_READER * Read the new s-expression based KiCad netlist format.
* read the new s-expression based KiCad netlist format.
*/ */
class KICAD_NETLIST_READER : public NETLIST_READER class KICAD_NETLIST_READER : public NETLIST_READER
{ {
KICAD_NETLIST_PARSER* m_parser; ///< The s-expression format parser.
public: public:
KICAD_NETLIST_READER( LINE_READER* aLineReader, KICAD_NETLIST_READER( LINE_READER* aLineReader,
NETLIST* aNetlist, NETLIST* aNetlist,
CMP_READER* aFootprintLinkReader = NULL ) : CMP_READER* aFootprintLinkReader = nullptr ) :
NETLIST_READER( aLineReader, aNetlist, aFootprintLinkReader ), NETLIST_READER( aLineReader, aNetlist, aFootprintLinkReader ),
m_parser( new KICAD_NETLIST_PARSER( aLineReader, aNetlist ) ) m_parser( new KICAD_NETLIST_PARSER( aLineReader, aNetlist ) )
{ {
@ -398,6 +375,9 @@ public:
} }
virtual void LoadNetlist() override; virtual void LoadNetlist() override;
private:
KICAD_NETLIST_PARSER* m_parser; ///< The s-expression format parser.
}; };

View File

@ -42,11 +42,6 @@ class REPORTER;
*/ */
class COMPONENT_NET class COMPONENT_NET
{ {
wxString m_pinName;
wxString m_netName;
wxString m_pinFunction;
wxString m_pinType;
public: public:
COMPONENT_NET() {} COMPONENT_NET() {}
@ -72,6 +67,12 @@ public:
} }
int Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl ); int Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl );
private:
wxString m_pinName;
wxString m_netName;
wxString m_pinFunction;
wxString m_pinType;
}; };
@ -227,7 +228,7 @@ public:
unsigned GetCount() const { return m_components.size(); } unsigned GetCount() const { return m_components.size(); }
/** /**
* Returns the #COMPONENT at \a aIndex. * Return the #COMPONENT at \a aIndex.
* *
* @param aIndex the index in #m_components to fetch. * @param aIndex the index in #m_components to fetch.
* @return a pointer to the #COMPONENT at \a Index. * @return a pointer to the #COMPONENT at \a Index.