60 return aMarkerDiameter / 10;
92 if( aFormat == PLOT_FORMAT::HPGL )
93 aFormat = PLOT_FORMAT::PDF;
99 case PLOT_FORMAT::GERBER:
109 case PLOT_FORMAT::PDF:
110 case PLOT_FORMAT::POST:
111 case PLOT_FORMAT::SVG:
120 double Xscale = double( pageSizeIU.
x - ( 2 * margin ) ) / bbbox.
GetWidth();
124 int ypagesize_for_board =
KiROUND( pageSizeIU.
y * 0.6 );
125 double Yscale = double( ypagesize_for_board - margin ) / bbbox.
GetHeight();
127 scale = std::min( Xscale, Yscale );
140 bottom_limit = ( pageSizeIU.
y - margin ) / std::min(
scale, 1.0 );
142 if( aFormat == PLOT_FORMAT::SVG )
144 else if( aFormat == PLOT_FORMAT::PDF )
154 case PLOT_FORMAT::DXF:
159 dxf_plotter->
SetUnits( DXF_UNITS::MILLIMETERS );
161 dxf_plotter->
SetUnits( DXF_UNITS::INCHES );
163 plotter = dxf_plotter;
178 if( !plotter->
OpenFile( aFullFileName ) )
201 text =
"%TF.FileFunction,Drillmap*%";
205 text = wxT(
"%TF.FilePolarity,Positive*%" );
223 switch( item->Type() )
238 int plotX, plotY, TextWidth;
258 double charScale = std::min( 1.0, 1.0 /
scale );
260 TextWidth =
KiROUND( ( charSize * charScale ) / 10.0 );
261 intervalle =
KiROUND( charSize * charScale ) + TextWidth;
264 plotX =
KiROUND( bbbox.
GetX() + textmarginaftersymbol * charScale );
268 wxString Text = wxT(
"Drill Map:" );
278 plotter->
PlotText(
VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, attrs,
nullptr );
283 int max_line_len = 0;
295 if( bottom_limit && ( plotY+intervalle > bottom_limit ) )
305 plot_diam = std::min( plot_diam,
KiROUND( charSize * charScale ) );
306 int x =
KiROUND( plotX - textmarginaftersymbol * charScale - plot_diam / 2.0 );
307 int y =
KiROUND( plotY + charSize * charScale );
321 snprintf( line,
sizeof(line),
"(1 hole)" );
323 snprintf( line,
sizeof(line),
"(1 slot)" );
325 snprintf( line,
sizeof(line),
"(%d holes)", tool.
m_TotalCount );
327 snprintf( line,
sizeof(line),
"(%d holes + 1 slot)", tool.
m_TotalCount - 1 );
335 msg += wxT(
" (not plated)" );
337 plotter->
PlotText(
VECTOR2I( plotX, y ), COLOR4D::UNSPECIFIED, msg, attrs,
nullptr );
339 intervalle =
KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
346 int text_len = msg.Len() * ( ( charSize * charScale ) + TextWidth );
347 max_line_len = std::max( max_line_len, text_len + plot_diam );
361 static const char separator[] =
362 " =============================================================\n";
366 unsigned totalHoleCount;
371 out.
Print( 0,
"Drill report for %s\n",
TO_UTF8( brdFilename.GetFullName() ) );
375 out.
Print( 0,
"Copper Layer Stackup:\n" );
376 out.
Print( 0, separator );
380 int conventional_layer_num = 1;
382 for(
LSEQ seq = cu.
Seq(); seq; ++seq, ++conventional_layer_num )
384 out.
Print( 0,
" L%-2d: %-25s %s\n",
385 conventional_layer_num,
390 out.
Print( 0,
"\n\n" );
398 bool buildNPTHlist =
false;
401 for(
unsigned pair_ndx = 0; pair_ndx < hole_sets.size(); ++pair_ndx )
409 out.
Print( 0,
"Drill file '%s' contains\n",
412 out.
Print( 0,
" plated through holes:\n" );
413 out.
Print( 0, separator );
415 out.
Print( 0,
" Total plated holes count %u\n", totalHoleCount );
419 out.
Print( 0,
"Drill file '%s' contains\n",
422 out.
Print( 0,
" holes connecting layer pair: '%s and %s' (%s vias):\n",
425 pair.first ==
F_Cu || pair.second ==
B_Cu ?
"blind" :
"buried" );
427 out.
Print( 0, separator );
429 out.
Print( 0,
" Total plated holes count %u\n", totalHoleCount );
432 out.
Print( 0,
"\n\n" );
438 buildNPTHlist =
true;
444 out.
Print( 0,
"Not plated through holes are merged with plated holes\n" );
446 out.
Print( 0,
"Drill file '%s' contains\n",
450 out.
Print( 0,
" unplated through holes:\n" );
451 out.
Print( 0, separator );
453 out.
Print( 0,
" Total unplated holes count %u\n", totalHoleCount );
487 unsigned totalHoleCount = 0;
500 int tool_number = ii+1;
501 out.
Print( 0,
" T%d %2.3fmm %2.4f\" ", tool_number,
507 out.
Print( 0,
"(1 hole)\n" );
509 out.
Print( 0,
"(1 hole) (with 1 slot)\n" );
520 out.
Print( 0,
"\n" );
522 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...
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
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....
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.
coord_type GetHeight() const
coord_type GetWidth() const
coord_type GetBottom() const
void PlotPcbShape(const PCB_SHAPE *aShape)
void SetLayerSet(LSET aLayerMask)
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).
PCB specific render settings.
void SetDefaultPenWidth(int aWidth)
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
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 VECTOR2I GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Parameters and options when plotting/printing a board.
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
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 PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, void *aData=nullptr)
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 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)
int getMarkerBestPenSize(int aMarkerDiameter)
helper classes to handle hole info for drill files generators.
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > DRILL_LAYER_PAIR
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 ...
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
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
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)
Round a floating point number to an integer using "round halfway cases away from zero".