63 int bestsize = aMarkerDiameter / 10;
65 const double MIN_SIZE_MM = 0.1;
75 const double SKETCH_LINE_WIDTH_MM = 0.1;
83 const double DEFAULT_LINE_WIDTH_MM = 0.2;
116 if( aFormat == PLOT_FORMAT::HPGL )
117 aFormat = PLOT_FORMAT::PDF;
123 case PLOT_FORMAT::GERBER:
133 case PLOT_FORMAT::PDF:
134 case PLOT_FORMAT::POST:
135 case PLOT_FORMAT::SVG:
144 double Xscale = double( pageSizeIU.
x - ( 2 * margin ) ) / bbbox.
GetWidth();
148 int ypagesize_for_board =
KiROUND( pageSizeIU.
y * 0.6 );
149 double Yscale = double( ypagesize_for_board - margin ) / bbbox.
GetHeight();
151 scale = std::min( Xscale, Yscale );
164 bottom_limit = ( pageSizeIU.
y - margin ) / std::min(
scale, 1.0 );
166 if( aFormat == PLOT_FORMAT::SVG )
168 else if( aFormat == PLOT_FORMAT::PDF )
178 case PLOT_FORMAT::DXF:
184 plotter = dxf_plotter;
199 if( !plotter->
OpenFile( aFullFileName ) )
222 text =
"%TF.FileFunction,Drillmap*%";
226 text = wxT(
"%TF.FilePolarity,Positive*%" );
244 switch( item->Type() )
263 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
268 switch( item->Type() )
285 int plotX, plotY, TextWidth;
305 double charScale = std::min( 1.0, 1.0 /
scale );
307 TextWidth =
KiROUND( ( charSize * charScale ) / 10.0 );
308 intervalle =
KiROUND( charSize * charScale ) + TextWidth;
311 plotX =
KiROUND( bbbox.
GetX() + textmarginaftersymbol * charScale );
315 wxString Text = wxT(
"Drill Map:" );
325 plotter->
PlotText(
VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, attrs,
331 int max_line_len = 0;
343 if( bottom_limit && ( plotY+intervalle > bottom_limit ) )
353 plot_diam = std::min( plot_diam,
KiROUND( charSize * charScale ) );
354 int x =
KiROUND( plotX - textmarginaftersymbol * charScale - plot_diam / 2.0 );
355 int y =
KiROUND( plotY + charSize * charScale );
369 snprintf( line,
sizeof(line),
"(1 hole)" );
371 snprintf( line,
sizeof(line),
"(1 slot)" );
373 snprintf( line,
sizeof(line),
"(%d holes)", tool.
m_TotalCount );
375 snprintf( line,
sizeof(line),
"(%d holes + 1 slot)", tool.
m_TotalCount - 1 );
383 msg += wxT(
" (not plated)" );
388 intervalle =
KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
395 int text_len = msg.Len() * ( ( charSize * charScale ) + TextWidth );
396 max_line_len = std::max( max_line_len, text_len + plot_diam );
410 static const char separator[] =
411 " =============================================================\n";
415 unsigned totalHoleCount;
420 out.
Print( 0,
"Drill report for %s\n",
TO_UTF8( brdFilename.GetFullName() ) );
424 out.
Print( 0,
"Copper Layer Stackup:\n" );
425 out.
Print( 0, separator );
429 int conventional_layer_num = 1;
433 out.
Print( 0,
" L%-2d: %-25s %s\n",
434 conventional_layer_num++,
439 out.
Print( 0,
"\n\n" );
447 bool buildNPTHlist =
false;
450 for(
unsigned pair_ndx = 0; pair_ndx < hole_sets.size(); ++pair_ndx )
458 out.
Print( 0,
"Drill file '%s' contains\n",
461 out.
Print( 0,
" plated through holes:\n" );
462 out.
Print( 0, separator );
464 out.
Print( 0,
" Total plated holes count %u\n", totalHoleCount );
468 out.
Print( 0,
"Drill file '%s' contains\n",
471 out.
Print( 0,
" holes connecting layer pair: '%s and %s' (%s vias):\n",
474 pair.first ==
F_Cu || pair.second ==
B_Cu ?
"blind" :
"buried" );
476 out.
Print( 0, separator );
478 out.
Print( 0,
" Total plated holes count %u\n", totalHoleCount );
481 out.
Print( 0,
"\n\n" );
487 buildNPTHlist =
true;
493 out.
Print( 0,
"Not plated through holes are merged with plated holes\n" );
495 out.
Print( 0,
"Drill file '%s' contains\n",
499 out.
Print( 0,
" unplated through holes:\n" );
500 out.
Print( 0, separator );
502 out.
Print( 0,
" Total unplated holes count %u\n", totalHoleCount );
545 unsigned totalHoleCount = 0;
558 int tool_number = ii+1;
559 out.
Print( 0,
" T%d %2.3fmm %2.4f\" ", tool_number,
565 out.
Print( 0,
"(1 hole)\n" );
567 out.
Print( 0,
"(1 hole) (with 1 slot)\n" );
578 out.
Print( 0,
"\n" );
580 return totalHoleCount;
constexpr EDA_IU_SCALE pcbIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetVisibleLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
const FOOTPRINTS & Footprints() const
const wxString & GetFileName() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
const DRAWINGS & Drawings() const
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr coord_type GetX() const
constexpr size_type GetHeight() const
constexpr coord_type GetBottom() const
void SetLayerSet(const LSET &aLayerMask)
void PlotShape(const PCB_SHAPE *aShape)
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
virtual void SetParentGroup(EDA_GROUP *aGroup)
const PAGE_INFO * m_pageInfo
std::vector< DRILL_LAYER_PAIR > getUniqueLayerPairs() const
Get unique layer pairs by examining the micro and blind_buried vias.
virtual const wxString getDrillFileName(DRILL_LAYER_PAIR aPair, bool aNPTH, bool aMerge_PTH_NPTH) const
void buildHolesList(DRILL_LAYER_PAIR aLayerPair, bool aGenerateNPTH_list)
Create the list of holes and tools for a given board.
unsigned printToolSummary(OUTPUTFORMATTER &aOut, bool aSummaryNPTH) const
Print m_toolListBuffer[] tools to aOut and returns total hole count.
std::vector< HOLE_INFO > m_holeListBuffer
bool genDrillMapFile(const wxString &aFullFileName, PLOT_FORMAT aFormat)
Plot a map of drill marks for holes.
VECTOR2I GetOffset()
Return the plot offset (usually the position of the drill/place origin).
std::vector< DRILL_TOOL > m_toolListBuffer
bool GenDrillReportFile(const wxString &aFullFileName)
Create a plain text report file giving a list of drill values and drill count for through holes,...
const std::string layerName(PCB_LAYER_ID aLayer) const
bool plotDrillMarks(PLOTTER *aPlotter)
Write the drill marks in HPGL, POSTSCRIPT or other supported formats/.
void UseX2format(bool aEnable)
void UseX2NetAttributes(bool aEnable)
void DisableApertMacros(bool aDisable)
Disable Aperture Macro (AM) command, only for broken Gerber Readers.
Handle hole which must be drilled (diameter, position and layers).
static const METRICS & Default()
PCB specific render settings.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
void SetDefaultPenWidth(int aWidth)
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
LSET is a set of PCB_LAYER_IDs.
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Describe the page size and margins of a paper page on which to eventually print or plot.
const VECTOR2D GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Parameters and options when plotting/printing a board.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Base plotter engine class.
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
void SetRenderSettings(RENDER_SETTINGS *aSettings)
virtual bool StartPlot(const wxString &aPageNumber)=0
RENDER_SETTINGS * RenderSettings()
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false)
virtual PLOT_FORMAT GetPlotterType() const =0
Return the effective plot engine in use.
void Marker(const VECTOR2I &position, int diametre, unsigned aShapeId)
Draw a pattern shape number aShapeId, to coord position.
virtual void SetCreator(const wxString &aCreator)
void ClearHeaderLinesList()
Remove all lines from the list of free lines to print at the beginning of the file.
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror)=0
Set the plot offset and scaling for the current plot.
void AddLineToHeader(const wxString &aExtraString)
Add a line to the list of free lines to print at the beginning of the file.
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont=nullptr, const KIFONT::METRICS &aFontMetrics=KIFONT::METRICS::Default(), void *aData=nullptr)
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
This file is part of the common library.
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
double diameter_in_mm(double ius)
double diameter_in_inches(double ius)
static int getMarkerBestPenSize(int aMarkerDiameter)
int getSketchOvalBestPenSize()
helper classes to handle hole info for drill files generators.
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > DRILL_LAYER_PAIR
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
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...
PLOT_FORMAT
The set of supported output plot formats.
Plotting engines similar to ps (PostScript, Gerber, svg)
std::vector< FAB_LAYER_COLOR > dummy
wxString From_UTF8(const char *cstring)
wxString GetISO8601CurrentDateTime()
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
constexpr int mmToIU(double mm) const
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
VECTOR2< int32_t > VECTOR2I