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:
183 dxf_plotter->
SetUnits( DXF_UNITS::MILLIMETERS );
185 dxf_plotter->
SetUnits( DXF_UNITS::INCHES );
187 plotter = dxf_plotter;
202 if( !plotter->
OpenFile( aFullFileName ) )
225 text =
"%TF.FileFunction,Drillmap*%";
229 text = wxT(
"%TF.FilePolarity,Positive*%" );
247 switch( item->Type() )
266 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
271 switch( item->Type() )
288 int plotX, plotY, TextWidth;
308 double charScale = std::min( 1.0, 1.0 /
scale );
310 TextWidth =
KiROUND( ( charSize * charScale ) / 10.0 );
311 intervalle =
KiROUND( charSize * charScale ) + TextWidth;
314 plotX =
KiROUND( bbbox.
GetX() + textmarginaftersymbol * charScale );
318 wxString Text = wxT(
"Drill Map:" );
328 plotter->
PlotText(
VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, attrs,
334 int max_line_len = 0;
346 if( bottom_limit && ( plotY+intervalle > bottom_limit ) )
356 plot_diam = std::min( plot_diam,
KiROUND( charSize * charScale ) );
357 int x =
KiROUND( plotX - textmarginaftersymbol * charScale - plot_diam / 2.0 );
358 int y =
KiROUND( plotY + charSize * charScale );
372 snprintf( line,
sizeof(line),
"(1 hole)" );
374 snprintf( line,
sizeof(line),
"(1 slot)" );
376 snprintf( line,
sizeof(line),
"(%d holes)", tool.
m_TotalCount );
378 snprintf( line,
sizeof(line),
"(%d holes + 1 slot)", tool.
m_TotalCount - 1 );
386 msg += wxT(
" (not plated)" );
391 intervalle =
KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
398 int text_len = msg.Len() * ( ( charSize * charScale ) + TextWidth );
399 max_line_len = std::max( max_line_len, text_len + plot_diam );
413 static const char separator[] =
414 " =============================================================\n";
418 unsigned totalHoleCount;
423 out.
Print( 0,
"Drill report for %s\n",
TO_UTF8( brdFilename.GetFullName() ) );
427 out.
Print( 0,
"Copper Layer Stackup:\n" );
428 out.
Print( 0, separator );
432 int conventional_layer_num = 1;
436 out.
Print( 0,
" L%-2d: %-25s %s\n",
437 conventional_layer_num,
442 out.
Print( 0,
"\n\n" );
450 bool buildNPTHlist =
false;
453 for(
unsigned pair_ndx = 0; pair_ndx < hole_sets.size(); ++pair_ndx )
461 out.
Print( 0,
"Drill file '%s' contains\n",
464 out.
Print( 0,
" plated through holes:\n" );
465 out.
Print( 0, separator );
467 out.
Print( 0,
" Total plated holes count %u\n", totalHoleCount );
471 out.
Print( 0,
"Drill file '%s' contains\n",
474 out.
Print( 0,
" holes connecting layer pair: '%s and %s' (%s vias):\n",
477 pair.first ==
F_Cu || pair.second ==
B_Cu ?
"blind" :
"buried" );
479 out.
Print( 0, separator );
481 out.
Print( 0,
" Total plated holes count %u\n", totalHoleCount );
484 out.
Print( 0,
"\n\n" );
490 buildNPTHlist =
true;
496 out.
Print( 0,
"Not plated through holes are merged with plated holes\n" );
498 out.
Print( 0,
"Drill file '%s' contains\n",
502 out.
Print( 0,
" unplated through holes:\n" );
503 out.
Print( 0, separator );
505 out.
Print( 0,
" Total unplated holes count %u\n", totalHoleCount );
548 unsigned totalHoleCount = 0;
561 int tool_number = ii+1;
562 out.
Print( 0,
" T%d %2.3fmm %2.4f\" ", tool_number,
568 out.
Print( 0,
"(1 hole)\n" );
570 out.
Print( 0,
"(1 hole) (with 1 slot)\n" );
581 out.
Print( 0,
"\n" );
583 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 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
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(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.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
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
VECTOR2< int32_t > VECTOR2I