52 bool aIncludeBrdEdges,
bool aExcludeDNP,
63 std::vector<FOOTPRINT*> fp_list;
70 if( aExcludeDNP && ( footprint->GetAttributes() &
FP_DNP ) )
76 if( footprint->GetLayer() == aLayer )
77 fp_list.push_back( footprint );
99 text.Printf( wxT(
"%%TF.FileFunction,Component,L%d,%s*%%" ),
100 aLayer ==
B_Cu ?
m_pcb->GetCopperLayerCount() : 1,
101 aLayer ==
B_Cu ? wxT(
"Bot" ) : wxT(
"Top" ) );
105 text = wxT(
"%TF.FilePolarity,Positive*%" );
108 if( !plotter.
OpenFile( aFullFilename ) )
121 int flash_position_shape_diam =
pcbIUScale.mmToIU( 0.3 );
124 int pad1_mark_size =
pcbIUScale.mmToIU( 0.36 );
129 int other_pads_mark_size =
pcbIUScale.mmToIU( 0.1 );
132 int line_thickness =
pcbIUScale.mmToIU( 0.1 );
136 const bool allowUtf8 =
true;
137 const bool quoteOption =
false;
149 allowUtf8, quoteOption );
159 aLayer ==
B_Cu ?
true :
false );
165 else if( footprint->GetAttributes() &
FP_SMD )
170 allowUtf8, quoteOption );
173 wxString fp_info =
From_UTF8( footprint->GetFPID().GetLibItemName().c_str() );
177 fp_info =
From_UTF8( footprint->GetFPID().GetLibNickname().c_str() );
182 VECTOR2I flash_pos = footprint->GetPosition();
184 plotter.
FlashPadCircle( flash_pos, flash_position_shape_diam, &metadata );
192 bool useFpPadsBbox =
true;
193 bool onBack = aLayer ==
B_Cu;
195 footprint->BuildCourtyardCaches();
199 if( ( footprint->GetFlags() & checkFlag ) == 0 )
203 const SHAPE_POLY_SET& courtyard = footprint->GetCourtyard( aLayer );
212 useFpPadsBbox =
false;
213 plotter.PLOTTER::PlotPoly( poly,
FILL_T::NO_FILL, line_thickness, &metadata );
222 BOX2I bbox = footprint->GetFpPadsLocalBbox();
226 int y_sign = aLayer ==
B_Cu ? -1 : 1;
235 poly.
Rotate( footprint->GetOrientation() );
236 poly.
Move( footprint->GetPosition() );
237 plotter.PLOTTER::PlotPoly( poly,
FILL_T::NO_FILL, line_thickness, &metadata );
240 std::vector<PAD*>pad_key_list;
246 for(
PAD* pad1 : pad_key_list )
249 metadata.
SetPadName( pad1->GetNumber(), allowUtf8, quoteOption );
264 for(
PAD*
pad: footprint->Pads() )
266 bool skip_pad =
false;
268 for(
PAD* pad1 : pad_key_list )
282 if( !
pad->IsOnLayer( aLayer ) )
285 metadata.
SetPadName(
pad->GetNumber(), allowUtf8, quoteOption );
299 if( aIncludeBrdEdges )
310 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
335 double gbr_angle = 180.0 + aAngle;
339 if( gbr_angle <= -180 )
341 else if( gbr_angle > 180 )
362 if(
pad->GetNumber() == wxT(
"1" ) ||
pad->GetNumber() == wxT(
"A1" ) )
363 aPadList.push_back(
pad );
373 wxFileName fn = aFullBaseFilename;
375 wxString post_id = wxT(
"-pnp_" );
376 post_id += aLayer ==
B_Cu ? wxT(
"bottom" ) : wxT(
"top" );
377 fn.SetName( fn.GetName() + post_id );
380 return fn.GetFullPath();
constexpr EDA_IU_SCALE pcbIUScale
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.
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
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, bool aExcludeDNP, bool aExcludeBOM)
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)
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.