55 bool aIncludeBrdEdges )
65 std::vector<FOOTPRINT*> fp_list;
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 ) )
117 int other_pads_mark_size = 0;
122 bool allowUtf8 =
true;
149 else if( footprint->GetAttributes() &
FP_SMD )
157 wxString fp_info =
FROM_UTF8( footprint->GetFPID().GetLibItemName().c_str() );
161 fp_info =
FROM_UTF8( footprint->GetFPID().GetLibNickname().c_str() );
166 wxPoint flash_pos = footprint->GetPosition();
176 bool useFpPadsBbox =
true;
177 bool onBack = aLayer ==
B_Cu;
179 footprint->BuildPolyCourtyards();
183 if( ( footprint->GetFlags() & checkFlag ) == 0 )
188 const SHAPE_POLY_SET& courtyard = footprint->GetPolyCourtyard( aLayer );
197 useFpPadsBbox =
false;
198 plotter.PLOTTER::PlotPoly( poly,
FILL_T::NO_FILL, line_thickness, &gbr_metadata );
208 EDA_RECT bbox = footprint->GetFpPadsLocalBbox();
212 int y_sign = aLayer ==
B_Cu ? -1 : 1;
221 poly.
Rotate( -footprint->GetOrientationRadians(),
VECTOR2I( 0, 0 ) );
222 poly.
Move( footprint->GetPosition() );
223 plotter.PLOTTER::PlotPoly( poly,
FILL_T::NO_FILL, line_thickness, &gbr_metadata );
226 std::vector<PAD*>pad_key_list;
232 for(
PAD* pad1 : pad_key_list )
237 gbr_metadata.
SetPadName( pad1->GetNumber(), allowUtf8, true );
255 for(
PAD*
pad: footprint->Pads() )
257 bool skip_pad =
false;
259 for(
PAD* pad1 : pad_key_list )
273 if( !
pad->IsOnLayer( aLayer ) )
276 gbr_metadata.
SetPadName(
pad->GetNumber(), allowUtf8, true );
292 if( aIncludeBrdEdges )
302 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
335 if(
pad->GetNumber() == wxT(
"1" ) ||
pad->GetNumber() == wxT(
"A1" ) )
336 aPadList.push_back(
pad );
346 wxFileName fn = aFullBaseFilename;
348 wxString post_id = wxT(
"-pnp_" );
349 post_id += aLayer ==
B_Cu ? wxT(
"bottom" ) : wxT(
"top" );
350 fn.SetName( fn.GetName() + post_id );
353 return fn.GetFullPath();
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, OUTLINE_MODE aTraceMode, void *aData) override
Flash a regular polygon.
PLACEFILE_GERBER_WRITER(BOARD *aPcb)
Classes used in place file generation.
int CreatePlaceFile(wxString &aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges)
Create an pnp gerber file.
virtual void SetCreator(const wxString &aCreator)
const PCB_PLOT_PARAMS & GetPlotOptions() const
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void UseX2NetAttributes(bool aEnable)
#define MALFORMED_B_COURTYARD
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
#define MALFORMED_F_COURTYARD
void Move(const VECTOR2I &aVector) override
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...
void UseX2format(bool aEnable)
class FP_SHAPE, a footprint edge
const std::string GerberFileExtension
void PlotFootprintGraphicItem(const FP_SHAPE *aShape)
void AddLineToHeader(const wxString &aExtraString)
Add a line to the list of free lines to print at the beginning of the file.
int PointCount() const
Return the number of points (vertices) in this line chain.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
virtual bool StartPlot() override
Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
This file contains miscellaneous commonly used macros and functions.
Board plot function definition file.
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
LSET is a set of PCB_LAYER_IDs.
void SetLayerSet(LSET aLayerMask)
void ClearAllAttributes()
Remove (clear) all attributes from object attributes dictionary (TO.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
void PlotBoardGraphicItems()
Plot items like text and graphics but not tracks and footprints.
FOOTPRINTS & Footprints()
Definition of file extensions used in Kicad.
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
Parameters and options when plotting/printing a board.
void Rotate(double aAngle, const VECTOR2I &aCenter=VECTOR2I(0, 0)) override
Rotate all vertices by a given angle.
const wxString GetPlaceFileName(const wxString &aFullBaseFilename, PCB_LAYER_ID aLayer) const
const wxPoint & GetAuxOrigin()
Information pertinent to a Pcbnew printed circuit board.
void findPads1(std::vector< PAD * > &aPadList, FOOTPRINT *aFootprint) const
Find the pad(s) 1 (or pad "A1") of a footprint.
virtual bool EndPlot() override
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
PCB_LAYER_ID
A quick note on layer IDs:
int GetCopperLayerCount() const
Handle the component boundary box.
bool m_plotOtherPadsMarker
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false) override
Selection of Gerber units and resolution (number of digits in mantissa).
double mapRotationAngle(double aAngle)
Convert a KiCad footprint orientation to gerber rotation both are in degrees.
virtual void FlashPadCircle(const wxPoint &pos, int diametre, OUTLINE_MODE trace_mode, void *aData) override
Filled circular flashes are stored as apertures.
bool GetUseAuxOrigin() const
static constexpr int Millimeter2iu(double mm)