62 int bestsize = aMarkerDiameter / 10;
64 const double MIN_SIZE_MM = 0.1;
74 const double SKETCH_LINE_WIDTH_MM = 0.1;
82 const double DEFAULT_LINE_WIDTH_MM = 0.2;
115 if( aFormat == PLOT_FORMAT::HPGL )
116 aFormat = PLOT_FORMAT::PDF;
122 case PLOT_FORMAT::GERBER:
132 case PLOT_FORMAT::PDF:
133 case PLOT_FORMAT::POST:
134 case PLOT_FORMAT::SVG:
143 double Xscale = double( pageSizeIU.
x - ( 2 * margin ) ) / bbbox.
GetWidth();
147 int ypagesize_for_board =
KiROUND( pageSizeIU.
y * 0.6 );
148 double Yscale = double( ypagesize_for_board - margin ) / bbbox.
GetHeight();
150 scale = std::min( Xscale, Yscale );
163 bottom_limit = ( pageSizeIU.
y - margin ) / std::min(
scale, 1.0 );
165 if( aFormat == PLOT_FORMAT::SVG )
167 else if( aFormat == PLOT_FORMAT::PDF )
177 case PLOT_FORMAT::DXF:
182 dxf_plotter->
SetUnits( DXF_UNITS::MILLIMETERS );
184 dxf_plotter->
SetUnits( DXF_UNITS::INCHES );
186 plotter = dxf_plotter;
201 if( !plotter->
OpenFile( aFullFileName ) )
224 text =
"%TF.FileFunction,Drillmap*%";
228 text = wxT(
"%TF.FilePolarity,Positive*%" );
246 switch( item->Type() )
265 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
270 switch( item->Type() )
287 int plotX, plotY, TextWidth;
307 double charScale = std::min( 1.0, 1.0 /
scale );
309 TextWidth =
KiROUND( ( charSize * charScale ) / 10.0 );
310 intervalle =
KiROUND( charSize * charScale ) + TextWidth;
313 plotX =
KiROUND( bbbox.
GetX() + textmarginaftersymbol * charScale );
317 wxString Text = wxT(
"Drill Map:" );
327 plotter->
PlotText(
VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, attrs,
333 int max_line_len = 0;
345 if( bottom_limit && ( plotY+intervalle > bottom_limit ) )
355 plot_diam = std::min( plot_diam,
KiROUND( charSize * charScale ) );
356 int x =
KiROUND( plotX - textmarginaftersymbol * charScale - plot_diam / 2.0 );
357 int y =
KiROUND( plotY + charSize * charScale );
371 snprintf( line,
sizeof(line),
"(1 hole)" );
373 snprintf( line,
sizeof(line),
"(1 slot)" );
375 snprintf( line,
sizeof(line),
"(%d holes)", tool.
m_TotalCount );
377 snprintf( line,
sizeof(line),
"(%d holes + 1 slot)", tool.
m_TotalCount - 1 );
385 msg += wxT(
" (not plated)" );
390 intervalle =
KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
397 int text_len = msg.Len() * ( ( charSize * charScale ) + TextWidth );
398 max_line_len = std::max( max_line_len, text_len + plot_diam );
412 static const char separator[] =
413 " =============================================================\n";
417 unsigned totalHoleCount;
422 out.
Print( 0,
"Drill report for %s\n",
TO_UTF8( brdFilename.GetFullName() ) );
426 out.
Print( 0,
"Copper Layer Stackup:\n" );
427 out.
Print( 0, separator );
431 int conventional_layer_num = 1;
435 out.
Print( 0,
" L%-2d: %-25s %s\n",
436 conventional_layer_num,
441 out.
Print( 0,
"\n\n" );
449 bool buildNPTHlist =
false;
452 for(
unsigned pair_ndx = 0; pair_ndx < hole_sets.size(); ++pair_ndx )
460 out.
Print( 0,
"Drill file '%s' contains\n",
463 out.
Print( 0,
" plated through holes:\n" );
464 out.
Print( 0, separator );
466 out.
Print( 0,
" Total plated holes count %u\n", totalHoleCount );
470 out.
Print( 0,
"Drill file '%s' contains\n",
473 out.
Print( 0,
" holes connecting layer pair: '%s and %s' (%s vias):\n",
476 pair.first ==
F_Cu || pair.second ==
B_Cu ?
"blind" :
"buried" );
478 out.
Print( 0, separator );
480 out.
Print( 0,
" Total plated holes count %u\n", totalHoleCount );
483 out.
Print( 0,
"\n\n" );
489 buildNPTHlist =
true;
495 out.
Print( 0,
"Not plated through holes are merged with plated holes\n" );
497 out.
Print( 0,
"Drill file '%s' contains\n",
501 out.
Print( 0,
" unplated through holes:\n" );
502 out.
Print( 0, separator );
504 out.
Print( 0,
" Total unplated holes count %u\n", totalHoleCount );
547 unsigned totalHoleCount = 0;
560 int tool_number = ii+1;
561 out.
Print( 0,
" T%d %2.3fmm %2.4f\" ", tool_number,
567 out.
Print( 0,
"(1 hole)\n" );
569 out.
Print( 0,
"(1 hole) (with 1 slot)\n" );
580 out.
Print( 0,
"\n" );
582 return totalHoleCount;
constexpr EDA_IU_SCALE pcbIUScale
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetParentGroup(PCB_GROUP *aGroup)
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
const FOOTPRINTS & Footprints() const
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
const wxString & GetFileName() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
const DRAWINGS & Drawings() const
size_type GetHeight() const
size_type GetWidth() const
coord_type GetBottom() const
void SetLayerSet(LSET aLayerMask)
void PlotShape(const PCB_SHAPE *aShape)
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
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 Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
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
Returns 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
constexpr ret_type KiROUND(fp_type v, bool aQuiet=false)
Round a floating point number to an integer using "round halfway cases away from zero".
VECTOR2< int32_t > VECTOR2I