52 bool aIncludeBrdEdges,
bool aExcludeDNP,
63 std::vector<FOOTPRINT*> fp_list;
67 if( footprint->GetExcludedFromPosFilesForVariant(
m_variant ) )
70 if( aExcludeDNP && footprint->GetDNPForVariant(
m_variant ) )
73 if( aExcludeBOM && footprint->GetExcludedFromBOMForVariant(
m_variant ) )
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 footprint->GetFieldValueForVariant(
m_variant,
175 wxString fp_info =
From_UTF8( footprint->GetFPID().GetLibItemName().c_str() );
179 fp_info =
From_UTF8( footprint->GetFPID().GetLibNickname().c_str() );
184 VECTOR2I flash_pos = footprint->GetPosition();
186 plotter.
FlashPadCircle( flash_pos, flash_position_shape_diam, &metadata );
194 bool useFpPadsBbox =
true;
195 bool onBack = aLayer ==
B_Cu;
197 footprint->BuildCourtyardCaches();
201 if( ( footprint->GetFlags() & checkFlag ) == 0 )
205 const SHAPE_POLY_SET& courtyard = footprint->GetCourtyard( aLayer );
214 useFpPadsBbox =
false;
215 plotter.PLOTTER::PlotPoly( poly,
FILL_T::NO_FILL, line_thickness, &metadata );
224 BOX2I bbox = footprint->GetFpPadsLocalBbox();
228 int y_sign = aLayer ==
B_Cu ? -1 : 1;
237 poly.
Rotate( footprint->GetOrientation() );
238 poly.
Move( footprint->GetPosition() );
239 plotter.PLOTTER::PlotPoly( poly,
FILL_T::NO_FILL, line_thickness, &metadata );
242 std::vector<PAD*>pad_key_list;
248 for(
PAD* pad1 : pad_key_list )
251 metadata.
SetPadName( pad1->GetNumber(), allowUtf8, quoteOption );
266 for(
PAD*
pad: footprint->Pads() )
268 bool skip_pad =
false;
270 for(
PAD* pad1 : pad_key_list )
284 if( !
pad->IsOnLayer( aLayer ) )
287 metadata.
SetPadName(
pad->GetNumber(), allowUtf8, quoteOption );
301 if( aIncludeBrdEdges )
312 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
337 double gbr_angle = 180.0 + aAngle;
341 if( gbr_angle <= -180 )
343 else if( gbr_angle > 180 )
364 if(
pad->GetNumber() == wxT(
"1" ) ||
pad->GetNumber() == wxT(
"A1" ) )
365 aPadList.push_back(
pad );
375 wxFileName fn = aFullBaseFilename;
377 wxString post_id = wxT(
"-pnp_" );
378 post_id += aLayer ==
B_Cu ? wxT(
"bottom" ) : wxT(
"top" );
379 fn.SetName( fn.GetName() + post_id );
382 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 UnescapeString(const wxString &aSource)
wxString From_UTF8(const char *cstring)
@ VALUE
Field Value of part, i.e. "3.3K".
wxString GetCanonicalFieldName(FIELD_T aFieldType)
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.