47 m_layer = PCB_LAYER_ID::UNDEFINED_LAYER;
52 bool aIncludeBrdEdges )
62 std::vector<FOOTPRINT*> fp_list;
69 if( footprint->GetLayer() == aLayer )
70 fp_list.push_back( footprint );
92 text.Printf( wxT(
"%%TF.FileFunction,Component,L%d,%s*%%" ),
94 aLayer ==
B_Cu ? wxT(
"Bot" ) : wxT(
"Top" ) );
98 text = wxT(
"%TF.FilePolarity,Positive*%" );
101 if( !plotter.
OpenFile( aFullFilename ) )
129 const bool allowUtf8 =
true;
130 const bool quoteOption =
false;
142 allowUtf8, quoteOption );
152 aLayer ==
B_Cu ?
true :
false );
158 else if( footprint->GetAttributes() &
FP_SMD )
163 allowUtf8, quoteOption );
166 wxString fp_info =
From_UTF8( footprint->GetFPID().GetLibItemName().c_str() );
170 fp_info =
From_UTF8( footprint->GetFPID().GetLibNickname().c_str() );
175 VECTOR2I flash_pos = footprint->GetPosition();
185 bool useFpPadsBbox =
true;
186 bool onBack = aLayer ==
B_Cu;
188 footprint->BuildCourtyardCaches();
192 if( ( footprint->GetFlags() & checkFlag ) == 0 )
196 const SHAPE_POLY_SET& courtyard = footprint->GetCourtyard( aLayer );
205 useFpPadsBbox =
false;
206 plotter.PLOTTER::PlotPoly( poly, FILL_T::NO_FILL, line_thickness, &metadata );
215 BOX2I bbox = footprint->GetFpPadsLocalBbox();
219 int y_sign = aLayer ==
B_Cu ? -1 : 1;
228 poly.
Rotate( footprint->GetOrientation() );
229 poly.
Move( footprint->GetPosition() );
230 plotter.PLOTTER::PlotPoly( poly, FILL_T::NO_FILL, line_thickness, &metadata );
233 std::vector<PAD*>pad_key_list;
239 for(
PAD* pad1 : pad_key_list )
242 metadata.
SetPadName( pad1->GetNumber(), allowUtf8, quoteOption );
257 for(
PAD*
pad: footprint->Pads() )
259 bool skip_pad =
false;
261 for(
PAD* pad1 : pad_key_list )
275 if( !
pad->IsOnLayer( aLayer ) )
278 metadata.
SetPadName(
pad->GetNumber(), allowUtf8, quoteOption );
292 if( aIncludeBrdEdges )
303 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
328 double gbr_angle = 180.0 + aAngle;
332 if( gbr_angle <= -180 )
334 else if( gbr_angle > 180 )
355 if(
pad->GetNumber() == wxT(
"1" ) ||
pad->GetNumber() == wxT(
"A1" ) )
356 aPadList.push_back(
pad );
366 wxFileName fn = aFullBaseFilename;
368 wxString post_id = wxT(
"-pnp_" );
369 post_id += aLayer ==
B_Cu ? wxT(
"bottom" ) : wxT(
"top" );
370 fn.SetName( fn.GetName() + post_id );
373 return fn.GetFullPath();
constexpr EDA_IU_SCALE pcbIUScale
const VECTOR2I & GetAuxOrigin()
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 PlotBoardGraphicItem(const BOARD_ITEM *item)
Plot items like text and graphics but not tracks and footprints.
void SetLayerSet(LSET aLayerMask)
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, OUTLINE_MODE trace_mode, void *aData) override
Filled circular flashes are stored as apertures.
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 void FlashRegularPolygon(const VECTOR2I &aShapePos, int aDiameter, int aCornerCount, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
Flash a regular polygon.
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
double mapRotationAngle(double aAngle, bool aIsFlipped)
Convert a KiCad footprint orientation to gerber rotation both are in degrees.
PLACEFILE_GERBER_WRITER(BOARD *aPcb)
int CreatePlaceFile(const wxString &aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges)
Create an pnp gerber file.
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.