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>
|
2021-06-04 17:44:22 +00:00
|
|
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2019-09-15 15:08:57 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2020-10-03 12:01:59 +00:00
|
|
|
#include <wx/gdicmn.h>
|
2019-09-15 15:08:57 +00:00
|
|
|
|
|
|
|
class BOARD;
|
2020-11-13 15:15:52 +00:00
|
|
|
class FOOTPRINT;
|
2020-11-12 22:30:02 +00:00
|
|
|
class PAD;
|
2019-09-15 15:08:57 +00:00
|
|
|
|
|
|
|
/**
|
2021-07-26 19:35:12 +00:00
|
|
|
* Used to create Gerber drill files.
|
2019-09-15 15:08:57 +00:00
|
|
|
*/
|
|
|
|
class PLACEFILE_GERBER_WRITER
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PLACEFILE_GERBER_WRITER( BOARD* aPcb );
|
|
|
|
|
|
|
|
virtual ~PLACEFILE_GERBER_WRITER()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize internal parameters to match drill options
|
2021-06-04 17:44:22 +00:00
|
|
|
*
|
|
|
|
* @note PTH and NPTH are always separate files in Gerber format.
|
|
|
|
*
|
|
|
|
* @param aOffset is the drill coordinates offset.
|
2019-09-15 15:08:57 +00:00
|
|
|
*/
|
2021-07-26 19:35:12 +00:00
|
|
|
void SetOptions( const wxPoint& aOffset )
|
2019-09-15 15:08:57 +00:00
|
|
|
{
|
|
|
|
m_offset = aOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-06-04 17:44:22 +00:00
|
|
|
* Create an pnp gerber file.
|
|
|
|
*
|
|
|
|
* @param aFullFilename is the full filename.
|
|
|
|
* @param aLayer is the layer (F_Cu or B_Cu) to generate.
|
|
|
|
* @param aIncludeBrdEdges use true to include board outlines.
|
|
|
|
* @return component count, or -1 if the file cannot be created.
|
2019-09-15 15:08:57 +00:00
|
|
|
*/
|
2020-11-16 00:04:55 +00:00
|
|
|
int CreatePlaceFile( wxString& aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges );
|
2019-09-15 15:08:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
2021-06-04 17:44:22 +00:00
|
|
|
* @return a filename which identify the drill file function.
|
2019-09-15 15:08:57 +00:00
|
|
|
*/
|
|
|
|
const wxString GetPlaceFileName( const wxString& aFullBaseFilename,
|
|
|
|
PCB_LAYER_ID aLayer ) const;
|
|
|
|
|
|
|
|
private:
|
2020-11-16 00:04:55 +00:00
|
|
|
/**
|
2021-06-04 17:44:22 +00:00
|
|
|
* Convert a KiCad footprint orientation to gerber rotation both are in degrees.
|
2019-09-15 15:08:57 +00:00
|
|
|
*/
|
2020-11-16 00:04:55 +00:00
|
|
|
double mapRotationAngle( double aAngle );
|
2019-09-15 15:08:57 +00:00
|
|
|
|
2020-11-16 00:04:55 +00:00
|
|
|
/**
|
2021-06-04 17:44:22 +00:00
|
|
|
* 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,
|
2019-09-15 15:08:57 +00:00
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
void findPads1( std::vector<PAD*>& aPadList, FOOTPRINT* aFootprint ) const;
|
2021-06-04 17:44:22 +00:00
|
|
|
|
|
|
|
BOARD* m_pcb;
|
|
|
|
PCB_LAYER_ID m_layer; // The board layer currently used (typically F_Cu or B_Cu)
|
|
|
|
wxPoint m_offset; // Drill offset coordinates
|
|
|
|
|
|
|
|
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
|
|
|
|
// This is a flashed 0 sized round pad
|
2019-09-15 15:08:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // #ifndef PLACEFILE_GERBER_WRITER_H
|