51 m_layer = PCB_LAYER_ID::UNDEFINED_LAYER;
56 bool aIncludeBrdEdges )
66 std::vector<FOOTPRINT*> fp_list;
73 if( footprint->GetLayer() == aLayer )
74 fp_list.push_back( footprint );
96 text.Printf( wxT(
"%%TF.FileFunction,Component,L%d,%s*%%" ),
98 aLayer ==
B_Cu ? wxT(
"Bot" ) : wxT(
"Top" ) );
102 text = wxT(
"%TF.FilePolarity,Positive*%" );
105 if( !plotter.
OpenFile( aFullFilename ) )
118 int other_pads_mark_size = 0;
123 bool allowUtf8 =
true;
145 aLayer ==
B_Cu ?
true :
false );
151 else if( footprint->GetAttributes() &
FP_SMD )
159 wxString fp_info =
FROM_UTF8( footprint->GetFPID().GetLibItemName().c_str() );
163 fp_info =
FROM_UTF8( footprint->GetFPID().GetLibNickname().c_str() );
168 VECTOR2I flash_pos = footprint->GetPosition();
178 bool useFpPadsBbox =
true;
179 bool onBack = aLayer ==
B_Cu;
181 footprint->BuildCourtyardCaches();
185 if( ( footprint->GetFlags() & checkFlag ) == 0 )
190 const SHAPE_POLY_SET& courtyard = footprint->GetCourtyard( aLayer );
199 useFpPadsBbox =
false;
200 plotter.PLOTTER::PlotPoly( poly, FILL_T::NO_FILL, line_thickness, &gbr_metadata );
210 BOX2I bbox = footprint->GetFpPadsLocalBbox();
214 int y_sign = aLayer ==
B_Cu ? -1 : 1;
223 poly.
Rotate( footprint->GetOrientation() );
224 poly.
Move( footprint->GetPosition() );
225 plotter.PLOTTER::PlotPoly( poly, FILL_T::NO_FILL, line_thickness, &gbr_metadata );
228 std::vector<PAD*>pad_key_list;
234 for(
PAD* pad1 : pad_key_list )
239 gbr_metadata.
SetPadName( pad1->GetNumber(), allowUtf8,
true );
257 for(
PAD*
pad: footprint->Pads() )
259 bool skip_pad =
false;
261 for(
PAD* pad1 : pad_key_list )
275 if( !
pad->IsOnLayer( aLayer ) )
278 gbr_metadata.
SetPadName(
pad->GetNumber(), allowUtf8,
true );
294 if( aIncludeBrdEdges )
304 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
329 double gbr_angle = 180.0 + aAngle;
333 if( gbr_angle <= -180 )
335 else if( gbr_angle > 180 )
356 if(
pad->GetNumber() == wxT(
"1" ) ||
pad->GetNumber() == wxT(
"A1" ) )
357 aPadList.push_back(
pad );
367 wxFileName fn = aFullBaseFilename;
369 wxString post_id = wxT(
"-pnp_" );
370 post_id += aLayer ==
B_Cu ? wxT(
"bottom" ) : wxT(
"top" );
371 fn.SetName( fn.GetName() + post_id );
374 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.
FOOTPRINTS & Footprints()
int GetCopperLayerCount() const
const PCB_PLOT_PARAMS & GetPlotOptions() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
coord_type GetTop() const
coord_type GetRight() const
coord_type GetLeft() const
coord_type GetBottom() const
void PlotPcbShape(const PCB_SHAPE *aShape)
void SetLayerSet(LSET aLayerMask)
void PlotBoardGraphicItems()
Plot items like text and graphics but not tracks and footprints.
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
int CreatePlaceFile(wxString &aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges)
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.
const std::string GerberFileExtension
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
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...
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.