43#define FLASH_OVAL_HOLE 0
58 bool aGenMap,
bool aGenTenting,
REPORTER* aReporter )
68 std::vector<DRILL_OPERATION> sideProtectionHoles;
70 hole_sets.emplace_back(
F_Cu,
B_Cu,
false,
true );
78 fn.SetPath( aPlotDirectory );
80 wxString fullFilename = fn.GetFullPath();
86 msg.Printf(
_(
"Failed to create file '%s'." ), fullFilename );
96 msg.Printf(
_(
"Created file '%s'." ), fullFilename );
104 for( std::vector<DRILL_SPAN>::const_iterator it = hole_sets.begin();
105 it != hole_sets.end(); ++it )
116 fn.SetPath( aPlotDirectory );
120 wxString fullFilename = fn.GetFullPath();
122 bool wroteDrillFile =
false;
130 msg.Printf(
_(
"Failed to create file '%s'." ), fullFilename );
138 wroteDrillFile =
true;
142 msg.Printf(
_(
"Created file '%s'." ), fullFilename );
167 sideProtectionHoles.push_back( hole );
189 writeProtection( feature, outerSpan );
229 wxString
text =
"%TF,FileFunction,Other,";
235 text << wxT(
"Capping" );
239 text << wxT(
"Filling" );
243 text << wxT(
"Covering-Back" );
247 text << wxT(
"Covering-Front" );
251 text << wxT(
"Plugging-Back" );
255 text << wxT(
"Plugging-Front" );
259 text << wxT(
"Tenting-Back" );
263 text << wxT(
"Tenting-Front" );
272 text = wxT(
"%TF.FilePolarity,Positive*%" );
276 if( !plotter.
OpenFile( aFullFilename ) )
293 int diameter = hole_descr.m_Diameter;
298 cont = ! hole_descr.m_Filled;
301 cont = ! hole_descr.m_Capped;
304 cont = !hole_descr.m_BottomCovered;
305 diameter =
via->GetWidth(
via->BottomLayer() );
308 cont = ! hole_descr.m_TopCovered;
309 diameter =
via->GetWidth(
via->TopLayer() );
312 cont = !hole_descr.m_BottomPlugged;
315 cont = ! hole_descr.m_TopPlugged;
318 cont = ! hole_descr.m_BottomTented;
319 diameter =
via->GetWidth(
via->BottomLayer() );
322 cont = ! hole_descr.m_TopTented;
323 diameter =
via->GetWidth(
via->TopLayer() );
335 plotter.
FlashPadCircle( hole_descr.m_Position, diameter, &gbr_metadata );
375 text = wxT(
"%TF.FilePolarity,Positive*%" );
378 if( !plotter.
OpenFile( aFullFilename ) )
386 bool last_item_is_via =
true;
406 if( !last_item_is_via )
412 last_item_is_via =
true;
416 last_item_is_via =
false;
446 wxString ref =
pad->GetParentFootprint()->GetReference();
467 plotter.
ThickSegment( start+hole_pos,
end+hole_pos, width, &gbr_metadata );
487 wxFileName fn =
m_pcb->GetFileName();
490 fn.SetName( fn.GetName() + wxT(
"-" ) + pairName + wxT(
"-backdrill-drl" ) );
501 fn.SetPath( aPlotDirectory );
503 wxString fullFilename = fn.GetFullPath();
510 msg.Printf(
_(
"Failed to create file '%s'." ), fullFilename );
520 msg.Printf(
_(
"Created file '%s'." ), fullFilename );
540 if( size.
x > size.
y )
542 std::swap( size.
x, size.
y );
546 int deltaxy = size.
y - size.
x;
547 aStart =
VECTOR2I( 0, deltaxy / 2 );
568 bool aMerge_PTH_NPTH )
const
573 fname.SetName( fname.GetName() + wxT(
"-drl" ) );
575 return fname.GetFullPath();
591 if( hole_descr.m_Filled )
596 if( hole_descr.m_Capped )
601 if( hole_descr.m_BottomCovered )
606 if( hole_descr.m_TopCovered )
611 if( hole_descr.m_BottomPlugged )
616 if( hole_descr.m_TopPlugged )
621 if( hole_descr.m_BottomTented )
626 if( hole_descr.m_TopTented )
constexpr EDA_IU_SCALE pcbIUScale
Information pertinent to a Pcbnew printed circuit board.
virtual const wxString getProtectionFileName(const DRILL_SPAN &aSpan, IPC4761_FEATURES aFeature) const
void AddCreatedFile(const wxString &aPath)
wxString m_drillFileExtension
void buildHolesList(const DRILL_SPAN &aSpan, bool aGenerateNPTH_list)
Create the list of holes and tools for a given board.
DRILL_PRECISION m_precision
GENDRILL_WRITER_BASE(BOARD *aPcb)
const std::string layerPairName(DRILL_LAYER_PAIR aPair) const
bool CreateMapFilesSet(const wxString &aPlotDirectory, REPORTER *aReporter=nullptr)
Create the full set of map files for the board, in PS, PDF ... format (use SetMapFileFormat() to sele...
int getHolesCount() const
std::vector< DRILL_OPERATION > m_holeListBuffer
virtual const wxString getDrillFileName(const DRILL_SPAN &aSpan, bool aNPTH, bool aMerge_PTH_NPTH) const
const wxString BuildFileFunctionAttributeString(const DRILL_SPAN &aSpan, TYPE_FILE aHoleType, bool aCompatNCdrill=false) const
The standard X2 FileFunction for drill files is %TF.FileFunction,Plated[NonPlated],...
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, void *aData) override
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false) override
Selection of Gerber units and resolution (number of digits in mantissa).
virtual void FlashPadCircle(const VECTOR2I &pos, int diametre, void *aData) override
Filled circular flashes are stored as apertures.
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, void *aData) override
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 EndBlock(void *aData) override
Define the end of a group of drawing items the group is started by StartBlock().
virtual bool StartPlot(const wxString &pageNumber) override
Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.
void DisableApertMacros(bool aDisable)
Disable Aperture Macro (AM) command, only for broken Gerber Readers.
bool CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, bool aGenTenting, REPORTER *aReporter=nullptr)
Create the full set of Excellon drill file for the board filenames are computed from the board name,...
bool writeBackdrillLayerPairFile(const wxString &aPlotDirectory, REPORTER *aReporter, const DRILL_SPAN &aSpan)
int createDrillFile(wxString &aFullFilename, bool aIsNpth, const DRILL_SPAN &aSpan)
Create an Excellon drill file.
virtual const wxString getDrillFileName(const DRILL_SPAN &aSpan, bool aNPTH, bool aMerge_PTH_NPTH) const override
void SetFormat(int aRightDigits=6)
Initialize internal parameters to match the given format.
GERBER_WRITER(BOARD *aPcb)
wxFileName getBackdrillLayerPairFileName(const DRILL_SPAN &aSpan) const
int createProtectionFile(const wxString &aFullFilename, IPC4761_FEATURES aFeature, DRILL_LAYER_PAIR aLayerPair)
Create a Gerber X2 file for via protection features.
bool hasViaType(IPC4761_FEATURES aFeature)
test for an existing via having the given feature IPC4761_FEATURES
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
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.
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
std::vector< DRILL_SPAN > EnumerateDrillSpans(const BOARD &aBoard, bool aPadBackdrills)
Every drill span present on the board, through-holes first.
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > DRILL_LAYER_PAIR
static constexpr EDA_ANGLE ANGLE_90
static void convertOblong2Segment(const VECTOR2I &aSize, const EDA_ANGLE &aOrient, VECTOR2I &aStart, VECTOR2I &aEnd)
Classes used in drill files, map files and report files generation.
@ PRESSFIT
a PTH with a hole diameter with tight tolerances for press fit pin
@ CASTELLATED
a pad with a castellated through hole
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...
std::vector< FAB_LAYER_COLOR > dummy
One machining action, which is also one NC hit and one tool assignment.
VECTOR2I m_SizeXY
Source axes, never normalized to (width, length).
BOARD_ITEM * m_SourceItem
non-owning, valid only for this enumeration
DRILL_LAYER_PAIR Pair() const
wxString result
Test unit parsing edge cases and error handling.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Casted dyn_cast(From aObject)
A lightweight dynamic downcast.
VECTOR2< int32_t > VECTOR2I