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:
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:
183 plotter = dxf_plotter;
198 if( !plotter->
OpenFile( aFullFileName ) )
221 text =
"%TF.FileFunction,Drillmap*%";
225 text = wxT(
"%TF.FilePolarity,Positive*%" );
243 switch( item->Type() )
262 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
267 switch( item->Type() )
284 int plotX, plotY, TextWidth;
304 double charScale = std::min( 1.0, 1.0 /
scale );
306 TextWidth =
KiROUND( ( charSize * charScale ) / 10.0 );
307 intervalle =
KiROUND( charSize * charScale ) + TextWidth;
310 plotX =
KiROUND( bbbox.
GetX() + textmarginaftersymbol * charScale );
314 wxString Text = wxT(
"Drill Map:" );
324 plotter->
PlotText(
VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, attrs,
330 int max_line_len = 0;
342 if( bottom_limit && ( plotY+intervalle > bottom_limit ) )
352 plot_diam = std::min( plot_diam,
KiROUND( charSize * charScale ) );
353 int x =
KiROUND( plotX - textmarginaftersymbol * charScale - plot_diam / 2.0 );
354 int y =
KiROUND( plotY + charSize * charScale );
365 const char* extra_info;
370 extra_info =
", castellated";
372 extra_info =
", press-fit";
378 snprintf( line,
sizeof(line),
"(1 hole%s)", extra_info );
380 snprintf( line,
sizeof(line),
"(1 slot%s)", extra_info );
382 snprintf( line,
sizeof(line),
"(%d holes%s)", tool.
m_TotalCount, extra_info );
384 snprintf( line,
sizeof(line),
"(%d holes + 1 slot%s)", tool.
m_TotalCount - 1, extra_info );
392 msg += wxT(
" (not plated)" );
397 intervalle =
KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
404 int text_len = msg.Len() * ( ( charSize * charScale ) + TextWidth );
405 max_line_len = std::max( max_line_len, text_len + plot_diam );
419 static const char separator[] =
420 " =============================================================\n";
424 unsigned totalHoleCount;
429 out.
Print( 0,
"Drill report for %s\n",
TO_UTF8( brdFilename.GetFullName() ) );
433 out.
Print( 0,
"Copper Layer Stackup:\n" );
434 out.
Print( 0, separator );
436 int conventional_layer_num = 1;
440 out.
Print( 0,
" L%-2d: %-25s %s\n",
441 conventional_layer_num++,
446 out.
Print( 0,
"\n\n" );
454 bool buildNPTHlist =
false;
457 for(
unsigned pair_ndx = 0; pair_ndx < hole_sets.size(); ++pair_ndx )
465 out.
Print( 0,
"Drill file '%s' contains\n",
468 out.
Print( 0,
" plated through holes:\n" );
469 out.
Print( 0, separator );
471 out.
Print( 0,
" Total plated holes count %u\n", totalHoleCount );
475 out.
Print( 0,
"Drill file '%s' contains\n",
478 out.
Print( 0,
" holes connecting layer pair: '%s and %s' (%s vias):\n",
481 pair.first ==
F_Cu || pair.second ==
B_Cu ?
"blind" :
"buried" );
483 out.
Print( 0, separator );
485 out.
Print( 0,
" Total plated holes count %u\n", totalHoleCount );
488 out.
Print( 0,
"\n\n" );
494 buildNPTHlist =
true;
500 out.
Print( 0,
"Not plated through holes are merged with plated holes\n" );
502 out.
Print( 0,
"Drill file '%s' contains\n",
506 out.
Print( 0,
" unplated through holes:\n" );
507 out.
Print( 0, separator );
509 out.
Print( 0,
" Total unplated holes count %u\n", totalHoleCount );
543 unsigned totalHoleCount = 0;
556 int tool_number = ii+1;
557 out.
Print( 0,
" T%d %2.3fmm %2.4f\" ", tool_number,
563 out.
Print( 0,
"(1 hole" );
565 out.
Print( 0,
"(1 hole) (with 1 slot" );
574 out.
Print( 0,
", castellated" );
577 out.
Print( 0,
", press-fit" );
579 out.
Print( 0,
")\n");
584 out.
Print( 0,
"\n" );
586 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.
int GetCopperLayerCount() const
const FOOTPRINTS & Footprints() const
const wxString & GetFileName() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
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 PDF, 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.
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()
return AllCuMask( MAX_CU_LAYERS );
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)
static const int USE_DEFAULT_LINE_WIDTH
virtual void ThickOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth, void *aData)
virtual bool StartPlot(const wxString &aPageNumber)=0
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)
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