2019-09-15 15:08:57 +00:00
|
|
|
/*
|
|
|
|
* 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) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file gerber_placefile_writer.h
|
|
|
|
* @brief Classes used in place file generation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLACEFILE_GERBER_WRITER_H
|
|
|
|
#define PLACEFILE_GERBER_WRITER_H
|
|
|
|
|
|
|
|
#include <layers_id_colors_and_visibility.h>
|
|
|
|
|
|
|
|
class BOARD;
|
|
|
|
class MODULE;
|
|
|
|
class D_PAD;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PLACEFILE_GERBER_WRITER is a class mainly used to create Gerber drill files
|
|
|
|
*/
|
|
|
|
class PLACEFILE_GERBER_WRITER
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PLACEFILE_GERBER_WRITER( BOARD* aPcb );
|
|
|
|
|
|
|
|
virtual ~PLACEFILE_GERBER_WRITER()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetOptions
|
|
|
|
* Initialize internal parameters to match drill options
|
|
|
|
* note: PTH and NPTH are always separate files in Gerber format
|
|
|
|
* @param aOffset = drill coordinates offset
|
|
|
|
*/
|
|
|
|
void SetOptions( wxPoint aOffset )
|
|
|
|
{
|
|
|
|
m_offset = aOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates an pnp gerber file
|
|
|
|
* @param aFullFilename = the full filename
|
|
|
|
* @param aLayer = layer (F_Cu or B_Cu) to generate
|
2019-11-01 12:35:42 +00:00
|
|
|
* @param aIncludeBrdEdges = true to include board outlines
|
2019-09-15 15:08:57 +00:00
|
|
|
* @return component count, or -1 if the file cannot be created
|
|
|
|
*/
|
2019-11-17 09:11:29 +00:00
|
|
|
int CreatePlaceFile( wxString& aFullFilename, PCB_LAYER_ID aLayer,
|
|
|
|
bool aIncludeBrdEdges );
|
2019-09-15 15:08:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return a filename which identify the drill file function.
|
|
|
|
* @param aFullBaseFilename = a full filename. it will be modified
|
|
|
|
* to add "-pnp" and set the extension
|
|
|
|
* @param aLayer = layer (F_Cu or B_Cu) to generate
|
|
|
|
*/
|
|
|
|
const wxString GetPlaceFileName( const wxString& aFullBaseFilename,
|
|
|
|
PCB_LAYER_ID aLayer ) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
BOARD* m_pcb;
|
|
|
|
/// The board layer currently used (typically F_Cu or B_Cu)
|
|
|
|
PCB_LAYER_ID m_layer;
|
|
|
|
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_forceSmdItems;
|
|
|
|
// True to plot a flashed marker shape at pad 1 position
|
|
|
|
bool m_plotPad1Marker;
|
|
|
|
// True to plot a marker shape at other pads position
|
|
|
|
// This is a flashed 0 sized round pad
|
|
|
|
bool m_plotOtherPadsMarker;
|
|
|
|
|
|
|
|
|
|
|
|
/** convert a kicad footprint orientation to gerber rotation
|
|
|
|
* both are in degrees
|
|
|
|
*/
|
|
|
|
double mapRotationAngle( double aAngle );
|
|
|
|
|
2019-10-06 11:39:50 +00:00
|
|
|
/** 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
|
2019-09-15 15:08:57 +00:00
|
|
|
*/
|
2019-10-06 11:39:50 +00:00
|
|
|
void findPads1( std::vector<D_PAD*>& aPadList, MODULE* aFootprint ) const;
|
2019-09-15 15:08:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // #ifndef PLACEFILE_GERBER_WRITER_H
|