47 m_layer = PCB_LAYER_ID::UNDEFINED_LAYER;
52 bool aIncludeBrdEdges,
bool aExcludeDNP )
62 std::vector<FOOTPRINT*> fp_list;
69 if( aExcludeDNP && ( footprint->GetAttributes() &
FP_DNP ) )
72 if( footprint->GetLayer() == aLayer )
73 fp_list.push_back( footprint );
95 text.Printf( wxT(
"%%TF.FileFunction,Component,L%d,%s*%%" ),
97 aLayer ==
B_Cu ? wxT(
"Bot" ) : wxT(
"Top" ) );
101 text = wxT(
"%TF.FilePolarity,Positive*%" );
104 if( !plotter.
OpenFile( aFullFilename ) )
132 const bool allowUtf8 =
true;
133 const bool quoteOption =
false;
145 allowUtf8, quoteOption );
155 aLayer ==
B_Cu ?
true :
false );
161 else if( footprint->GetAttributes() &
FP_SMD )
166 allowUtf8, quoteOption );
169 wxString fp_info =
From_UTF8( footprint->GetFPID().GetLibItemName().c_str() );
173 fp_info =
From_UTF8( footprint->GetFPID().GetLibNickname().c_str() );
178 VECTOR2I flash_pos = footprint->GetPosition();
180 plotter.
FlashPadCircle( flash_pos, flash_position_shape_diam, &metadata );
188 bool useFpPadsBbox =
true;
189 bool onBack = aLayer ==
B_Cu;
191 footprint->BuildCourtyardCaches();
195 if( ( footprint->GetFlags() & checkFlag ) == 0 )
199 const SHAPE_POLY_SET& courtyard = footprint->GetCourtyard( aLayer );
208 useFpPadsBbox =
false;
209 plotter.PLOTTER::PlotPoly( poly, FILL_T::NO_FILL, line_thickness, &metadata );
218 BOX2I bbox = footprint->GetFpPadsLocalBbox();
222 int y_sign = aLayer ==
B_Cu ? -1 : 1;
231 poly.
Rotate( footprint->GetOrientation() );
232 poly.
Move( footprint->GetPosition() );
233 plotter.PLOTTER::PlotPoly( poly, FILL_T::NO_FILL, line_thickness, &metadata );
236 std::vector<PAD*>pad_key_list;
242 for(
PAD* pad1 : pad_key_list )
245 metadata.
SetPadName( pad1->GetNumber(), allowUtf8, quoteOption );
260 for(
PAD*
pad: footprint->Pads() )
262 bool skip_pad =
false;
264 for(
PAD* pad1 : pad_key_list )
278 if( !
pad->IsOnLayer( aLayer ) )
281 metadata.
SetPadName(
pad->GetNumber(), allowUtf8, quoteOption );
295 if( aIncludeBrdEdges )
306 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
331 double gbr_angle = 180.0 + aAngle;
335 if( gbr_angle <= -180 )
337 else if( gbr_angle > 180 )
358 if(
pad->GetNumber() == wxT(
"1" ) ||
pad->GetNumber() == wxT(
"A1" ) )
359 aPadList.push_back(
pad );
369 wxFileName fn = aFullBaseFilename;
371 wxString post_id = wxT(
"-pnp_" );
372 post_id += aLayer ==
B_Cu ? wxT(
"bottom" ) : wxT(
"top" );
373 fn.SetName( fn.GetName() + post_id );
376 return fn.GetFullPath();
constexpr EDA_IU_SCALE pcbIUScale
const VECTOR2I & GetAuxOrigin() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
int GetCopperLayerCount() const
const FOOTPRINTS & Footprints() const
const PCB_PLOT_PARAMS & GetPlotOptions() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
const DRAWINGS & Drawings() const
constexpr coord_type GetLeft() const
constexpr coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
void SetLayerSet(const LSET &aLayerMask)
void PlotBoardGraphicItem(const BOARD_ITEM *item)
Plot items like text and graphics but not tracks and footprints.
void PlotShape(const PCB_SHAPE *aShape)
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false) override
Selection of Gerber units and resolution (number of digits in mantissa).
void ClearAllAttributes()
Remove (clear) all attributes from object attributes dictionary (TO.
virtual void FlashPadCircle(const VECTOR2I &pos, int diametre, void *aData) override
Filled circular flashes are stored as apertures.
virtual void FlashRegularPolygon(const VECTOR2I &aShapePos, int aDiameter, int aCornerCount, const EDA_ANGLE &aOrient, void *aData) override
Flash a regular polygon.
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual bool EndPlot() override
void UseX2format(bool aEnable)
void UseX2NetAttributes(bool aEnable)
virtual bool StartPlot(const wxString &pageNumber) override
Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
LSET is a set of PCB_LAYER_IDs.
Parameters and options when plotting/printing a board.
bool GetUseAuxOrigin() const
const wxString GetPlaceFileName(const wxString &aFullBaseFilename, PCB_LAYER_ID aLayer) const
bool m_plotOtherPadsMarker
int CreatePlaceFile(const wxString &aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges, bool aExcludeDNP)
Create an pnp gerber file.
double mapRotationAngle(double aAngle, bool aIsFlipped)
Convert a KiCad footprint orientation to gerber rotation both are in degrees.
PLACEFILE_GERBER_WRITER(BOARD *aPcb)
void findPads1(std::vector< PAD * > &aPadList, FOOTPRINT *aFootprint) const
Find the pad(s) 1 (or pad "A1") of a footprint.
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
virtual void SetCreator(const wxString &aCreator)
void AddLineToHeader(const wxString &aExtraString)
Add a line to the list of free lines to print at the beginning of the file.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void Move(const VECTOR2I &aVector) override
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
int PointCount() const
Return the number of points (vertices) in this line chain.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
static constexpr EDA_ANGLE ANGLE_0
#define MALFORMED_F_COURTYARD
#define MALFORMED_B_COURTYARD
Classes used in place file generation.
static const std::string GerberFileExtension
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
void AddGerberX2Header(PLOTTER *aPlotter, const BOARD *aBoard, bool aUseX1CompatibilityMode)
Calculate some X2 attributes as defined in the Gerber file format specification J4 (chapter 5) and ad...
wxString From_UTF8(const char *cstring)
constexpr int mmToIU(double mm) const
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition of file extensions used in Kicad.