KiCad PCB EDA Suite
GERBER_PLOTTER Class Reference

#include <plotter_gerber.h>

Inheritance diagram for GERBER_PLOTTER:
PLOTTER

Public Member Functions

 GERBER_PLOTTER ()
 
virtual PLOT_FORMAT GetPlotterType () const override
 Returns the effective plot engine in use. More...
 
virtual bool StartPlot (const wxString &pageNumber) override
 Write GERBER header to file initialize global variable g_Plot_PlotOutputFile. More...
 
virtual bool EndPlot () override
 
virtual void SetCurrentLineWidth (int aLineWidth, void *aData=nullptr) override
 Set the line width for the next drawing. More...
 
virtual void SetDash (int aLineWidth, PLOT_DASH_TYPE aLineStyle) override
 
virtual void SetColor (const COLOR4D &aColor) override
 
virtual void SetViewport (const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
 Set the plot offset and scaling for the current plot. More...
 
virtual void Rect (const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
 
virtual void Circle (const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
 
virtual void ThickSegment (const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData) override
 
virtual void ThickArc (const VECTOR2I &aCentre, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, OUTLINE_MODE aTraceMode, void *aData) override
 
virtual void ThickArc (const EDA_SHAPE &aArcShape, OUTLINE_MODE aTraceMode, void *aData) override
 
virtual void ThickRect (const VECTOR2I &p1, const VECTOR2I &p2, int width, OUTLINE_MODE tracemode, void *aData) override
 
virtual void ThickCircle (const VECTOR2I &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData) override
 
virtual void FilledCircle (const VECTOR2I &pos, int diametre, OUTLINE_MODE tracemode, void *aData) override
 
virtual void PlotPoly (const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr) override
 Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence. More...
 
virtual void PlotPoly (const SHAPE_LINE_CHAIN &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr) override
 Draw a polygon ( filled or not ). More...
 
virtual void PenTo (const VECTOR2I &pos, char plume) override
 Moveto/lineto primitive, moves the 'pen' to the specified direction. More...
 
virtual void Text (const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, KIFONT::FONT *aFont=nullptr, void *aData=nullptr) override
 Draw text with the plotter. More...
 
virtual void FlashPadCircle (const VECTOR2I &pos, int diametre, OUTLINE_MODE trace_mode, void *aData) override
 Filled circular flashes are stored as apertures. More...
 
virtual void FlashPadOval (const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
 
virtual void FlashPadRect (const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
 
virtual void FlashPadRoundRect (const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
 
virtual void FlashPadCustom (const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, SHAPE_POLY_SET *aPolygons, OUTLINE_MODE aTraceMode, void *aData) override
 
virtual void FlashPadTrapez (const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
 Flash a trapezoidal pad. More...
 
virtual void FlashRegularPolygon (const VECTOR2I &aShapePos, int aDiameter, int aCornerCount, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
 Flash a regular polygon. More...
 
void FlashPadChamferRoundRect (const VECTOR2I &aShapePos, const VECTOR2I &aPadSize, int aCornerRadius, double aChamferRatio, int aChamferPositions, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aPlotMode, void *aData)
 Flash a chamfered round rect pad. More...
 
void PlotGerberRegion (const std::vector< VECTOR2I > &aCornerList, void *aData=nullptr)
 Plot a Gerber region: similar to PlotPoly but plot only filled polygon, and add the TA.AperFunction if aData contains this attribute, and clear it after plotting. More...
 
void PlotGerberRegion (const SHAPE_LINE_CHAIN &aPoly, void *aData=nullptr)
 
virtual void SetLayerPolarity (bool aPositive) override
 Change the plot polarity and begin a new layer. More...
 
virtual void SetGerberCoordinatesFormat (int aResolution, bool aUseInches=false) override
 Selection of Gerber units and resolution (number of digits in mantissa). More...
 
void UseX2format (bool aEnable)
 
void UseX2NetAttributes (bool aEnable)
 
void DisableApertMacros (bool aDisable)
 Disable Aperture Macro (AM) command, only for broken Gerber Readers. More...
 
virtual void StartBlock (void *aData) override
 Calling this function allows one to define the beginning of a group of drawing items (used in X2 format with netlist attributes). More...
 
virtual void EndBlock (void *aData) override
 Define the end of a group of drawing items the group is started by StartBlock(). More...
 
void ClearAllAttributes ()
 Remove (clear) all attributes from object attributes dictionary (TO. More...
 
int GetOrCreateAperture (const VECTOR2I &aSize, int aRadius, const EDA_ANGLE &aRotation, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
 
int GetOrCreateAperture (const std::vector< VECTOR2I > &aCorners, const EDA_ANGLE &aRotation, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
 
virtual void SetNegative (bool aNegative)
 
virtual void SetColorMode (bool aColorMode)
 Plot in B/W or color. More...
 
bool GetColorMode () const
 
void SetRenderSettings (RENDER_SETTINGS *aSettings)
 
RENDER_SETTINGSRenderSettings ()
 
virtual void SetPageSettings (const PAGE_INFO &aPageSettings)
 
PAGE_INFOPageSettings ()
 
virtual int GetCurrentLineWidth () const
 
virtual void SetCreator (const wxString &aCreator)
 
virtual void SetTitle (const wxString &aTitle)
 
void AddLineToHeader (const wxString &aExtraString)
 Add a line to the list of free lines to print at the beginning of the file. More...
 
void ClearHeaderLinesList ()
 Remove all lines from the list of free lines to print at the beginning of the file. More...
 
virtual bool OpenFile (const wxString &aFullFilename)
 Open or create the plot file aFullFilename. More...
 
double GetIUsPerDecimil () const
 The IUs per decimil are an essential scaling factor when plotting; they are set and saved when establishing the viewport. More...
 
int GetPlotterArcLowDef () const
 
int GetPlotterArcHighDef () const
 
virtual void Arc (const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aEnd, FILL_T aFill, int aWidth, int aMaxError)
 Generic fallback: arc rendered as a polyline. More...
 
virtual void BezierCurve (const VECTOR2I &aStart, const VECTOR2I &aControl1, const VECTOR2I &aControl2, const VECTOR2I &aEnd, int aTolerance, int aLineThickness=USE_DEFAULT_LINE_WIDTH)
 Generic fallback: Cubic Bezier curve rendered as a polyline In KiCad the bezier curves have 4 control points: start ctrl1 ctrl2 end. More...
 
void MoveTo (const VECTOR2I &pos)
 
void LineTo (const VECTOR2I &pos)
 
void FinishTo (const VECTOR2I &pos)
 
void PenFinish ()
 
virtual void PlotImage (const wxImage &aImage, const VECTOR2I &aPos, double aScaleFactor)
 Only PostScript plotters can plot bitmaps. More...
 
virtual void HyperlinkBox (const BOX2I &aBox, const wxString &aDestinationURL)
 Create a clickable hyperlink with a rectangular click area. More...
 
virtual void HyperlinkMenu (const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
 Create a clickable hyperlink menu with a rectangular click area. More...
 
virtual void Bookmark (const BOX2I &aBox, const wxString &aName, const wxString &aGroupName=wxEmptyString)
 Create a bookmark to a symbol. More...
 
void Marker (const VECTOR2I &position, int diametre, unsigned aShapeId)
 Draw a pattern shape number aShapeId, to coord position. More...
 
virtual void SetTextMode (PLOT_TEXT_MODE mode)
 Change the current text mode. More...
 
virtual void SetSvgCoordinatesFormat (unsigned aPrecision)
 Set the number of digits for mantissa in coordinates in mm for SVG plotter. More...
 

Static Public Member Functions

static wxString GetDefaultFileExtension ()
 

Static Public Attributes

static const int DO_NOT_SET_LINE_WIDTH = -2
 
static const int USE_DEFAULT_LINE_WIDTH = -1
 
static const unsigned MARKER_COUNT = 58
 Draw a marker (used for the drill map). More...
 

Protected Member Functions

virtual void Arc (const VECTOR2I &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, int aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
 Generic fallback: arc rendered as a polyline. More...
 
virtual void ThickArc (const VECTOR2I &aCentre, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, int aRadius, int aWidth, OUTLINE_MODE aTraceMode, void *aData) override
 
void plotRoundRectAsRegion (const VECTOR2I &aRectCenter, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient)
 Plot a round rect (a round rect shape in fact) as a Gerber region using lines and arcs for corners. More...
 
void plotArc (const VECTOR2I &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, int aRadius, bool aPlotInRegion)
 Plot a Gerber arc. More...
 
void plotArc (const SHAPE_ARC &aArc, bool aPlotInRegion)
 
void selectAperture (const VECTOR2I &aSize, int aRadius, const EDA_ANGLE &aRotation, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
 Pick an existing aperture or create a new one, matching the size, type and attributes. More...
 
void selectAperture (const std::vector< VECTOR2I > &aCorners, const EDA_ANGLE &aPolygonRotation, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
 Pick an existing aperture or create a new one, matching the aDiameter, aPolygonRotation, type and attributes. More...
 
void selectAperture (int aDiameter, const EDA_ANGLE &aRotation, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
 Pick an existing aperture or create a new one, matching the corner list, aRotDegree, type and attributes. More...
 
void emitDcode (const VECTOR2D &pt, int dcode)
 Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate. More...
 
void formatNetAttribute (GBR_NETLIST_METADATA *aData)
 Print a Gerber net attribute object record. More...
 
void clearNetAttribute ()
 Clear a Gerber net attribute record (clear object attribute dictionary) and output the clear object attribute dictionary command to gerber file has effect only if a net attribute is stored in m_objectAttributesDictionary. More...
 
void writeApertureList ()
 Generate the table of D codes. More...
 
void markerCircle (const VECTOR2I &pos, int radius)
 Plot a circle centered on the position. More...
 
void markerHBar (const VECTOR2I &pos, int radius)
 Plot a - bar centered on the position. More...
 
void markerSlash (const VECTOR2I &pos, int radius)
 Plot a / bar centered on the position. More...
 
void markerBackSlash (const VECTOR2I &pos, int radius)
 Plot a \ bar centered on the position. More...
 
void markerVBar (const VECTOR2I &pos, int radius)
 Plot a | bar centered on the position. More...
 
void markerSquare (const VECTOR2I &position, int radius)
 Plot a square centered on the position. More...
 
void markerLozenge (const VECTOR2I &position, int radius)
 Plot a lozenge centered on the position. More...
 
void segmentAsOval (const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode)
 Convert a thick segment and plot it as an oval. More...
 
void sketchOval (const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth)
 
virtual VECTOR2D userToDeviceCoordinates (const VECTOR2I &aCoordinate)
 Modify coordinates according to the orientation, scale factor, and offsets trace. More...
 
virtual VECTOR2D userToDeviceSize (const VECTOR2I &size)
 Modify size according to the plotter scale factors (VECTOR2I version, returns a VECTOR2D). More...
 
virtual double userToDeviceSize (double size) const
 Modify size according to the plotter scale factors (simple double version). More...
 
double GetDotMarkLenIU (int aLineWidth) const
 
double GetDashMarkLenIU (int aLineWidth) const
 
double GetDashGapLenIU (int aLineWidth) const
 

Protected Attributes

std::string m_objectAttributesDictionary
 
int m_apertureAttribute
 
FILE * workFile
 
FILE * finalFile
 
wxString m_workFilename
 
std::vector< APERTUREm_apertures
 
int m_currentApertureIdx
 
bool m_hasApertureRoundRect
 
bool m_hasApertureRotOval
 
bool m_hasApertureRotRect
 
bool m_hasApertureOutline4P
 
bool m_hasApertureChamferedRect
 
bool m_gerberUnitInch
 
int m_gerberUnitFmt
 
bool m_gerberDisableApertMacros
 
bool m_useX2format
 
bool m_useNetAttributes
 
APER_MACRO_FREEPOLY_LIST m_am_freepoly_list
 
double m_plotScale
 Plot scale - chosen by the user (even implicitly with 'fit in a4') More...
 
double m_IUsPerDecimil
 
double m_iuPerDeviceUnit
 
VECTOR2I m_plotOffset
 
bool m_plotMirror
 
bool m_mirrorIsHorizontal
 
bool m_yaxisReversed
 
FILE * m_outputFile
 Output file. More...
 
bool m_colorMode
 
bool m_negativeMode
 
int m_currentPenWidth
 
char m_penState
 
VECTOR2I m_penLastpos
 
wxString m_creator
 
wxString m_filename
 
wxString m_title
 
PAGE_INFO m_pageInfo
 
VECTOR2I m_paperSize
 
wxArrayString m_headerExtraLines
 
RENDER_SETTINGSm_renderSettings
 

Detailed Description

Definition at line 34 of file plotter_gerber.h.

Constructor & Destructor Documentation

◆ GERBER_PLOTTER()

GERBER_PLOTTER::GERBER_PLOTTER ( )

Definition at line 91 of file GERBER_plotter.cpp.

92{
93 workFile = nullptr;
94 finalFile = nullptr;
97
98 // number of digits after the point (number of digits of the mantissa
99 // Be careful: the Gerber coordinates are stored in an integer
100 // so 6 digits (inches) or 5 digits (mm) is a good value
101 // To avoid overflow, 7 digits (inches) or 6 digits is a max.
102 // with lower values than 6 digits (inches) or 5 digits (mm),
103 // Creating self-intersecting polygons from non-intersecting polygons
104 // happen easily.
105 m_gerberUnitInch = false;
106 m_gerberUnitFmt = 6;
107 m_useX2format = true;
108 m_useNetAttributes = true;
110
111 m_hasApertureRoundRect = false; // true is at least one round rect aperture is in use
112 m_hasApertureRotOval = false; // true is at least one oval rotated aperture is in use
113 m_hasApertureRotRect = false; // true is at least one rect. rotated aperture is in use
114 m_hasApertureOutline4P = false; // true is at least one rotated rect or trapezoid pad
115 // aperture is in use
116 m_hasApertureChamferedRect = false; // true is at least one chamfered rect
117 // (no rounded corner) is in use
118}
bool m_hasApertureChamferedRect
bool m_hasApertureOutline4P
bool m_hasApertureRoundRect
bool m_gerberDisableApertMacros

References finalFile, m_apertureAttribute, m_currentApertureIdx, m_gerberDisableApertMacros, m_gerberUnitFmt, m_gerberUnitInch, m_hasApertureChamferedRect, m_hasApertureOutline4P, m_hasApertureRotOval, m_hasApertureRotRect, m_hasApertureRoundRect, m_useNetAttributes, m_useX2format, and workFile.

Member Function Documentation

◆ AddLineToHeader()

void PLOTTER::AddLineToHeader ( const wxString &  aExtraString)
inlineinherited

Add a line to the list of free lines to print at the beginning of the file.

Parameters
aExtraStringis the string to print

Definition at line 168 of file plotter.h.

169 {
170 m_headerExtraLines.Add( aExtraString );
171 }
wxArrayString m_headerExtraLines
Definition: plotter.h:648

References PLOTTER::m_headerExtraLines.

Referenced by AddGerberX2Attribute(), AddGerberX2Header(), GERBER_WRITER::createDrillFile(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), and GENDRILL_WRITER_BASE::genDrillMapFile().

◆ Arc() [1/2]

void GERBER_PLOTTER::Arc ( const VECTOR2I aCentre,
const EDA_ANGLE aStartAngle,
const EDA_ANGLE aEndAngle,
int  aRadius,
FILL_T  aFill,
int  aWidth = USE_DEFAULT_LINE_WIDTH 
)
overrideprotectedvirtual

Generic fallback: arc rendered as a polyline.

Reimplemented from PLOTTER.

Definition at line 830 of file GERBER_plotter.cpp.

832{
833 SetCurrentLineWidth( aWidth );
834
835 // aFill is not used here.
836 plotArc( aCenter, aStartAngle, aEndAngle, aRadius, false );
837}
void plotArc(const VECTOR2I &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, int aRadius, bool aPlotInRegion)
Plot a Gerber arc.
virtual void SetCurrentLineWidth(int aLineWidth, void *aData=nullptr) override
Set the line width for the next drawing.

References plotArc(), and SetCurrentLineWidth().

Referenced by Circle(), and ThickArc().

◆ Arc() [2/2]

void PLOTTER::Arc ( const VECTOR2I aCenter,
const VECTOR2I aStart,
const VECTOR2I aEnd,
FILL_T  aFill,
int  aWidth,
int  aMaxError 
)
virtualinherited

Generic fallback: arc rendered as a polyline.

Reimplemented in HPGL_PLOTTER, PS_PLOTTER, and PDF_PLOTTER.

Definition at line 149 of file plotter.cpp.

151{
152 EDA_ANGLE startAngle( aStart - aCenter );
153 EDA_ANGLE endAngle( aEnd - aCenter );
154 int radius = ( aStart - aCenter ).EuclideanNorm();
155
156 if( startAngle > endAngle )
157 {
158 if( endAngle < ANGLE_0 )
159 endAngle.Normalize();
160 else
161 startAngle = startAngle.Normalize() - ANGLE_360;
162 }
163
164 // In old Kicad code, calls to Arc() using angles calls this function after
165 // swapping angles and negate them (to compensate the inverted Y axis).
166 // So to be compatible with Arc() calls with angles, do the same thing
167 std::swap( startAngle, endAngle );
168 startAngle = -startAngle;
169 endAngle = -endAngle;
170
171 Arc( aCenter, startAngle, endAngle, radius, aFill, aWidth );
172}
virtual void Arc(const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aEnd, FILL_T aFill, int aWidth, int aMaxError)
Generic fallback: arc rendered as a polyline.
Definition: plotter.cpp:149
static constexpr EDA_ANGLE & ANGLE_360
Definition: eda_angle.h:429
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:423
double EuclideanNorm(const VECTOR2I &vector)
Definition: trigo.h:129

References ANGLE_0, ANGLE_360, PLOTTER::Arc(), EuclideanNorm(), and EDA_ANGLE::Normalize().

Referenced by PLOTTER::Arc(), SCH_SHAPE::Plot(), LIB_SHAPE::Plot(), PLOTTER::sketchOval(), and PLOTTER::ThickArc().

◆ BezierCurve()

void PLOTTER::BezierCurve ( const VECTOR2I aStart,
const VECTOR2I aControl1,
const VECTOR2I aControl2,
const VECTOR2I aEnd,
int  aTolerance,
int  aLineThickness = USE_DEFAULT_LINE_WIDTH 
)
virtualinherited

Generic fallback: Cubic Bezier curve rendered as a polyline In KiCad the bezier curves have 4 control points: start ctrl1 ctrl2 end.

Reimplemented in SVG_PLOTTER.

Definition at line 224 of file plotter.cpp.

227{
228 // Generic fallback: Quadratic Bezier curve plotted as a polyline
229 int minSegLen = aLineThickness; // The segment min length to approximate a bezier curve
230
231 std::vector<VECTOR2I> ctrlPoints;
232 ctrlPoints.reserve( 4 );
233
234 ctrlPoints.push_back( aStart );
235 ctrlPoints.push_back( aControl1 );
236 ctrlPoints.push_back( aControl2 );
237 ctrlPoints.push_back( aEnd );
238
239 BEZIER_POLY bezier_converter( ctrlPoints );
240
241 std::vector<VECTOR2I> approxPoints;
242 bezier_converter.GetPoly( approxPoints, minSegLen );
243
244 SetCurrentLineWidth( aLineThickness );
245 MoveTo( aStart );
246
247 for( unsigned ii = 1; ii < approxPoints.size()-1; ii++ )
248 LineTo( approxPoints[ii] );
249
250 FinishTo( aEnd );
251}
Bezier curves to polygon converter.
Definition: bezier_curves.h:38
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:247
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:257
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
void LineTo(const VECTOR2I &pos)
Definition: plotter.h:252

References PLOTTER::FinishTo(), BEZIER_POLY::GetPoly(), PLOTTER::LineTo(), PLOTTER::MoveTo(), and PLOTTER::SetCurrentLineWidth().

Referenced by SVG_PLOTTER::BezierCurve(), BRDITEMS_PLOTTER::PlotFootprintShape(), and BRDITEMS_PLOTTER::PlotPcbShape().

◆ Bookmark()

virtual void PLOTTER::Bookmark ( const BOX2I aBox,
const wxString &  aName,
const wxString &  aGroupName = wxEmptyString 
)
inlinevirtualinherited

Create a bookmark to a symbol.

@aBox is the bounding box of the symbol @aSymbolReference is the symbol schematic ref

Reimplemented in PDF_PLOTTER.

Definition at line 457 of file plotter.h.

459 {
460 // NOP for most plotters.
461 }

Referenced by SCH_LABEL_BASE::Plot(), SCH_SYMBOL::Plot(), and PlotStandardLayer().

◆ Circle()

void GERBER_PLOTTER::Circle ( const VECTOR2I pos,
int  diametre,
FILL_T  fill,
int  width = USE_DEFAULT_LINE_WIDTH 
)
overridevirtual

Implements PLOTTER.

Definition at line 823 of file GERBER_plotter.cpp.

824{
825 Arc( aCenter, ANGLE_0, ANGLE_360, aDiameter / 2, aFill, aWidth );
826}
virtual void Arc(const VECTOR2I &aCenter, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, int aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.

References ANGLE_0, ANGLE_360, and Arc().

Referenced by FilledCircle(), FlashPadCircle(), and ThickCircle().

◆ ClearAllAttributes()

void GERBER_PLOTTER::ClearAllAttributes ( )

Remove (clear) all attributes from object attributes dictionary (TO.

and TA commands) similar to clearNetAttribute(), this is an unconditional reset of TO. and TA. attributes.

Definition at line 161 of file GERBER_plotter.cpp.

162{
163 // Remove all attributes from object attributes dictionary (TO. and TA commands)
164 if( m_useX2format )
165 fputs( "%TD*%\n", m_outputFile );
166 else
167 fputs( "G04 #@! TD*\n", m_outputFile );
168
170}
std::string m_objectAttributesDictionary
FILE * m_outputFile
Output file.
Definition: plotter.h:633

References m_objectAttributesDictionary, PLOTTER::m_outputFile, and m_useX2format.

Referenced by PLACEFILE_GERBER_WRITER::CreatePlaceFile().

◆ ClearHeaderLinesList()

void PLOTTER::ClearHeaderLinesList ( )
inlineinherited

Remove all lines from the list of free lines to print at the beginning of the file.

Definition at line 176 of file plotter.h.

177 {
178 m_headerExtraLines.Clear();
179 }

References PLOTTER::m_headerExtraLines.

Referenced by GENDRILL_WRITER_BASE::genDrillMapFile(), and StartPlotBoard().

◆ clearNetAttribute()

void GERBER_PLOTTER::clearNetAttribute ( )
protected

Clear a Gerber net attribute record (clear object attribute dictionary) and output the clear object attribute dictionary command to gerber file has effect only if a net attribute is stored in m_objectAttributesDictionary.

Definition at line 173 of file GERBER_plotter.cpp.

174{
175 // disable a Gerber net attribute (exists only in X2 with net attributes mode).
176 if( m_objectAttributesDictionary.empty() ) // No net attribute or not X2 mode
177 return;
178
179 // Remove all net attributes from object attributes dictionary
180 if( m_useX2format )
181 fputs( "%TD*%\n", m_outputFile );
182 else
183 fputs( "G04 #@! TD*\n", m_outputFile );
184
186}

References m_objectAttributesDictionary, PLOTTER::m_outputFile, and m_useX2format.

Referenced by EndBlock(), and formatNetAttribute().

◆ DisableApertMacros()

void GERBER_PLOTTER::DisableApertMacros ( bool  aDisable)
inline

Disable Aperture Macro (AM) command, only for broken Gerber Readers.

Regions will be used instead of AM shapes to draw complex shapes.

Parameters
aDisableuse true to disable Aperture Macro (AM) command.

Definition at line 208 of file plotter_gerber.h.

208{ m_gerberDisableApertMacros = aDisable; }

References m_gerberDisableApertMacros.

Referenced by GERBER_WRITER::createDrillFile(), GENDRILL_WRITER_BASE::genDrillMapFile(), and StartPlotBoard().

◆ emitDcode()

void GERBER_PLOTTER::emitDcode ( const VECTOR2D pt,
int  dcode 
)
protected

Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate.

For n decimal positions, see header generation in start_plot.

Definition at line 155 of file GERBER_plotter.cpp.

156{
157
158 fprintf( m_outputFile, "X%dY%dD%02d*\n", KiROUND( pt.x ), KiROUND( pt.y ), dcode );
159}
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85

References KiROUND(), PLOTTER::m_outputFile, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by FlashPadChamferRoundRect(), FlashPadCircle(), FlashPadCustom(), FlashPadOval(), FlashPadRect(), FlashPadRoundRect(), FlashPadTrapez(), FlashRegularPolygon(), and PenTo().

◆ EndBlock()

void GERBER_PLOTTER::EndBlock ( void *  aData)
overridevirtual

Define the end of a group of drawing items the group is started by StartBlock().

Used in X2 format with netlist attributes.

Parameters
aDatacan define any parameter

Reimplemented from PLOTTER.

Definition at line 196 of file GERBER_plotter.cpp.

197{
198 // Remove all net attributes from object attributes dictionary
200}
void clearNetAttribute()
Clear a Gerber net attribute record (clear object attribute dictionary) and output the clear object a...

References clearNetAttribute().

Referenced by GERBER_WRITER::createDrillFile(), and StartBlock().

◆ EndPlot()

bool GERBER_PLOTTER::EndPlot ( )
overridevirtual

Implements PLOTTER.

Definition at line 317 of file GERBER_plotter.cpp.

318{
319 char line[1024];
320
321 wxASSERT( m_outputFile );
322
323 /* Outfile is actually a temporary file i.e. workFile */
324 fputs( "M02*\n", m_outputFile );
325 fflush( m_outputFile );
326
327 fclose( workFile );
328 workFile = wxFopen( m_workFilename, wxT( "rt" ));
329 wxASSERT( workFile );
331
332 // Placement of apertures in RS274X
333 while( fgets( line, 1024, workFile ) )
334 {
335 fputs( line, m_outputFile );
336
337 char* substr = strtok( line, "\n\r" );
338
339 if( substr && strcmp( substr, "G04 APERTURE LIST*" ) == 0 )
340 {
341 // Add aperture list macro:
345 {
346 fputs( "G04 Aperture macros list*\n", m_outputFile );
347
350
353
356
359
361 {
366 }
367
369 {
370 // aperture sizes are in inch or mm, regardless the
371 // coordinates format
372 double fscale = 0.0001 * m_plotScale / m_IUsPerDecimil; // inches
373
374 if(! m_gerberUnitInch )
375 fscale *= 25.4; // size in mm
376
378 }
379
380 fputs( "G04 Aperture macros list end*\n", m_outputFile );
381 }
382
384 fputs( "G04 APERTURE END LIST*\n", m_outputFile );
385 }
386 }
387
388 fclose( workFile );
389 fclose( finalFile );
390 ::wxRemoveFile( m_workFilename );
391 m_outputFile = nullptr;
392
393 return true;
394}
void Format(FILE *aOutput, double aIu2GbrMacroUnit)
print the aperture macro list to aOutput
APER_MACRO_FREEPOLY_LIST m_am_freepoly_list
void writeApertureList()
Generate the table of D codes.
wxString m_workFilename
double m_plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
Definition: plotter.h:616
double m_IUsPerDecimil
Definition: plotter.h:622
#define APER_MACRO_OUTLINE4P_HEADER
#define APER_MACRO_OUTLINE6P_HEADER
#define APER_MACRO_ROT_RECT_HEADER
#define APER_MACRO_OUTLINE8P_HEADER
#define APER_MACRO_SHAPE_OVAL_HEADER
#define APER_MACRO_OUTLINE5P_HEADER
#define APER_MACRO_ROUNDRECT_HEADER
#define APER_MACRO_OUTLINE7P_HEADER

References APER_MACRO_FREEPOLY_LIST::AmCount(), APER_MACRO_OUTLINE4P_HEADER, APER_MACRO_OUTLINE5P_HEADER, APER_MACRO_OUTLINE6P_HEADER, APER_MACRO_OUTLINE7P_HEADER, APER_MACRO_OUTLINE8P_HEADER, APER_MACRO_ROT_RECT_HEADER, APER_MACRO_ROUNDRECT_HEADER, APER_MACRO_SHAPE_OVAL_HEADER, finalFile, APER_MACRO_FREEPOLY_LIST::Format(), m_am_freepoly_list, m_gerberUnitInch, m_hasApertureChamferedRect, m_hasApertureOutline4P, m_hasApertureRotOval, m_hasApertureRotRect, m_hasApertureRoundRect, PLOTTER::m_IUsPerDecimil, PLOTTER::m_outputFile, PLOTTER::m_plotScale, m_workFilename, workFile, and writeApertureList().

Referenced by GERBER_WRITER::createDrillFile(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), PCBNEW_JOBS_HANDLER::JobExportGerber(), and PCBNEW_JOBS_HANDLER::JobExportGerbers().

◆ FilledCircle()

void GERBER_PLOTTER::FilledCircle ( const VECTOR2I pos,
int  diametre,
OUTLINE_MODE  tracemode,
void *  aData 
)
overridevirtual

Reimplemented from PLOTTER.

Definition at line 1254 of file GERBER_plotter.cpp.

1256{
1257 // A filled circle is a graphic item, not a pad.
1258 // So it is drawn, not flashed.
1259 GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
1260
1261 if( gbr_metadata )
1262 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1263
1264 if( tracemode == FILLED )
1265 {
1266 // Draw a circle of diameter = diameter/2 with a line thickness = radius,
1267 // To create a filled circle
1268 SetCurrentLineWidth( diametre/2, gbr_metadata );
1269 Circle( pos, diametre/2, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH );
1270 }
1271 else
1272 {
1274 Circle( pos, diametre, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH );
1275 }
1276}
Metadata which can be added in a gerber file as attribute in X2 format.
Definition: gbr_metadata.h:205
GBR_NETLIST_METADATA m_NetlistMetadata
An item to handle object attribute.
Definition: gbr_metadata.h:262
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
Print a Gerber net attribute object record.
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:114
static const int DO_NOT_SET_LINE_WIDTH
Definition: plotter.h:113
@ FILLED
Definition: outline_mode.h:27

References Circle(), PLOTTER::DO_NOT_SET_LINE_WIDTH, FILLED, formatNetAttribute(), GBR_METADATA::m_NetlistMetadata, NO_FILL, SetCurrentLineWidth(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

◆ FinishTo()

◆ FlashPadChamferRoundRect()

void GERBER_PLOTTER::FlashPadChamferRoundRect ( const VECTOR2I aShapePos,
const VECTOR2I aPadSize,
int  aCornerRadius,
double  aChamferRatio,
int  aChamferPositions,
const EDA_ANGLE aPadOrient,
OUTLINE_MODE  aPlotMode,
void *  aData 
)

Flash a chamfered round rect pad.

Parameters
aShapePosis the position of the pad shape.
aPadSizeis the size of the rectangle.
aCornerRadiusis the radius of rounded corners.
aChamferRatiois the chamfer value (ratio < 0.5 between smallest size and chamfer).
aChamferPositionsis the identifier of the corners to chamfer: 0 = no chamfer 1 = TOP_LEFT 2 = TOP_RIGHT 4 = BOTTOM_LEFT 8 = BOTTOM_RIGHT
aPadOrientis the rotation of the shape.
aPlotModeis the drawing mode, FILLED or SKETCH.
aDatais the a reference to Gerber attributes descr.

Definition at line 1747 of file GERBER_plotter.cpp.

1752{
1753 GBR_METADATA gbr_metadata;
1754
1755 if( aData )
1756 gbr_metadata = *static_cast<GBR_METADATA*>( aData );
1757
1758 VECTOR2I pos_device = userToDeviceCoordinates( aShapePos );
1759 SHAPE_POLY_SET outline;
1760 std::vector<VECTOR2I> cornerList;
1761
1762 bool hasRoundedCorner = aCornerRadius != 0 && aChamferPositions != 15;
1763
1764#ifdef GBR_USE_MACROS_FOR_CHAMFERED_RECT
1765 // Sketch mode or round rect shape or Apert Macros disabled
1766 if( aPlotMode != FILLED || hasRoundedCorner || m_gerberDisableApertMacros )
1767#endif
1768 {
1769 TransformRoundChamferedRectToPolygon( outline, aShapePos, aPadSize, aPadOrient,
1770 aCornerRadius, aChamferRatio, aChamferPositions, 0,
1772
1773 // Build the corner list
1774 const SHAPE_LINE_CHAIN& corners = outline.Outline(0);
1775
1776 for( int ii = 0; ii < corners.PointCount(); ii++ )
1777 cornerList.emplace_back( corners.CPoint( ii ).x, corners.CPoint( ii ).y );
1778
1779 // Close the polygon
1780 cornerList.push_back( cornerList[0] );
1781
1782 if( aPlotMode == SKETCH )
1783 PlotPoly( cornerList, FILL_T::NO_FILL, GetCurrentLineWidth(), &gbr_metadata );
1784 else
1785 {
1786#ifdef GBR_USE_MACROS_FOR_CHAMFERED_ROUND_RECT
1788 {
1789 PlotGerberRegion( cornerList, &gbr_metadata );
1790 }
1791 else
1792 {
1793 // An AM will be created. the shape must be in position 0,0 and orientation 0
1794 // to be able to reuse the same AM for pads having the same shape
1795 for( size_t ii = 0; ii < cornerList.size(); ii++ )
1796 {
1797 cornerList[ii] -= aShapePos;
1798 RotatePoint( cornerList[ii], -aPadOrient );
1799 }
1800
1801 selectAperture( cornerList, aPadOrient, APERTURE::AM_FREE_POLYGON,
1802 gbr_metadata.GetApertureAttrib() );
1803 formatNetAttribute( &gbr_metadata.m_NetlistMetadata );
1804
1805 emitDcode( pos_device, 3 );
1806 }
1807#else
1808 PlotGerberRegion( cornerList, &gbr_metadata );
1809#endif
1810 }
1811
1812 return;
1813 }
1814
1815 // Build the chamfered polygon (4 to 8 corners )
1816 TransformRoundChamferedRectToPolygon( outline, VECTOR2I( 0, 0 ), aPadSize, ANGLE_0, 0,
1817 aChamferRatio, aChamferPositions, 0,
1819
1820 // Build the corner list
1821 const SHAPE_LINE_CHAIN& corners = outline.Outline(0);
1822
1823 // Generate the polygon (4 to 8 corners )
1824 for( int ii = 0; ii < corners.PointCount(); ii++ )
1825 cornerList.emplace_back( corners.CPoint( ii ).x, corners.CPoint( ii ).y );
1826
1827 switch( cornerList.size() )
1828 {
1829 case 4:
1831 selectAperture( cornerList, aPadOrient, APERTURE::APER_MACRO_OUTLINE4P,
1832 gbr_metadata.GetApertureAttrib() );
1833 break;
1834
1835 case 5:
1837 selectAperture( cornerList, aPadOrient, APERTURE::APER_MACRO_OUTLINE5P,
1838 gbr_metadata.GetApertureAttrib() );
1839 break;
1840
1841 case 6:
1843 selectAperture( cornerList, aPadOrient, APERTURE::APER_MACRO_OUTLINE6P,
1844 gbr_metadata.GetApertureAttrib() );
1845 break;
1846
1847 case 7:
1849 selectAperture( cornerList, aPadOrient, APERTURE::APER_MACRO_OUTLINE7P,
1850 gbr_metadata.GetApertureAttrib() );
1851 break;
1852
1853 case 8:
1855 selectAperture( cornerList, aPadOrient, APERTURE::APER_MACRO_OUTLINE8P,
1856 gbr_metadata.GetApertureAttrib() );
1857 break;
1858
1859 default:
1860 wxLogMessage( wxS( "FlashPadChamferRoundRect(): Unexpected number of corners (%d)" ),
1861 (int)cornerList.size() );
1862 break;
1863 }
1864
1865 formatNetAttribute( &gbr_metadata.m_NetlistMetadata );
1866
1867 emitDcode( pos_device, 3 );
1868}
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB GetApertureAttrib()
Definition: gbr_metadata.h:214
void selectAperture(const VECTOR2I &aSize, int aRadius, const EDA_ANGLE &aRotation, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
Pick an existing aperture or create a new one, matching the size, type and attributes.
void PlotGerberRegion(const std::vector< VECTOR2I > &aCornerList, void *aData=nullptr)
Plot a Gerber region: similar to PlotPoly but plot only filled polygon, and add the TA....
void emitDcode(const VECTOR2D &pt, int dcode)
Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate.
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr) override
Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence.
virtual VECTOR2D userToDeviceCoordinates(const VECTOR2I &aCoordinate)
Modify coordinates according to the orientation, scale factor, and offsets trace.
Definition: plotter.cpp:90
int GetPlotterArcHighDef() const
Definition: plotter.h:213
virtual int GetCurrentLineWidth() const
Definition: plotter.h:153
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aInflate, int aError, ERROR_LOC aErrorLoc)
Convert a rectangle with rounded corners and/or chamfered corners to a polygon.
@ ERROR_INSIDE
@ SKETCH
Definition: outline_mode.h:26
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

References APERTURE::AM_FREE_POLYGON, ANGLE_0, APERTURE::APER_MACRO_OUTLINE4P, APERTURE::APER_MACRO_OUTLINE5P, APERTURE::APER_MACRO_OUTLINE6P, APERTURE::APER_MACRO_OUTLINE7P, APERTURE::APER_MACRO_OUTLINE8P, SHAPE_LINE_CHAIN::CPoint(), emitDcode(), ERROR_INSIDE, FILLED, formatNetAttribute(), GBR_METADATA::GetApertureAttrib(), PLOTTER::GetCurrentLineWidth(), PLOTTER::GetPlotterArcHighDef(), m_gerberDisableApertMacros, m_hasApertureChamferedRect, m_hasApertureOutline4P, GBR_METADATA::m_NetlistMetadata, NO_FILL, SHAPE_POLY_SET::Outline(), PlotGerberRegion(), PlotPoly(), SHAPE_LINE_CHAIN::PointCount(), RotatePoint(), selectAperture(), SKETCH, TransformRoundChamferedRectToPolygon(), PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by BRDITEMS_PLOTTER::PlotPad().

◆ FlashPadCircle()

void GERBER_PLOTTER::FlashPadCircle ( const VECTOR2I pos,
int  diametre,
OUTLINE_MODE  trace_mode,
void *  aData 
)
overridevirtual

Filled circular flashes are stored as apertures.

Implements PLOTTER.

Definition at line 1279 of file GERBER_plotter.cpp.

1281{
1282 VECTOR2I size( diametre, diametre );
1283 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1284
1285 if( trace_mode == SKETCH )
1286 {
1287 if( gbr_metadata )
1288 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1289
1291
1292 Circle( pos, diametre, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH );
1293 }
1294 else
1295 {
1296 VECTOR2D pos_dev = userToDeviceCoordinates( pos );
1297
1298 int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
1299 selectAperture( size, 0, ANGLE_0, APERTURE::AT_CIRCLE, aperture_attrib );
1300
1301 if( gbr_metadata )
1302 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1303
1304 emitDcode( pos_dev, 3 );
1305 }
1306}

References ANGLE_0, APERTURE::AT_CIRCLE, Circle(), PLOTTER::DO_NOT_SET_LINE_WIDTH, emitDcode(), formatNetAttribute(), GBR_METADATA::GetApertureAttrib(), GBR_METADATA::m_NetlistMetadata, NO_FILL, selectAperture(), SetCurrentLineWidth(), SKETCH, PLOTTER::USE_DEFAULT_LINE_WIDTH, and PLOTTER::userToDeviceCoordinates().

Referenced by GERBER_WRITER::createDrillFile(), and PLACEFILE_GERBER_WRITER::CreatePlaceFile().

◆ FlashPadCustom()

void GERBER_PLOTTER::FlashPadCustom ( const VECTOR2I aPadPos,
const VECTOR2I aSize,
const EDA_ANGLE aPadOrient,
SHAPE_POLY_SET aPolygons,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual
Parameters
aPadPosPosition of the shape.
aSizeis the size of round reference pad.
aPadOrientis the pad rotation, used only with aperture macros (Gerber plotter).
aPolygonsthe shape as polygon set.
aTraceModeis the drawing mode, FILLED or SKETCH.
aDataan auxiliary info (mainly for gerber format attributes).

Implements PLOTTER.

Definition at line 1678 of file GERBER_plotter.cpp.

1682{
1683 // A Pad custom is plotted as polygon (a region in Gerber language).
1684 GBR_METADATA gbr_metadata;
1685
1686 if( aData )
1687 gbr_metadata = *static_cast<GBR_METADATA*>( aData );
1688
1689 SHAPE_POLY_SET polyshape = aPolygons->CloneDropTriangulation();
1690
1691 if( aTraceMode != FILLED )
1692 {
1694 }
1695
1696 std::vector<VECTOR2I> cornerList;
1697
1698 for( int cnt = 0; cnt < polyshape.OutlineCount(); ++cnt )
1699 {
1700 SHAPE_LINE_CHAIN& poly = polyshape.Outline( cnt );
1701
1702 cornerList.clear();
1703
1704 for( int ii = 0; ii < poly.PointCount(); ++ii )
1705 cornerList.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
1706
1707 // Close polygon
1708 cornerList.push_back( cornerList[0] );
1709
1710 if( aTraceMode == SKETCH )
1711 {
1712 PlotPoly( cornerList, FILL_T::NO_FILL, GetCurrentLineWidth(), &gbr_metadata );
1713 }
1714 else
1715 {
1716#ifdef GBR_USE_MACROS_FOR_CUSTOM_PAD
1718 || cornerList.size() > GBR_MACRO_FOR_CUSTOM_PAD_MAX_CORNER_COUNT )
1719 {
1720 PlotGerberRegion( cornerList, &gbr_metadata );
1721 }
1722 else
1723 {
1724 // An AM will be created. the shape must be in position 0,0 and orientation 0
1725 // to be able to reuse the same AM for pads having the same shape
1726 for( size_t ii = 0; ii < cornerList.size(); ii++ )
1727 {
1728 cornerList[ii] -= aPadPos;
1729 RotatePoint( cornerList[ii], -aOrient );
1730 }
1731
1732 VECTOR2D pos_dev = userToDeviceCoordinates( aPadPos );
1733 selectAperture( cornerList, aOrient, APERTURE::AM_FREE_POLYGON,
1734 gbr_metadata.GetApertureAttrib() );
1735 formatNetAttribute( &gbr_metadata.m_NetlistMetadata );
1736
1737 emitDcode( pos_dev, 3 );
1738 }
1739#else
1740 PlotGerberRegion( cornerList, &gbr_metadata );
1741#endif
1742 }
1743 }
1744}
#define GBR_MACRO_FOR_CUSTOM_PAD_MAX_CORNER_COUNT
int OutlineCount() const
Return the number of vertices in a given outline/hole.
SHAPE_POLY_SET CloneDropTriangulation() const
Creates a new empty polygon in the set and returns its index.

References APERTURE::AM_FREE_POLYGON, SHAPE_POLY_SET::CloneDropTriangulation(), SHAPE_LINE_CHAIN::CPoint(), emitDcode(), FILLED, formatNetAttribute(), GBR_MACRO_FOR_CUSTOM_PAD_MAX_CORNER_COUNT, GBR_METADATA::GetApertureAttrib(), PLOTTER::GetCurrentLineWidth(), m_gerberDisableApertMacros, GBR_METADATA::m_NetlistMetadata, NO_FILL, SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), PlotGerberRegion(), PlotPoly(), SHAPE_LINE_CHAIN::PointCount(), RotatePoint(), selectAperture(), SetCurrentLineWidth(), SKETCH, PLOTTER::USE_DEFAULT_LINE_WIDTH, PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ FlashPadOval()

void GERBER_PLOTTER::FlashPadOval ( const VECTOR2I aPadPos,
const VECTOR2I aSize,
const EDA_ANGLE aPadOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual
Parameters
aPadPosPosition of the shape (center of the rectangle.
aSizeis the size of oblong shape.
aPadOrientThe rotation of the shape.
aTraceModeis the drawing mode, FILLED or SKETCH.
aDataan auxiliary info (mainly for gerber format attributes).

Implements PLOTTER.

Definition at line 1309 of file GERBER_plotter.cpp.

1311{
1312 wxASSERT( m_outputFile );
1313
1314 VECTOR2I size( aSize );
1315 EDA_ANGLE orient( aOrient );
1316 orient.Normalize();
1317 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1318
1319 // Flash a vertical or horizontal shape (this is a basic aperture).
1320 if( orient.IsCardinal() && aTraceMode == FILLED )
1321 {
1322 if( orient.IsCardinal90() )
1323 std::swap( size.x, size.y );
1324
1325 VECTOR2I pos_device = userToDeviceCoordinates( aPos );
1326 int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
1327 selectAperture( size, 0, ANGLE_0, APERTURE::AT_OVAL, aperture_attrib );
1328
1329 if( gbr_metadata )
1330 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1331
1332 emitDcode( pos_device, 3 );
1333 }
1334 else // Plot pad as region.
1335 // Only regions and flashed items accept a object attribute TO.P for the pin name
1336 {
1337 if( aTraceMode == FILLED )
1338 {
1339 #ifdef GBR_USE_MACROS_FOR_ROTATED_OVAL
1341 #endif
1342 {
1343 m_hasApertureRotOval = true;
1344 // We are using a aperture macro that expect size.y < size.x
1345 // i.e draw a horizontal line for rotation = 0.0
1346 // size.x = length, size.y = width
1347 if( size.x < size.y )
1348 {
1349 std::swap( size.x, size.y );
1350 orient += ANGLE_90;
1351
1352 if( orient > ANGLE_180 )
1353 orient -= ANGLE_180;
1354 }
1355
1356 VECTOR2I pos_device = userToDeviceCoordinates( aPos );
1357 int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
1358 selectAperture( size, 0, orient, APERTURE::AM_ROTATED_OVAL, aperture_attrib );
1359
1360 if( gbr_metadata )
1361 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1362
1363 emitDcode( pos_device, 3 );
1364 return;
1365 }
1366 // Draw the oval as round rect pad with a radius = 50% min size)
1367 // In gerber file, it will be drawn as a region with arcs, and can be
1368 // detected as pads (similar to a flashed pad)
1369 FlashPadRoundRect( aPos, aSize, std::min( aSize.x, aSize.y ) / 2, orient, FILLED,
1370 aData );
1371 }
1372 else // Non filled shape: plot outlines:
1373 {
1374 if( size.x > size.y )
1375 {
1376 std::swap( size.x, size.y );
1377
1378 if( orient < ANGLE_270 )
1379 orient += ANGLE_90;
1380 else
1381 orient -= ANGLE_270;
1382 }
1383
1384 sketchOval( aPos, size, orient, -1 );
1385 }
1386 }
1387}
virtual void FlashPadRoundRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData) override
void sketchOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth)
Definition: plotter.cpp:496
static constexpr EDA_ANGLE & ANGLE_180
Definition: eda_angle.h:427
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:425
static constexpr EDA_ANGLE & ANGLE_270
Definition: eda_angle.h:428

References APERTURE::AM_ROTATED_OVAL, ANGLE_0, ANGLE_180, ANGLE_270, ANGLE_90, APERTURE::AT_OVAL, emitDcode(), FILLED, FlashPadRoundRect(), formatNetAttribute(), GBR_METADATA::GetApertureAttrib(), EDA_ANGLE::IsCardinal(), EDA_ANGLE::IsCardinal90(), m_gerberDisableApertMacros, m_hasApertureRotOval, GBR_METADATA::m_NetlistMetadata, PLOTTER::m_outputFile, EDA_ANGLE::Normalize(), selectAperture(), PLOTTER::sketchOval(), PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GERBER_WRITER::createDrillFile().

◆ FlashPadRect()

void GERBER_PLOTTER::FlashPadRect ( const VECTOR2I aPadPos,
const VECTOR2I aSize,
const EDA_ANGLE aPadOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual
Parameters
aPadPosPosition of the shape (center of the rectangle).
aSizeis the size of rounded rect.
aPadOrientThe rotation of the shape.
aTraceModeis the drawing mode, FILLED or SKETCH.
aDataan auxiliary info (mainly for gerber format attributes).

Implements PLOTTER.

Definition at line 1390 of file GERBER_plotter.cpp.

1393{
1394 wxASSERT( m_outputFile );
1395
1396 VECTOR2I size( aSize );
1397 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1398
1399 // Horizontal / vertical rect can use a basic aperture (not a macro)
1400 // so use it for rotation n*90 deg
1401 if( aOrient.IsCardinal() )
1402 {
1403 if( aOrient.IsCardinal90() )
1404 // Build the not rotated equivalent shape:
1405 std::swap( size.x, size.y );
1406
1407 if( aTraceMode == SKETCH )
1408 {
1409 if( gbr_metadata )
1410 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1411
1413 Rect( VECTOR2I( pos.x - ( size.x / 2 ), pos.y - (size.y / 2 ) ),
1414 VECTOR2I( pos.x + ( size.x / 2 ), pos.y + (size.y / 2 ) ),
1416 }
1417 else
1418 {
1419 VECTOR2I pos_device = userToDeviceCoordinates( pos );
1420 int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
1421 selectAperture( size, 0, ANGLE_0, APERTURE::AT_RECT, aperture_attrib );
1422
1423 if( gbr_metadata )
1424 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1425
1426 emitDcode( pos_device, 3 );
1427 }
1428 }
1429 else
1430 {
1431 #ifdef GBR_USE_MACROS_FOR_ROTATED_RECT
1432 if( aTraceMode != SKETCH && !m_gerberDisableApertMacros )
1433 {
1434 m_hasApertureRotRect = true;
1435
1436 VECTOR2I pos_device = userToDeviceCoordinates( pos );
1437 int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
1438 selectAperture( size, 0, aOrient, APERTURE::AM_ROT_RECT, aperture_attrib );
1439
1440 if( gbr_metadata )
1441 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1442
1443 emitDcode( pos_device, 3 );
1444 }
1445 else
1446 #endif
1447 {
1448 // plot pad shape as Gerber region
1449 VECTOR2I coord[4];
1450 // coord[0] is assumed the lower left
1451 // coord[1] is assumed the upper left
1452 // coord[2] is assumed the upper right
1453 // coord[3] is assumed the lower right
1454
1455 coord[0].x = -size.x/2; // lower left
1456 coord[0].y = size.y/2;
1457 coord[1].x = -size.x/2; // upper left
1458 coord[1].y = -size.y/2;
1459 coord[2].x = size.x/2; // upper right
1460 coord[2].y = -size.y/2;
1461 coord[3].x = size.x/2; // lower right
1462 coord[3].y = size.y/2;
1463
1464 FlashPadTrapez( pos, coord, aOrient, aTraceMode, aData );
1465 }
1466 }
1467}
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
virtual void FlashPadTrapez(const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
Flash a trapezoidal pad.

References APERTURE::AM_ROT_RECT, ANGLE_0, APERTURE::AT_RECT, emitDcode(), FlashPadTrapez(), formatNetAttribute(), GBR_METADATA::GetApertureAttrib(), PLOTTER::GetCurrentLineWidth(), EDA_ANGLE::IsCardinal(), EDA_ANGLE::IsCardinal90(), m_gerberDisableApertMacros, m_hasApertureRotRect, GBR_METADATA::m_NetlistMetadata, PLOTTER::m_outputFile, NO_FILL, Rect(), selectAperture(), SetCurrentLineWidth(), SKETCH, PLOTTER::USE_DEFAULT_LINE_WIDTH, PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ FlashPadRoundRect()

void GERBER_PLOTTER::FlashPadRoundRect ( const VECTOR2I aPadPos,
const VECTOR2I aSize,
int  aCornerRadius,
const EDA_ANGLE aOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual
Parameters
aPadPosPosition of the shape (center of the rectangle.
aSizeis the size of rounded rect.
aCornerRadiusRadius of the rounded corners.
aOrientThe rotation of the shape.
aTraceModeis the drawing mode, FILLED or SKETCH.
aDataan auxiliary info (mainly for gerber format attributes).

Implements PLOTTER.

Definition at line 1469 of file GERBER_plotter.cpp.

1473{
1474 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1475
1476 if( aTraceMode != FILLED )
1477 {
1478 SHAPE_POLY_SET outline;
1479 TransformRoundChamferedRectToPolygon( outline, aPadPos, aSize, aOrient, aCornerRadius, 0.0,
1481
1483
1484 std::vector<VECTOR2I> cornerList;
1485 // TransformRoundRectToPolygon creates only one convex polygon
1486 SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
1487 cornerList.reserve( poly.PointCount() + 1 );
1488
1489 for( int ii = 0; ii < poly.PointCount(); ++ii )
1490 cornerList.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
1491
1492 // Close polygon
1493 cornerList.push_back( cornerList[0] );
1494
1495 // plot outlines
1496 PlotPoly( cornerList, FILL_T::NO_FILL, GetCurrentLineWidth(), gbr_metadata );
1497 }
1498 else
1499 {
1500 #ifdef GBR_USE_MACROS_FOR_ROUNDRECT
1502 #endif
1503 {
1505
1506 VECTOR2D pos_dev = userToDeviceCoordinates( aPadPos );
1507 int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
1508 selectAperture( aSize, aCornerRadius, aOrient, APERTURE::AM_ROUND_RECT,
1509 aperture_attrib );
1510
1511 if( gbr_metadata )
1512 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1513
1514 emitDcode( pos_dev, 3 );
1515 return;
1516 }
1517
1518 // A Pad RoundRect is plotted as a Gerber region.
1519 // Initialize region metadata:
1520 bool clearTA_AperFunction = false; // true if a TA.AperFunction is used
1521
1522 if( gbr_metadata )
1523 {
1524 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1525 std::string attrib = gbr_metadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
1526
1527 if( !attrib.empty() )
1528 {
1529 fputs( attrib.c_str(), m_outputFile );
1530 clearTA_AperFunction = true;
1531 }
1532 }
1533
1534 // Plot the region using arcs in corners.
1535 plotRoundRectAsRegion( aPadPos, aSize, aCornerRadius, aOrient );
1536
1537 // Clear the TA attribute, to avoid the next item to inherit it:
1538 if( clearTA_AperFunction )
1539 {
1540 if( m_useX2format )
1541 fputs( "%TD.AperFunction*%\n", m_outputFile );
1542 else
1543 fputs( "G04 #@! TD.AperFunction*\n", m_outputFile );
1544 }
1545 }
1546}
static std::string FormatAttribute(GBR_APERTURE_ATTRIB aAttribute, bool aUseX1StructuredComment)
GBR_APERTURE_METADATA m_ApertureMetadata
An item to handle aperture attribute.
Definition: gbr_metadata.h:257
void plotRoundRectAsRegion(const VECTOR2I &aRectCenter, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient)
Plot a round rect (a round rect shape in fact) as a Gerber region using lines and arcs for corners.

References APERTURE::AM_ROUND_RECT, SHAPE_LINE_CHAIN::CPoint(), emitDcode(), ERROR_INSIDE, FILLED, GBR_APERTURE_METADATA::FormatAttribute(), formatNetAttribute(), GBR_METADATA::GetApertureAttrib(), PLOTTER::GetCurrentLineWidth(), PLOTTER::GetPlotterArcHighDef(), GBR_METADATA::m_ApertureMetadata, m_gerberDisableApertMacros, m_hasApertureRoundRect, GBR_METADATA::m_NetlistMetadata, PLOTTER::m_outputFile, m_useX2format, NO_FILL, SHAPE_POLY_SET::Outline(), PlotPoly(), plotRoundRectAsRegion(), SHAPE_LINE_CHAIN::PointCount(), selectAperture(), SetCurrentLineWidth(), TransformRoundChamferedRectToPolygon(), PLOTTER::USE_DEFAULT_LINE_WIDTH, PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by FlashPadOval().

◆ FlashPadTrapez()

void GERBER_PLOTTER::FlashPadTrapez ( const VECTOR2I aPadPos,
const VECTOR2I aCorners,
const EDA_ANGLE aPadOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual

Flash a trapezoidal pad.

Parameters
aPadPosis the the position of the shape.
aCornersis the list of 4 corners positions, relative to the shape position, pad orientation 0.
aPadOrientis the rotation of the shape.
aTraceModeis the drawing mode, FILLED or SKETCH.
aDataan auxiliary info (mainly for gerber format attributes).

Implements PLOTTER.

Definition at line 1871 of file GERBER_plotter.cpp.

1875{
1876 // polygon corners list
1877 std::vector<VECTOR2I> cornerList = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
1878
1879 // Draw the polygon and fill the interior as required
1880 for( unsigned ii = 0; ii < 4; ii++ )
1881 {
1882 RotatePoint( cornerList[ii], aPadOrient );
1883 cornerList[ii] += aPadPos;
1884 }
1885
1886 // Close the polygon
1887 cornerList.push_back( cornerList[0] );
1888
1889 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1890 GBR_METADATA metadata;
1891
1892 if( gbr_metadata )
1893 metadata = *gbr_metadata;
1894
1895 if( aTraceMode == SKETCH )
1896 {
1897 PlotPoly( cornerList, FILL_T::NO_FILL, GetCurrentLineWidth(), &metadata );
1898 return;
1899 }
1900
1901 // Plot a filled polygon:
1902 #ifdef GBR_USE_MACROS_FOR_TRAPEZOID
1904 #endif
1905 {
1907 VECTOR2D pos_dev = userToDeviceCoordinates( aPadPos );
1908 // polygon corners list
1909 std::vector<VECTOR2I> corners = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
1910 int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
1911 selectAperture( corners, aPadOrient, APERTURE::APER_MACRO_OUTLINE4P, aperture_attrib );
1912
1913 if( gbr_metadata )
1914 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1915
1916 emitDcode( pos_dev, 3 );
1917 return;
1918 }
1919
1920 PlotGerberRegion( cornerList, &metadata );
1921}

References APERTURE::APER_MACRO_OUTLINE4P, emitDcode(), formatNetAttribute(), GBR_METADATA::GetApertureAttrib(), PLOTTER::GetCurrentLineWidth(), m_gerberDisableApertMacros, m_hasApertureOutline4P, GBR_METADATA::m_NetlistMetadata, NO_FILL, PlotGerberRegion(), PlotPoly(), RotatePoint(), selectAperture(), SKETCH, and PLOTTER::userToDeviceCoordinates().

Referenced by FlashPadRect().

◆ FlashRegularPolygon()

void GERBER_PLOTTER::FlashRegularPolygon ( const VECTOR2I aShapePos,
int  aDiameter,
int  aCornerCount,
const EDA_ANGLE aOrient,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual

Flash a regular polygon.

Useful only in Gerber files to flash a regular polygon.

Parameters
aShapePosis the center of the circle containing the polygon.
aRadiusis the radius of the circle containing the polygon.
aCornerCountis the number of vertices.
aOrientis the polygon rotation.
aDatais a auxiliary parameter used (if needed) to handle extra info specific to the plotter.

Implements PLOTTER.

Definition at line 1924 of file GERBER_plotter.cpp.

1927{
1928 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1929
1930 GBR_METADATA metadata;
1931
1932 if( gbr_metadata )
1933 metadata = *gbr_metadata;
1934
1935 if( aTraceMode == SKETCH )
1936 {
1937 // Build the polygon:
1938 std::vector<VECTOR2I> cornerList;
1939
1940 EDA_ANGLE angle_delta = ANGLE_360 / aCornerCount;
1941
1942 for( int ii = 0; ii < aCornerCount; ii++ )
1943 {
1944 EDA_ANGLE rot = aOrient + ( angle_delta * ii );
1945 VECTOR2I vertice( aDiameter / 2, 0 );
1946
1947 RotatePoint( vertice, rot );
1948 vertice += aShapePos;
1949 cornerList.push_back( vertice );
1950 }
1951
1952 cornerList.push_back( cornerList[0] ); // Close the shape
1953
1954 PlotPoly( cornerList, FILL_T::NO_FILL, GetCurrentLineWidth(), &gbr_metadata );
1955 }
1956 else
1957 {
1958 VECTOR2D pos_dev = userToDeviceCoordinates( aShapePos );
1959 int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
1960
1961 APERTURE::APERTURE_TYPE apert_type =
1963 selectAperture( aDiameter, aOrient, apert_type, aperture_attrib );
1964
1965 if( gbr_metadata )
1966 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1967
1968 emitDcode( pos_dev, 3 );
1969 }
1970}

References ANGLE_360, APERTURE::AT_REGULAR_POLY3, emitDcode(), formatNetAttribute(), GBR_METADATA::GetApertureAttrib(), PLOTTER::GetCurrentLineWidth(), GBR_METADATA::m_NetlistMetadata, NO_FILL, PlotPoly(), RotatePoint(), selectAperture(), SKETCH, and PLOTTER::userToDeviceCoordinates().

Referenced by PLACEFILE_GERBER_WRITER::CreatePlaceFile().

◆ formatNetAttribute()

void GERBER_PLOTTER::formatNetAttribute ( GBR_NETLIST_METADATA aData)
protected

Print a Gerber net attribute object record.

In a gerber file, a net attribute is owned by a graphic object formatNetAttribute must be called before creating the object. The generated string depends on the type of netlist info.

Parameters
aDatacontains the data to format.

Definition at line 203 of file GERBER_plotter.cpp.

204{
205 // print a Gerber net attribute record.
206 // it is added to the object attributes dictionary
207 // On file, only modified or new attributes are printed.
208 if( aData == nullptr )
209 return;
210
211 if( !m_useNetAttributes )
212 return;
213
214 bool useX1StructuredComment = !m_useX2format;
215
216 bool clearDict;
217 std::string short_attribute_string;
218
219 if( !FormatNetAttribute( short_attribute_string, m_objectAttributesDictionary,
220 aData, clearDict, useX1StructuredComment ) )
221 return;
222
223 if( clearDict )
225
226 if( !short_attribute_string.empty() )
227 fputs( short_attribute_string.c_str(), m_outputFile );
228
229 if( m_useX2format && !aData->m_ExtraData.IsEmpty() )
230 {
231 std::string extra_data = TO_UTF8( aData->m_ExtraData );
232 fputs( extra_data.c_str(), m_outputFile );
233 }
234}
wxString m_ExtraData
a string to print after TO object attributes, if not empty it is printed "as this"
bool FormatNetAttribute(std::string &aPrintedText, std::string &aLastNetAttributes, const GBR_NETLIST_METADATA *aData, bool &aClearPreviousAttributes, bool aUseX1StructuredComment)
Generate the string to set a net attribute for a graphic object to print to a gerber file.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96

References clearNetAttribute(), FormatNetAttribute(), GBR_NETLIST_METADATA::m_ExtraData, m_objectAttributesDictionary, PLOTTER::m_outputFile, m_useNetAttributes, m_useX2format, and TO_UTF8.

Referenced by FilledCircle(), FlashPadChamferRoundRect(), FlashPadCircle(), FlashPadCustom(), FlashPadOval(), FlashPadRect(), FlashPadRoundRect(), FlashPadTrapez(), FlashRegularPolygon(), PlotPoly(), Text(), ThickArc(), ThickCircle(), ThickRect(), and ThickSegment().

◆ GetColorMode()

◆ GetCurrentLineWidth()

◆ GetDashGapLenIU()

double PLOTTER::GetDashGapLenIU ( int  aLineWidth) const
protectedinherited

Definition at line 143 of file plotter.cpp.

144{
145 return userToDeviceSize( m_renderSettings->GetGapLength( aLineWidth ) );
146}
double GetGapLength(int aLineWidth) const
virtual VECTOR2D userToDeviceSize(const VECTOR2I &size)
Modify size according to the plotter scale factors (VECTOR2I version, returns a VECTOR2D).
Definition: plotter.cpp:115
RENDER_SETTINGS * m_renderSettings
Definition: plotter.h:650

References KIGFX::RENDER_SETTINGS::GetGapLength(), PLOTTER::m_renderSettings, and PLOTTER::userToDeviceSize().

Referenced by PS_PLOTTER::SetDash(), PDF_PLOTTER::SetDash(), and SVG_PLOTTER::setSVGPlotStyle().

◆ GetDashMarkLenIU()

double PLOTTER::GetDashMarkLenIU ( int  aLineWidth) const
protectedinherited

◆ GetDefaultFileExtension()

static wxString GERBER_PLOTTER::GetDefaultFileExtension ( )
inlinestatic

Definition at line 44 of file plotter_gerber.h.

45 {
46 return wxString( wxT( "gbr" ) );
47 }

Referenced by GetDefaultPlotExtension().

◆ GetDotMarkLenIU()

double PLOTTER::GetDotMarkLenIU ( int  aLineWidth) const
protectedinherited

◆ GetIUsPerDecimil()

double PLOTTER::GetIUsPerDecimil ( ) const
inlineinherited

The IUs per decimil are an essential scaling factor when plotting; they are set and saved when establishing the viewport.

Here they can be get back again

Definition at line 210 of file plotter.h.

210{ return m_IUsPerDecimil; }

References PLOTTER::m_IUsPerDecimil.

Referenced by PlotDrawingSheet().

◆ GetOrCreateAperture() [1/2]

int GERBER_PLOTTER::GetOrCreateAperture ( const std::vector< VECTOR2I > &  aCorners,
const EDA_ANGLE aRotation,
APERTURE::APERTURE_TYPE  aType,
int  aApertureAttribute 
)
Parameters
aCornersis the corner list.
aRotationis the rotation of tool.
aTypeis the type ( shape ) of tool that can manage a list of corners (polygon).
aApertureAttributeis an aperture attribute of the tool (a tool can have only one attribute) 0 = no specific attribute.
Returns
an index to the aperture in aperture list which meets the data and type of tool if the aperture does not exist, it is created and entered in aperture list.

Definition at line 448 of file GERBER_plotter.cpp.

451{
452 int last_D_code = 9;
453
454 // For APERTURE::AM_FREE_POLYGON aperture macros, we need to create the macro
455 // on the fly, because due to the fact the vertex count is not a constant we
456 // cannot create a static definition.
457 if( APERTURE::AM_FREE_POLYGON == aType )
458 {
459 int idx = m_am_freepoly_list.FindAm( aCorners );
460
461 if( idx < 0 )
462 m_am_freepoly_list.Append( aCorners );
463 }
464
465 // Search an existing aperture
466 for( int idx = 0; idx < (int)m_apertures.size(); ++idx )
467 {
468 APERTURE* tool = &m_apertures[idx];
469
470 last_D_code = tool->m_DCode;
471
472 if( (tool->m_Type == aType) &&
473 (tool->m_Corners.size() == aCorners.size() ) &&
474 (tool->m_Rotation == aRotation) &&
475 (tool->m_ApertureAttribute == aApertureAttribute) )
476 {
477 // A candidate is found. the corner lists must be similar
478 bool is_same = polyCompare( tool->m_Corners, aCorners );
479
480 if( is_same )
481 return idx;
482 }
483 }
484
485 // Allocate a new aperture
486 APERTURE new_tool;
487
488 new_tool.m_Corners = aCorners;
489 new_tool.m_Size = VECTOR2I( 0, 0 ); // Not used
490 new_tool.m_Type = aType;
491 new_tool.m_Radius = 0; // Not used
492 new_tool.m_Rotation = aRotation;
493 new_tool.m_DCode = last_D_code + 1;
494 new_tool.m_ApertureAttribute = aApertureAttribute;
495
496 m_apertures.push_back( new_tool );
497
498 return m_apertures.size() - 1;
499}
static bool polyCompare(const std::vector< VECTOR2I > &aPolygon, const std::vector< VECTOR2I > &aTestPolygon)
EDA_ANGLE m_Rotation
std::vector< VECTOR2I > m_Corners
APERTURE_TYPE m_Type
void Append(const std::vector< VECTOR2I > &aPolygon)
append a new APER_MACRO_FREEPOLY containing the polygon aPolygon to the current list
int FindAm(const std::vector< VECTOR2I > &aPolygon) const
std::vector< APERTURE > m_apertures

References APERTURE::AM_FREE_POLYGON, APER_MACRO_FREEPOLY_LIST::Append(), APER_MACRO_FREEPOLY_LIST::FindAm(), m_am_freepoly_list, APERTURE::m_ApertureAttribute, m_apertures, APERTURE::m_Corners, APERTURE::m_DCode, APERTURE::m_Radius, APERTURE::m_Rotation, APERTURE::m_Size, APERTURE::m_Type, and polyCompare().

◆ GetOrCreateAperture() [2/2]

int GERBER_PLOTTER::GetOrCreateAperture ( const VECTOR2I aSize,
int  aRadius,
const EDA_ANGLE aRotation,
APERTURE::APERTURE_TYPE  aType,
int  aApertureAttribute 
)
Parameters
aSizeis the size of tool.
aRadiusis the radius used for some shapes tool (oval, roundrect macros).
aRotationis the rotation of tool (primitives round, oval rect accept only 0.0).
aTypeis the type ( shape ) of tool.
aApertureAttributeis an aperture attribute of the tool (a tool can have only one attribute) 0 = no specific attribute.
Returns
an index to the aperture in aperture list which meets the size and type of tool if the aperture does not exist, it is created and entered in aperture list.

Definition at line 415 of file GERBER_plotter.cpp.

418{
419 int last_D_code = 9;
420
421 // Search an existing aperture
422 for( int idx = 0; idx < (int)m_apertures.size(); ++idx )
423 {
424 APERTURE* tool = &m_apertures[idx];
425 last_D_code = tool->m_DCode;
426
427 if( (tool->m_Type == aType) && (tool->m_Size == aSize) &&
428 (tool->m_Radius == aRadius) && (tool->m_Rotation == aRotation) &&
429 (tool->m_ApertureAttribute == aApertureAttribute) )
430 return idx;
431 }
432
433 // Allocate a new aperture
434 APERTURE new_tool;
435 new_tool.m_Size = aSize;
436 new_tool.m_Type = aType;
437 new_tool.m_Radius = aRadius;
438 new_tool.m_Rotation = aRotation;
439 new_tool.m_DCode = last_D_code + 1;
440 new_tool.m_ApertureAttribute = aApertureAttribute;
441
442 m_apertures.push_back( new_tool );
443
444 return m_apertures.size() - 1;
445}

References APERTURE::m_ApertureAttribute, m_apertures, APERTURE::m_DCode, APERTURE::m_Radius, APERTURE::m_Rotation, APERTURE::m_Size, and APERTURE::m_Type.

Referenced by selectAperture().

◆ GetPlotterArcHighDef()

◆ GetPlotterArcLowDef()

int PLOTTER::GetPlotterArcLowDef ( ) const
inlineinherited

Definition at line 212 of file plotter.h.

212{ return m_IUsPerDecimil * 8; }

References PLOTTER::m_IUsPerDecimil.

◆ GetPlotterType()

virtual PLOT_FORMAT GERBER_PLOTTER::GetPlotterType ( ) const
inlineoverridevirtual

Returns the effective plot engine in use.

It's not very OO but for now is required since some things are only done with some output devices (like drill marks, emitted only for postscript

Implements PLOTTER.

Definition at line 39 of file plotter_gerber.h.

40 {
42 }

References GERBER.

◆ HyperlinkBox()

virtual void PLOTTER::HyperlinkBox ( const BOX2I aBox,
const wxString &  aDestinationURL 
)
inlinevirtualinherited

Create a clickable hyperlink with a rectangular click area.

@aBox is the rectangular click target @aDestinationURL is the target URL

Reimplemented in PDF_PLOTTER.

Definition at line 435 of file plotter.h.

436 {
437 // NOP for most plotters.
438 }

Referenced by SCH_TEXT::Plot(), and SCH_TEXTBOX::Plot().

◆ HyperlinkMenu()

virtual void PLOTTER::HyperlinkMenu ( const BOX2I aBox,
const std::vector< wxString > &  aDestURLs 
)
inlinevirtualinherited

Create a clickable hyperlink menu with a rectangular click area.

@aBox is the rectangular click target @aDestURLs is the list of target URLs for the menu

Reimplemented in PDF_PLOTTER.

Definition at line 446 of file plotter.h.

447 {
448 // NOP for most plotters.
449 }

Referenced by SCH_FIELD::Plot(), SCH_LABEL_BASE::Plot(), SCH_LINE::Plot(), SCH_SHEET::Plot(), SCH_SYMBOL::Plot(), and PlotInteractiveLayer().

◆ LineTo()

◆ Marker()

void PLOTTER::Marker ( const VECTOR2I position,
int  diametre,
unsigned  aShapeId 
)
inherited

Draw a pattern shape number aShapeId, to coord position.

Parameters
aPositionis the position of the marker.
aDiameteris the diameter of the marker.
aShapeIdis the index (used to generate forms characters).

Definition at line 359 of file plotter.cpp.

360{
361 int radius = diametre / 2;
362
363 /* Marker are composed by a series of 'parts' superimposed; not every
364 combination make sense, obviously. Since they are used in order I
365 tried to keep the uglier/more complex constructions at the end.
366 Also I avoided the |/ |\ -/ -\ construction because they're *very*
367 ugly... if needed they could be added anyway... I'd like to see
368 a board with more than 58 drilling/slotting tools!
369 If Visual C++ supported the 0b literals they would be optimally
370 and easily encoded as an integer array. We have to do with octal */
371 static const unsigned char marker_patterns[MARKER_COUNT] = {
372
373 // Bit order: O Square Lozenge - | \ /
374 // First choice: simple shapes
375 0003, // X
376 0100, // O
377 0014, // +
378 0040, // Sq
379 0020, // Lz
380
381 // Two simple shapes
382 0103, // X O
383 0017, // X +
384 0043, // X Sq
385 0023, // X Lz
386 0114, // O +
387 0140, // O Sq
388 0120, // O Lz
389 0054, // + Sq
390 0034, // + Lz
391 0060, // Sq Lz
392
393 // Three simple shapes
394 0117, // X O +
395 0143, // X O Sq
396 0123, // X O Lz
397 0057, // X + Sq
398 0037, // X + Lz
399 0063, // X Sq Lz
400 0154, // O + Sq
401 0134, // O + Lz
402 0074, // + Sq Lz
403
404 // Four simple shapes
405 0174, // O Sq Lz +
406 0163, // X O Sq Lz
407 0157, // X O Sq +
408 0137, // X O Lz +
409 0077, // X Sq Lz +
410
411 // This draws *everything *
412 0177, // X O Sq Lz +
413
414 // Here we use the single bars... so the cross is forbidden
415 0110, // O -
416 0104, // O |
417 0101, // O /
418 0050, // Sq -
419 0044, // Sq |
420 0041, // Sq /
421 0030, // Lz -
422 0024, // Lz |
423 0021, // Lz /
424 0150, // O Sq -
425 0144, // O Sq |
426 0141, // O Sq /
427 0130, // O Lz -
428 0124, // O Lz |
429 0121, // O Lz /
430 0070, // Sq Lz -
431 0064, // Sq Lz |
432 0061, // Sq Lz /
433 0170, // O Sq Lz -
434 0164, // O Sq Lz |
435 0161, // O Sq Lz /
436
437 // Last resort: the backlash component (easy to confound)
438 0102, // \ O
439 0042, // \ Sq
440 0022, // \ Lz
441 0142, // \ O Sq
442 0122, // \ O Lz
443 0062, // \ Sq Lz
444 0162 // \ O Sq Lz
445 };
446
447 if( aShapeId >= MARKER_COUNT )
448 {
449 // Fallback shape
450 markerCircle( position, radius );
451 }
452 else
453 {
454 // Decode the pattern and draw the corresponding parts
455 unsigned char pat = marker_patterns[aShapeId];
456
457 if( pat & 0001 )
458 markerSlash( position, radius );
459
460 if( pat & 0002 )
461 markerBackSlash( position, radius );
462
463 if( pat & 0004 )
464 markerVBar( position, radius );
465
466 if( pat & 0010 )
467 markerHBar( position, radius );
468
469 if( pat & 0020 )
470 markerLozenge( position, radius );
471
472 if( pat & 0040 )
473 markerSquare( position, radius );
474
475 if( pat & 0100 )
476 markerCircle( position, radius );
477 }
478}
static const unsigned MARKER_COUNT
Draw a marker (used for the drill map).
Definition: plotter.h:466
void markerSlash(const VECTOR2I &pos, int radius)
Plot a / bar centered on the position.
Definition: plotter.cpp:338
void markerHBar(const VECTOR2I &pos, int radius)
Plot a - bar centered on the position.
Definition: plotter.cpp:331
void markerCircle(const VECTOR2I &pos, int radius)
Plot a circle centered on the position.
Definition: plotter.cpp:298
void markerLozenge(const VECTOR2I &position, int radius)
Plot a lozenge centered on the position.
Definition: plotter.cpp:304
void markerBackSlash(const VECTOR2I &pos, int radius)
Plot a \ bar centered on the position.
Definition: plotter.cpp:345
void markerVBar(const VECTOR2I &pos, int radius)
Plot a | bar centered on the position.
Definition: plotter.cpp:352
void markerSquare(const VECTOR2I &position, int radius)
Plot a square centered on the position.
Definition: plotter.cpp:270

References PLOTTER::MARKER_COUNT, PLOTTER::markerBackSlash(), PLOTTER::markerCircle(), PLOTTER::markerHBar(), PLOTTER::markerLozenge(), PLOTTER::markerSlash(), PLOTTER::markerSquare(), and PLOTTER::markerVBar().

Referenced by GENDRILL_WRITER_BASE::genDrillMapFile(), and GENDRILL_WRITER_BASE::plotDrillMarks().

◆ markerBackSlash()

void PLOTTER::markerBackSlash ( const VECTOR2I pos,
int  radius 
)
protectedinherited

Plot a \ bar centered on the position.

Building block for markers

Definition at line 345 of file plotter.cpp.

346{
347 MoveTo( VECTOR2I( pos.x + radius, pos.y - radius ) );
348 FinishTo( VECTOR2I( pos.x - radius, pos.y + radius ) );
349}

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ markerCircle()

void PLOTTER::markerCircle ( const VECTOR2I pos,
int  radius 
)
protectedinherited

Plot a circle centered on the position.

Building block for markers

Definition at line 298 of file plotter.cpp.

299{
300 Circle( position, radius * 2, FILL_T::NO_FILL, GetCurrentLineWidth() );
301}
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0

References PLOTTER::Circle(), PLOTTER::GetCurrentLineWidth(), and NO_FILL.

Referenced by PLOTTER::Marker().

◆ markerHBar()

void PLOTTER::markerHBar ( const VECTOR2I pos,
int  radius 
)
protectedinherited

Plot a - bar centered on the position.

Building block for markers

Definition at line 331 of file plotter.cpp.

332{
333 MoveTo( VECTOR2I( pos.x - radius, pos.y ) );
334 FinishTo( VECTOR2I( pos.x + radius, pos.y ) );
335}

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ markerLozenge()

void PLOTTER::markerLozenge ( const VECTOR2I position,
int  radius 
)
protectedinherited

Plot a lozenge centered on the position.

Building block for markers

Definition at line 304 of file plotter.cpp.

305{
306 std::vector<VECTOR2I> corner_list;
307 VECTOR2I corner;
308
309 corner_list.reserve( 4 );
310
311 corner.x = position.x;
312 corner.y = position.y + radius;
313 corner_list.push_back( corner );
314 corner.x = position.x + radius;
315 corner.y = position.y,
316 corner_list.push_back( corner );
317 corner.x = position.x;
318 corner.y = position.y - radius;
319 corner_list.push_back( corner );
320 corner.x = position.x - radius;
321 corner.y = position.y;
322 corner_list.push_back( corner );
323 corner.x = position.x;
324 corner.y = position.y + radius;
325 corner_list.push_back( corner );
326
328}
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).

References PLOTTER::GetCurrentLineWidth(), NO_FILL, PLOTTER::PlotPoly(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ markerSlash()

void PLOTTER::markerSlash ( const VECTOR2I pos,
int  radius 
)
protectedinherited

Plot a / bar centered on the position.

Building block for markers

Definition at line 338 of file plotter.cpp.

339{
340 MoveTo( VECTOR2I( pos.x - radius, pos.y - radius ) );
341 FinishTo( VECTOR2I( pos.x + radius, pos.y + radius ) );
342}

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ markerSquare()

void PLOTTER::markerSquare ( const VECTOR2I position,
int  radius 
)
protectedinherited

Plot a square centered on the position.

Building block for markers

Definition at line 270 of file plotter.cpp.

271{
272 double r = KiROUND( radius / 1.4142 );
273 std::vector<VECTOR2I> corner_list;
274 VECTOR2I corner;
275
276 corner_list.reserve( 4 );
277
278 corner.x = position.x + r;
279 corner.y = position.y + r;
280 corner_list.push_back( corner );
281 corner.x = position.x + r;
282 corner.y = position.y - r;
283 corner_list.push_back( corner );
284 corner.x = position.x - r;
285 corner.y = position.y - r;
286 corner_list.push_back( corner );
287 corner.x = position.x - r;
288 corner.y = position.y + r;
289 corner_list.push_back( corner );
290 corner.x = position.x + r;
291 corner.y = position.y + r;
292 corner_list.push_back( corner );
293
295}

References PLOTTER::GetCurrentLineWidth(), KiROUND(), NO_FILL, PLOTTER::PlotPoly(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ markerVBar()

void PLOTTER::markerVBar ( const VECTOR2I pos,
int  radius 
)
protectedinherited

Plot a | bar centered on the position.

Building block for markers

Definition at line 352 of file plotter.cpp.

353{
354 MoveTo( VECTOR2I( pos.x, pos.y - radius ) );
355 FinishTo( VECTOR2I( pos.x, pos.y + radius ) );
356}

References PLOTTER::FinishTo(), PLOTTER::MoveTo(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::Marker().

◆ MoveTo()

◆ OpenFile()

bool PLOTTER::OpenFile ( const wxString &  aFullFilename)
virtualinherited

Open or create the plot file aFullFilename.

Parameters
aFullFilenameis the full file name of the file to create.
Returns
true if success, false if the file cannot be created/opened.

Virtual because some plotters use ascii files, some others binary files (PDF) The base class open the file in text mode

Reimplemented in PDF_PLOTTER.

Definition at line 74 of file plotter.cpp.

75{
76 m_filename = aFullFilename;
77
78 wxASSERT( !m_outputFile );
79
80 // Open the file in text mode (not suitable for all plotters but only for most of them.
81 m_outputFile = wxFopen( m_filename, wxT( "wt" ) );
82
83 if( m_outputFile == nullptr )
84 return false ;
85
86 return true;
87}
wxString m_filename
Definition: plotter.h:643

References PLOTTER::m_filename, and PLOTTER::m_outputFile.

Referenced by GERBER_WRITER::createDrillFile(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), EESCHEMA_JOBS_HANDLER::doSymExportSvg(), GENDRILL_WRITER_BASE::genDrillMapFile(), SCH_PLOTTER::plotOneSheetDXF(), SCH_PLOTTER::plotOneSheetHpgl(), SCH_PLOTTER::plotOneSheetPS(), SCH_PLOTTER::plotOneSheetSVG(), StartPlotBoard(), and SYMBOL_EDIT_FRAME::SVGPlotSymbol().

◆ PageSettings()

PAGE_INFO & PLOTTER::PageSettings ( )
inlineinherited

Definition at line 144 of file plotter.h.

144{ return m_pageInfo; }
PAGE_INFO m_pageInfo
Definition: plotter.h:645

References PLOTTER::m_pageInfo.

Referenced by SCH_PLOTTER::plotOneSheetPDF(), SCH_PLOTTER::plotOneSheetPS(), and SCH_PLOTTER::plotOneSheetSVG().

◆ PenFinish()

void PLOTTER::PenFinish ( )
inlineinherited

Definition at line 263 of file plotter.h.

264 {
265 // The point is not important with Z motion
266 PenTo( VECTOR2I( 0, 0 ), 'Z' );
267 }

References PLOTTER::PenTo().

Referenced by HPGL_PLOTTER::Circle(), HPGL_PLOTTER::FlashPadCircle(), PlotPoly(), DXF_PLOTTER::PlotPoly(), HPGL_PLOTTER::PlotPoly(), HPGL_PLOTTER::Rect(), and PLOTTER::Text().

◆ PenTo()

void GERBER_PLOTTER::PenTo ( const VECTOR2I pos,
char  plume 
)
overridevirtual

Moveto/lineto primitive, moves the 'pen' to the specified direction.

Parameters
posis the target position.
plumespecifies the kind of motion: 'U' only moves the pen, 'D' draw a line from the current position and 'Z' finish the drawing and returns the 'pen' to rest (flushes the trace).

Implements PLOTTER.

Definition at line 780 of file GERBER_plotter.cpp.

781{
782 wxASSERT( m_outputFile );
783 VECTOR2D pos_dev = userToDeviceCoordinates( aPos );
784
785 switch( plume )
786 {
787 case 'Z':
788 break;
789
790 case 'U':
791 emitDcode( pos_dev, 2 );
792 break;
793
794 case 'D':
795 emitDcode( pos_dev, 1 );
796 }
797
798 m_penState = plume;
799}
char m_penState
Definition: plotter.h:639

References emitDcode(), PLOTTER::m_outputFile, PLOTTER::m_penState, and PLOTTER::userToDeviceCoordinates().

◆ plotArc() [1/2]

void GERBER_PLOTTER::plotArc ( const SHAPE_ARC aArc,
bool  aPlotInRegion 
)
protected

Definition at line 840 of file GERBER_plotter.cpp.

841{
842 VECTOR2I start( aArc.GetP0() );
843 VECTOR2I end( aArc.GetP1() );
844 VECTOR2I center( aArc.GetCenter() );
845
846 if( !aPlotInRegion )
847 MoveTo( start);
848 else
849 LineTo( start );
850
851 VECTOR2D devEnd = userToDeviceCoordinates( end );
852 VECTOR2D devCenter = userToDeviceCoordinates( center - start );
853
854 // We need to know if the arc is CW or CCW in device coordinates, so build this arc.
855 SHAPE_ARC deviceArc( userToDeviceCoordinates( start ),
856 userToDeviceCoordinates( aArc.GetArcMid() ), devEnd, 0 );
857
858 fprintf( m_outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
859
860 if( deviceArc.IsClockwise() )
861 fprintf( m_outputFile, "G02*\n" ); // Active circular interpolation, CW
862 else
863 fprintf( m_outputFile, "G03*\n" ); // Active circular interpolation, CCW
864
865 fprintf( m_outputFile, "X%dY%dI%dJ%dD01*\n",
866 KiROUND( devEnd.x ), KiROUND( devEnd.y ),
867 KiROUND( devCenter.x ), KiROUND( devCenter.y ) );
868
869 fprintf( m_outputFile, "G01*\n" ); // Back to linear interpolate (perhaps useless here).
870}
const VECTOR2I & GetArcMid() const
Definition: shape_arc.h:114
const VECTOR2I & GetP1() const
Definition: shape_arc.h:113
VECTOR2I GetCenter() const
Definition: shape_arc.cpp:433
const VECTOR2I & GetP0() const
Definition: shape_arc.h:112

References SHAPE_ARC::GetArcMid(), SHAPE_ARC::GetCenter(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), SHAPE_ARC::IsClockwise(), KiROUND(), PLOTTER::LineTo(), PLOTTER::m_outputFile, PLOTTER::MoveTo(), PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ plotArc() [2/2]

void GERBER_PLOTTER::plotArc ( const VECTOR2I aCenter,
const EDA_ANGLE aStartAngle,
const EDA_ANGLE aEndAngle,
int  aRadius,
bool  aPlotInRegion 
)
protected

Plot a Gerber arc.

If aPlotInRegion = true, the current pen position will not be initialized to the arc start position, and therefore the arc can be used to define a region outline item a line will be created from current position to arc start point. If aPlotInRegion = false, the current pen position will be initialized to the arc start position, to plot an usual arc item. The line thickness is not initialized in plotArc, and must be initialized before calling it if needed.

Definition at line 873 of file GERBER_plotter.cpp.

875{
876 VECTOR2I start, end;
877 start.x = aCenter.x + KiROUND( aRadius * aStartAngle.Cos() );
878 start.y = aCenter.y - KiROUND( aRadius * aStartAngle.Sin() );
879
880 if( !aPlotInRegion )
881 MoveTo( start );
882 else
883 LineTo( start );
884
885 end.x = aCenter.x + KiROUND( aRadius * aEndAngle.Cos() );
886 end.y = aCenter.y - KiROUND( aRadius * aEndAngle.Sin() );
887 VECTOR2D devEnd = userToDeviceCoordinates( end );
888 VECTOR2D devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
889
890 fprintf( m_outputFile, "G75*\n" ); // Multiquadrant (360 degrees) mode
891
892 if( aStartAngle < aEndAngle )
893 fprintf( m_outputFile, "G03*\n" ); // Active circular interpolation, CCW
894 else
895 fprintf( m_outputFile, "G02*\n" ); // Active circular interpolation, CW
896
897 fprintf( m_outputFile, "X%dY%dI%dJ%dD01*\n",
898 KiROUND( devEnd.x ), KiROUND( devEnd.y ),
899 KiROUND( devCenter.x ), KiROUND( devCenter.y ) );
900
901 fprintf( m_outputFile, "G01*\n" ); // Back to linear interpolate (perhaps useless here).
902}
double Sin() const
Definition: eda_angle.h:206
double Cos() const
Definition: eda_angle.h:221

References EDA_ANGLE::Cos(), KiROUND(), PLOTTER::LineTo(), PLOTTER::m_outputFile, PLOTTER::MoveTo(), EDA_ANGLE::Sin(), PLOTTER::userToDeviceCoordinates(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Arc(), PlotPoly(), and plotRoundRectAsRegion().

◆ PlotGerberRegion() [1/2]

void GERBER_PLOTTER::PlotGerberRegion ( const SHAPE_LINE_CHAIN aPoly,
void *  aData = nullptr 
)

Definition at line 905 of file GERBER_plotter.cpp.

906{
907 if( aPoly.PointCount() <= 2 )
908 return;
909
910 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
911
912 bool clearTA_AperFunction = false; // true if a TA.AperFunction is used
913
914 if( gbr_metadata )
915 {
916 std::string attrib = gbr_metadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
917
918 if( !attrib.empty() )
919 {
920 fputs( attrib.c_str(), m_outputFile );
921 clearTA_AperFunction = true;
922 }
923 }
924
925 PlotPoly( aPoly, FILL_T::FILLED_SHAPE, 0 , gbr_metadata );
926
927 // Clear the TA attribute, to avoid the next item to inherit it:
928 if( clearTA_AperFunction )
929 {
930 if( m_useX2format )
931 {
932 fputs( "%TD.AperFunction*%\n", m_outputFile );
933 }
934 else
935 {
936 fputs( "G04 #@! TD.AperFunction*\n", m_outputFile );
937 }
938 }
939}
@ FILLED_SHAPE

References FILLED_SHAPE, GBR_APERTURE_METADATA::FormatAttribute(), GBR_METADATA::m_ApertureMetadata, PLOTTER::m_outputFile, m_useX2format, PlotPoly(), and SHAPE_LINE_CHAIN::PointCount().

◆ PlotGerberRegion() [2/2]

void GERBER_PLOTTER::PlotGerberRegion ( const std::vector< VECTOR2I > &  aCornerList,
void *  aData = nullptr 
)

Plot a Gerber region: similar to PlotPoly but plot only filled polygon, and add the TA.AperFunction if aData contains this attribute, and clear it after plotting.

Definition at line 942 of file GERBER_plotter.cpp.

943{
944 if( aCornerList.size() <= 2 )
945 return;
946
947 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
948
949 bool clearTA_AperFunction = false; // true if a TA.AperFunction is used
950
951 if( gbr_metadata )
952 {
953 std::string attrib = gbr_metadata->m_ApertureMetadata.FormatAttribute( !m_useX2format );
954
955 if( !attrib.empty() )
956 {
957 fputs( attrib.c_str(), m_outputFile );
958 clearTA_AperFunction = true;
959 }
960 }
961
962 PlotPoly( aCornerList, FILL_T::FILLED_SHAPE, 0, gbr_metadata );
963
964 // Clear the TA attribute, to avoid the next item to inherit it:
965 if( clearTA_AperFunction )
966 {
967 if( m_useX2format )
968 {
969 fputs( "%TD.AperFunction*%\n", m_outputFile );
970 }
971 else
972 {
973 fputs( "G04 #@! TD.AperFunction*\n", m_outputFile );
974 }
975 }
976}

References FILLED_SHAPE, GBR_APERTURE_METADATA::FormatAttribute(), GBR_METADATA::m_ApertureMetadata, PLOTTER::m_outputFile, m_useX2format, and PlotPoly().

Referenced by FlashPadChamferRoundRect(), FlashPadCustom(), and FlashPadTrapez().

◆ PlotImage()

void PLOTTER::PlotImage ( const wxImage &  aImage,
const VECTOR2I aPos,
double  aScaleFactor 
)
virtualinherited

Only PostScript plotters can plot bitmaps.

A rectangle is plotted for plotters that cannot plot a bitmap.

Parameters
aImageis the bitmap.
aPosis position of the center of the bitmap.
aScaleFactoris the scale factor to apply to the bitmap size (this is not the plot scale factor).

Reimplemented in PS_PLOTTER, PDF_PLOTTER, and SVG_PLOTTER.

Definition at line 254 of file plotter.cpp.

255{
256 VECTOR2I size( aImage.GetWidth() * aScaleFactor, aImage.GetHeight() * aScaleFactor );
257
258 VECTOR2I start = aPos;
259 start.x -= size.x / 2;
260 start.y -= size.y / 2;
261
262 VECTOR2I end = start;
263 end.x += size.x;
264 end.y += size.y;
265
266 Rect( start, end, FILL_T::NO_FILL );
267}
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0

References NO_FILL, PLOTTER::Rect(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SVG_PLOTTER::PlotImage(), and BITMAP_BASE::PlotImage().

◆ PlotPoly() [1/2]

void GERBER_PLOTTER::PlotPoly ( const SHAPE_LINE_CHAIN aCornerList,
FILL_T  aFill,
int  aWidth = USE_DEFAULT_LINE_WIDTH,
void *  aData = nullptr 
)
overridevirtual

Draw a polygon ( filled or not ).

Parameters
aCornerListis the corners list (a SHAPE_LINE_CHAIN). must be closed (IsClosed() == true) for a polygon. Otherwise this is a polyline.
aFillis the type of fill.
aWidthis the line width.
aDatais an auxiliary info (mainly for gerber format).

Plain point

Plain point

Reimplemented from PLOTTER.

Definition at line 979 of file GERBER_plotter.cpp.

981{
982 if( aPoly.CPoints().size() <= 1 )
983 return;
984
985 // Gerber format does not know filled polygons with thick outline
986 // Therefore, to plot a filled polygon with outline having a thickness,
987 // one should plot outline as thick segments
988 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
989
990 if( gbr_metadata )
991 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
992
993 if( aFill != FILL_T::NO_FILL )
994 {
995 fputs( "G36*\n", m_outputFile );
996
997 MoveTo( VECTOR2I( aPoly.CPoint( 0 ) ) );
998
999 fputs( "G01*\n", m_outputFile ); // Set linear interpolation.
1000
1001 for( int ii = 1; ii < aPoly.PointCount(); ii++ )
1002 {
1003 int arcindex = aPoly.ArcIndex( ii );
1004
1005 if( arcindex < 0 )
1006 {
1008 LineTo( VECTOR2I( aPoly.CPoint( ii ) ) );
1009 }
1010 else
1011 {
1012 const SHAPE_ARC& arc = aPoly.Arc( arcindex );
1013
1014 plotArc( arc, ii > 0 );
1015
1016 // skip points on arcs, since we plot the arc itself
1017 while( ii+1 < aPoly.PointCount() && arcindex == aPoly.ArcIndex( ii+1 ) )
1018 ii++;
1019 }
1020 }
1021
1022 // If the polygon is not closed, close it:
1023 if( aPoly.CPoint( 0 ) != aPoly.CPoint( -1 ) )
1024 FinishTo( VECTOR2I( aPoly.CPoint( 0 ) ) );
1025
1026 fputs( "G37*\n", m_outputFile );
1027 }
1028
1029 if( aWidth > 0 ) // Draw the polyline/polygon outline
1030 {
1031 SetCurrentLineWidth( aWidth, gbr_metadata );
1032
1033 MoveTo( VECTOR2I( aPoly.CPoint( 0 ) ) );
1034
1035 for( int ii = 1; ii < aPoly.PointCount(); ii++ )
1036 {
1037 int arcindex = aPoly.ArcIndex( ii );
1038
1039 if( arcindex < 0 )
1040 {
1042 LineTo( VECTOR2I( aPoly.CPoint( ii ) ) );
1043 }
1044 else
1045 {
1046 const SHAPE_ARC& arc = aPoly.Arc( arcindex );
1047
1048 plotArc( arc, ii > 0 );
1049
1050 // skip points on arcs, since we plot the arc itself
1051 while( ii+1 < aPoly.PointCount() && arcindex == aPoly.ArcIndex( ii+1 ) )
1052 ii++;
1053 }
1054 }
1055
1056 // Ensure the thick outline is closed for filled polygons
1057 // (if not filled, could be only a polyline)
1058 if( ( aPoly.CPoint( 0 ) != aPoly.CPoint( -1 ) )
1059 && ( aPoly.IsClosed() || aFill != FILL_T::NO_FILL ) )
1060 LineTo( VECTOR2I( aPoly.CPoint( 0 ) ) );
1061
1062 PenFinish();
1063 }
1064}
void PenFinish()
Definition: plotter.h:263

References SHAPE_LINE_CHAIN::Arc(), SHAPE_LINE_CHAIN::ArcIndex(), SHAPE_LINE_CHAIN::CPoint(), SHAPE_LINE_CHAIN::CPoints(), PLOTTER::FinishTo(), formatNetAttribute(), SHAPE_LINE_CHAIN::IsClosed(), PLOTTER::LineTo(), GBR_METADATA::m_NetlistMetadata, PLOTTER::m_outputFile, PLOTTER::MoveTo(), NO_FILL, PLOTTER::PenFinish(), plotArc(), SHAPE_LINE_CHAIN::PointCount(), and SetCurrentLineWidth().

◆ PlotPoly() [2/2]

void GERBER_PLOTTER::PlotPoly ( const std::vector< VECTOR2I > &  aCornerList,
FILL_T  aFill,
int  aWidth = USE_DEFAULT_LINE_WIDTH,
void *  aData = nullptr 
)
overridevirtual

Gerber polygon: they can (and should) be filled with the appropriate G36/G37 sequence.

Implements PLOTTER.

Definition at line 1066 of file GERBER_plotter.cpp.

1068{
1069 if( aCornerList.size() <= 1 )
1070 return;
1071
1072 // Gerber format does not know filled polygons with thick outline
1073 // Therefore, to plot a filled polygon with outline having a thickness,
1074 // one should plot outline as thick segments
1075 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1076
1077 if( gbr_metadata )
1078 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1079
1080 if( aFill != FILL_T::NO_FILL )
1081 {
1082 fputs( "G36*\n", m_outputFile );
1083
1084 MoveTo( aCornerList[0] );
1085 fputs( "G01*\n", m_outputFile ); // Set linear interpolation.
1086
1087 for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
1088 LineTo( aCornerList[ii] );
1089
1090 // If the polygon is not closed, close it:
1091 if( aCornerList[0] != aCornerList[aCornerList.size()-1] )
1092 FinishTo( aCornerList[0] );
1093
1094 fputs( "G37*\n", m_outputFile );
1095 }
1096
1097 if( aWidth > 0 ) // Draw the polyline/polygon outline
1098 {
1099 SetCurrentLineWidth( aWidth, gbr_metadata );
1100
1101 MoveTo( aCornerList[0] );
1102
1103 for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
1104 LineTo( aCornerList[ii] );
1105
1106 // Ensure the thick outline is closed for filled polygons
1107 // (if not filled, could be only a polyline)
1108 if( aFill != FILL_T::NO_FILL && ( aCornerList[aCornerList.size() - 1] != aCornerList[0] ) )
1109 LineTo( aCornerList[0] );
1110
1111 PenFinish();
1112 }
1113}

References PLOTTER::FinishTo(), formatNetAttribute(), PLOTTER::LineTo(), GBR_METADATA::m_NetlistMetadata, PLOTTER::m_outputFile, PLOTTER::MoveTo(), NO_FILL, PLOTTER::PenFinish(), and SetCurrentLineWidth().

Referenced by FlashPadChamferRoundRect(), FlashPadCustom(), FlashPadRoundRect(), FlashPadTrapez(), FlashRegularPolygon(), PlotGerberRegion(), and Rect().

◆ plotRoundRectAsRegion()

void GERBER_PLOTTER::plotRoundRectAsRegion ( const VECTOR2I aRectCenter,
const VECTOR2I aSize,
int  aCornerRadius,
const EDA_ANGLE aOrient 
)
protected

Plot a round rect (a round rect shape in fact) as a Gerber region using lines and arcs for corners.

Note
Only the G36 ... G37 region is created.
Parameters
aRectCenteris the center of the rectangle.
aSizeis the size of the rectangle.
aCornerRadiusis the radius of the corners.
aOrientis the rotation of the rectangle.

Definition at line 1549 of file GERBER_plotter.cpp.

1551{
1552 // The region outline is generated by 4 sides and 4 90 deg arcs
1553 // 1 --- 2
1554 // | c |
1555 // 4 --- 3
1556
1557 // Note also in user coordinates the Y axis is from top to bottom
1558 // for historical reasons.
1559
1560 // A helper structure to handle outlines coordinates (segments and arcs)
1561 // in user coordinates
1562 struct RR_EDGE
1563 {
1564 VECTOR2I m_start;
1565 VECTOR2I m_end;
1566 VECTOR2I m_center;
1567 EDA_ANGLE m_arc_angle_start;
1568 };
1569
1570 int hsizeX = aSize.x/2;
1571 int hsizeY = aSize.y/2;
1572
1573 RR_EDGE curr_edge;
1574 std::vector<RR_EDGE> rr_outline;
1575
1576 rr_outline.reserve( 4 );
1577
1578 // Build outline coordinates, relative to rectangle center, rotation 0:
1579
1580 // Top left corner 1 (and 4 to 1 left vertical side @ x=-hsizeX)
1581 curr_edge.m_start.x = -hsizeX;
1582 curr_edge.m_start.y = hsizeY - aCornerRadius;
1583 curr_edge.m_end.x = curr_edge.m_start.x;
1584 curr_edge.m_end.y = -hsizeY + aCornerRadius;
1585 curr_edge.m_center.x = -hsizeX + aCornerRadius;
1586 curr_edge.m_center.y = curr_edge.m_end.y;
1587 curr_edge.m_arc_angle_start = aOrient + ANGLE_180;
1588
1589 rr_outline.push_back( curr_edge );
1590
1591 // Top right corner 2 (and 1 to 2 top horizontal side @ y=-hsizeY)
1592 curr_edge.m_start.x = -hsizeX + aCornerRadius;
1593 curr_edge.m_start.y = -hsizeY;
1594 curr_edge.m_end.x = hsizeX - aCornerRadius;
1595 curr_edge.m_end.y = curr_edge.m_start.y;
1596 curr_edge.m_center.x = curr_edge.m_end.x;
1597 curr_edge.m_center.y = -hsizeY + aCornerRadius;
1598 curr_edge.m_arc_angle_start = aOrient + ANGLE_90;
1599
1600 rr_outline.push_back( curr_edge );
1601
1602 // bottom right corner 3 (and 2 to 3 right vertical side @ x=hsizeX)
1603 curr_edge.m_start.x = hsizeX;
1604 curr_edge.m_start.y = -hsizeY + aCornerRadius;
1605 curr_edge.m_end.x = curr_edge.m_start.x;
1606 curr_edge.m_end.y = hsizeY - aCornerRadius;
1607 curr_edge.m_center.x = hsizeX - aCornerRadius;
1608 curr_edge.m_center.y = curr_edge.m_end.y;
1609 curr_edge.m_arc_angle_start = aOrient + ANGLE_0;
1610
1611 rr_outline.push_back( curr_edge );
1612
1613 // bottom left corner 4 (and 3 to 4 bottom horizontal side @ y=hsizeY)
1614 curr_edge.m_start.x = hsizeX - aCornerRadius;
1615 curr_edge.m_start.y = hsizeY;
1616 curr_edge.m_end.x = -hsizeX + aCornerRadius;
1617 curr_edge.m_end.y = curr_edge.m_start.y;
1618 curr_edge.m_center.x = curr_edge.m_end.x;
1619 curr_edge.m_center.y = hsizeY - aCornerRadius;
1620 curr_edge.m_arc_angle_start = aOrient - ANGLE_90;
1621
1622 rr_outline.push_back( curr_edge );
1623
1624 // Move relative coordinates to the actual location and rotation:
1625 VECTOR2I arc_last_center;
1626 EDA_ANGLE arc_last_angle = curr_edge.m_arc_angle_start - ANGLE_90;
1627
1628 for( RR_EDGE& rr_edge: rr_outline )
1629 {
1630 RotatePoint( rr_edge.m_start, aOrient );
1631 RotatePoint( rr_edge.m_end, aOrient );
1632 RotatePoint( rr_edge.m_center, aOrient );
1633 rr_edge.m_start += aRectCenter;
1634 rr_edge.m_end += aRectCenter;
1635 rr_edge.m_center += aRectCenter;
1636 arc_last_center = rr_edge.m_center;
1637 }
1638
1639 // Ensure the region is a closed polygon, i.e. the end point of last segment
1640 // (end of arc) is the same as the first point. Rounding issues can create a
1641 // small difference, mainly for rotated pads.
1642 // calculate last point (end of last arc):
1643 VECTOR2I last_pt;
1644 last_pt.x = arc_last_center.x + KiROUND( aCornerRadius * arc_last_angle.Cos() );
1645 last_pt.y = arc_last_center.y - KiROUND( aCornerRadius * arc_last_angle.Sin() );
1646
1647 VECTOR2I first_pt = rr_outline[0].m_start;
1648
1649#if 0 // For test only:
1650 if( last_pt != first_pt )
1651 wxLogMessage( wxS( "first pt %d %d last pt %d %d" ),
1652 first_pt.x, first_pt.y, last_pt.x, last_pt.y );
1653#endif
1654
1655 fputs( "G36*\n", m_outputFile ); // Start region
1656 fputs( "G01*\n", m_outputFile ); // Set linear interpolation.
1657 first_pt = last_pt;
1658 MoveTo( first_pt ); // Start point of region, must be same as end point
1659
1660 for( RR_EDGE& rr_edge: rr_outline )
1661 {
1662 if( aCornerRadius ) // Guard: ensure we do not create arcs with radius = 0
1663 {
1664 // LineTo( rr_edge.m_end ); // made in plotArc()
1665 plotArc( rr_edge.m_center, rr_edge.m_arc_angle_start,
1666 rr_edge.m_arc_angle_start - ANGLE_90, aCornerRadius, true );
1667 }
1668 else
1669 {
1670 LineTo( rr_edge.m_end );
1671 }
1672 }
1673
1674 fputs( "G37*\n", m_outputFile ); // Close region
1675}

References ANGLE_0, ANGLE_180, ANGLE_90, EDA_ANGLE::Cos(), KiROUND(), PLOTTER::LineTo(), PLOTTER::m_outputFile, PLOTTER::MoveTo(), plotArc(), RotatePoint(), EDA_ANGLE::Sin(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by FlashPadRoundRect().

◆ Rect()

void GERBER_PLOTTER::Rect ( const VECTOR2I p1,
const VECTOR2I p2,
FILL_T  fill,
int  width = USE_DEFAULT_LINE_WIDTH 
)
overridevirtual

Implements PLOTTER.

Definition at line 802 of file GERBER_plotter.cpp.

803{
804 std::vector<VECTOR2I> cornerList;
805
806 cornerList.reserve( 5 );
807
808 // Build corners list
809 cornerList.push_back( p1 );
810
811 VECTOR2I corner( p1.x, p2.y );
812 cornerList.push_back( corner );
813 cornerList.push_back( p2 );
814 corner.x = p2.x;
815 corner.y = p1.y;
816 cornerList.push_back( corner );
817 cornerList.push_back( p1 );
818
819 PlotPoly( cornerList, fill, width );
820}

References PlotPoly(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by FlashPadRect(), and ThickRect().

◆ RenderSettings()

◆ segmentAsOval()

void PLOTTER::segmentAsOval ( const VECTOR2I start,
const VECTOR2I end,
int  width,
OUTLINE_MODE  tracemode 
)
protectedinherited

Convert a thick segment and plot it as an oval.

Definition at line 481 of file plotter.cpp.

483{
484 VECTOR2I center( ( start.x + end.x ) / 2, ( start.y + end.y ) / 2 );
485 VECTOR2I size( end.x - start.x, end.y - start.y );
486 EDA_ANGLE orient( size );
487 orient = -orient; // this is due to our Y axis orientation
488
489 size.x = KiROUND( EuclideanNorm( size ) ) + aWidth;
490 size.y = aWidth;
491
492 FlashPadOval( center, size, orient, aTraceMode, nullptr );
493}
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0

References EuclideanNorm(), PLOTTER::FlashPadOval(), KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PLOTTER::ThickSegment(), ThickSegment(), and HPGL_PLOTTER::ThickSegment().

◆ selectAperture() [1/3]

void GERBER_PLOTTER::selectAperture ( const std::vector< VECTOR2I > &  aCorners,
const EDA_ANGLE aPolygonRotation,
APERTURE::APERTURE_TYPE  aType,
int  aApertureAttribute 
)
protected

Pick an existing aperture or create a new one, matching the aDiameter, aPolygonRotation, type and attributes.

It apply only to apertures with type = AT_REGULAR_POLY3 to AT_REGULAR_POLY12 write the DCode selection on gerber file

Definition at line 524 of file GERBER_plotter.cpp.

527{
528 bool change = ( m_currentApertureIdx < 0 ) ||
529 ( m_apertures[m_currentApertureIdx].m_Type != aType ) ||
530 ( m_apertures[m_currentApertureIdx].m_Corners.size() != aCorners.size() ) ||
531 ( m_apertures[m_currentApertureIdx].m_Rotation != aRotation );
532
533 if( !change ) // Compare corner lists
534 {
535 for( size_t ii = 0; ii < aCorners.size(); ii++ )
536 {
537 if( aCorners[ii] != m_apertures[m_currentApertureIdx].m_Corners[ii] )
538 {
539 change = true;
540 break;
541 }
542 }
543 }
544
545 if( !change )
546 change = m_apertures[m_currentApertureIdx].m_ApertureAttribute != aApertureAttribute;
547
548 if( change )
549 {
550 // Pick an existing aperture or create a new one
551 m_currentApertureIdx = GetOrCreateAperture( aCorners, aRotation, aType,
552 aApertureAttribute );
553 fprintf( m_outputFile, "D%d*\n", m_apertures[m_currentApertureIdx].m_DCode );
554 }
555}
int GetOrCreateAperture(const VECTOR2I &aSize, int aRadius, const EDA_ANGLE &aRotation, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)

References GetOrCreateAperture(), m_apertures, m_currentApertureIdx, and PLOTTER::m_outputFile.

◆ selectAperture() [2/3]

void GERBER_PLOTTER::selectAperture ( const VECTOR2I aSize,
int  aRadius,
const EDA_ANGLE aRotation,
APERTURE::APERTURE_TYPE  aType,
int  aApertureAttribute 
)
protected

Pick an existing aperture or create a new one, matching the size, type and attributes.

Write the DCode selection on gerber file.

Definition at line 502 of file GERBER_plotter.cpp.

504{
505 bool change = ( m_currentApertureIdx < 0 ) ||
506 ( m_apertures[m_currentApertureIdx].m_Type != aType ) ||
507 ( m_apertures[m_currentApertureIdx].m_Size != aSize ) ||
508 ( m_apertures[m_currentApertureIdx].m_Radius != aRadius ) ||
509 ( m_apertures[m_currentApertureIdx].m_Rotation != aRotation );
510
511 if( !change )
512 change = m_apertures[m_currentApertureIdx].m_ApertureAttribute != aApertureAttribute;
513
514 if( change )
515 {
516 // Pick an existing aperture or create a new one
517 m_currentApertureIdx = GetOrCreateAperture( aSize, aRadius, aRotation, aType,
518 aApertureAttribute );
519 fprintf( m_outputFile, "D%d*\n", m_apertures[m_currentApertureIdx].m_DCode );
520 }
521}

References GetOrCreateAperture(), m_apertures, m_currentApertureIdx, and PLOTTER::m_outputFile.

Referenced by FlashPadChamferRoundRect(), FlashPadCircle(), FlashPadCustom(), FlashPadOval(), FlashPadRect(), FlashPadRoundRect(), FlashPadTrapez(), FlashRegularPolygon(), selectAperture(), and SetCurrentLineWidth().

◆ selectAperture() [3/3]

void GERBER_PLOTTER::selectAperture ( int  aDiameter,
const EDA_ANGLE aRotation,
APERTURE::APERTURE_TYPE  aType,
int  aApertureAttribute 
)
protected

Pick an existing aperture or create a new one, matching the corner list, aRotDegree, type and attributes.

It only applies to apertures managing a polygon that differs from AT_REGULAR_POLY3 to AT_REGULAR_POLY12 (for instance APER_MACRO_TRAPEZOID ) write the DCode selection on gerber file.

Definition at line 558 of file GERBER_plotter.cpp.

560{
561 // Pick an existing aperture or create a new one, matching the
562 // aDiameter, aPolygonRotation, type and attributes for type =
563 // AT_REGULAR_POLY3 to AT_REGULAR_POLY12
564
565 wxASSERT( aType>= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY3 &&
566 aType <= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY12 );
567
568 VECTOR2I size( aDiameter, (int) ( aPolygonRotation.AsDegrees() * 1000.0 ) );
569 selectAperture( VECTOR2I( 0, 0 ), aDiameter / 2, aPolygonRotation, aType, aApertureAttribute );
570}

References EDA_ANGLE::AsDegrees(), and selectAperture().

◆ SetColor()

virtual void GERBER_PLOTTER::SetColor ( const COLOR4D aColor)
inlineoverridevirtual

Implements PLOTTER.

Definition at line 61 of file plotter_gerber.h.

61{}

◆ SetColorMode()

virtual void PLOTTER::SetColorMode ( bool  aColorMode)
inlinevirtualinherited

◆ SetCreator()

◆ SetCurrentLineWidth()

void GERBER_PLOTTER::SetCurrentLineWidth ( int  width,
void *  aData = nullptr 
)
overridevirtual

Set the line width for the next drawing.

Parameters
widthis specified in IUs.
aDatais an auxiliary parameter, mainly used in gerber plotter.

Implements PLOTTER.

Definition at line 397 of file GERBER_plotter.cpp.

398{
399 if( aWidth == DO_NOT_SET_LINE_WIDTH )
400 return;
401 else if( aWidth == USE_DEFAULT_LINE_WIDTH )
403
404 wxASSERT_MSG( aWidth >= 0, "Plotter called to set negative pen width" );
405
406 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
407 int aperture_attribute = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
408
410 aperture_attribute );
411 m_currentPenWidth = aWidth;
412}
int GetDefaultPenWidth() const

References ANGLE_0, APERTURE::AT_PLOTTING, PLOTTER::DO_NOT_SET_LINE_WIDTH, GBR_METADATA::GetApertureAttrib(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), PLOTTER::m_currentPenWidth, PLOTTER::m_renderSettings, selectAperture(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

Referenced by Arc(), FilledCircle(), FlashPadCircle(), FlashPadCustom(), FlashPadRect(), FlashPadRoundRect(), PlotPoly(), ThickArc(), ThickCircle(), ThickRect(), and ThickSegment().

◆ SetDash()

virtual void GERBER_PLOTTER::SetDash ( int  aLineWidth,
PLOT_DASH_TYPE  aLineStyle 
)
inlineoverridevirtual

Implements PLOTTER.

Definition at line 57 of file plotter_gerber.h.

58 {
59 }

◆ SetGerberCoordinatesFormat()

void GERBER_PLOTTER::SetGerberCoordinatesFormat ( int  aResolution,
bool  aUseInches = false 
)
overridevirtual

Selection of Gerber units and resolution (number of digits in mantissa).

Should be called only after SetViewport() is called.

Parameters
aResolutionis the number of digits in mantissa of coordinate use 5 or 6 for mm and 6 or 7 for inches do not use value > 6 (mm) or > 7 (in) to avoid overflow.
aUseInchesuse true to use inches, false to use mm (default).

Reimplemented from PLOTTER.

Definition at line 143 of file GERBER_plotter.cpp.

144{
145 m_gerberUnitInch = aUseInches;
146 m_gerberUnitFmt = aResolution;
147
148 m_iuPerDeviceUnit = pow( 10.0, m_gerberUnitFmt ) / ( m_IUsPerDecimil * 10000.0 );
149
150 if( ! m_gerberUnitInch )
151 m_iuPerDeviceUnit *= 25.4; // gerber output in mm
152}
double m_iuPerDeviceUnit
Definition: plotter.h:624

References m_gerberUnitFmt, m_gerberUnitInch, PLOTTER::m_iuPerDeviceUnit, and PLOTTER::m_IUsPerDecimil.

Referenced by GERBER_WRITER::createDrillFile(), and PLACEFILE_GERBER_WRITER::CreatePlaceFile().

◆ SetLayerPolarity()

void GERBER_PLOTTER::SetLayerPolarity ( bool  aPositive)
overridevirtual

Change the plot polarity and begin a new layer.

Used to 'scratch off' silk screen away from solder mask.

Reimplemented from PLOTTER.

Definition at line 1997 of file GERBER_plotter.cpp.

1998{
1999 if( aPositive )
2000 fprintf( m_outputFile, "%%LPD*%%\n" );
2001 else
2002 fprintf( m_outputFile, "%%LPC*%%\n" );
2003}

References PLOTTER::m_outputFile.

◆ SetNegative()

virtual void PLOTTER::SetNegative ( bool  aNegative)
inlinevirtualinherited

Definition at line 130 of file plotter.h.

130{ m_negativeMode = aNegative; }
bool m_negativeMode
Definition: plotter.h:637

References PLOTTER::m_negativeMode.

Referenced by FillNegativeKnockout().

◆ SetPageSettings()

◆ SetRenderSettings()

◆ SetSvgCoordinatesFormat()

virtual void PLOTTER::SetSvgCoordinatesFormat ( unsigned  aPrecision)
inlinevirtualinherited

Set the number of digits for mantissa in coordinates in mm for SVG plotter.

Reimplemented in SVG_PLOTTER.

Definition at line 506 of file plotter.h.

507 {
508 // NOP for most plotters. Only for SVG plotter
509 }

Referenced by initializePlotter().

◆ SetTextMode()

virtual void PLOTTER::SetTextMode ( PLOT_TEXT_MODE  mode)
inlinevirtualinherited

Change the current text mode.

See the PlotTextMode explanation at the beginning of the file.

Reimplemented in DXF_PLOTTER, and PSLIKE_PLOTTER.

Definition at line 495 of file plotter.h.

496 {
497 // NOP for most plotters.
498 }

Referenced by initializePlotter(), and PlotOneBoardLayer().

◆ SetTitle()

virtual void PLOTTER::SetTitle ( const wxString &  aTitle)
inlinevirtualinherited

Definition at line 161 of file plotter.h.

161{ m_title = aTitle; }
wxString m_title
Definition: plotter.h:644

References PLOTTER::m_title.

Referenced by SCH_PLOTTER::createPDFFile().

◆ SetViewport()

void GERBER_PLOTTER::SetViewport ( const VECTOR2I aOffset,
double  aIusPerDecimil,
double  aScale,
bool  aMirror 
)
overridevirtual

Set the plot offset and scaling for the current plot.

Parameters
aOffsetis the plot offset.
aIusPerDecimilgives the scaling factor from IUs to device units
aScaleis the user set plot scaling factor (either explicitly or using 'fit to A4').
aMirrorflips the plot in the Y direction (useful for toner transfers or some kind of film).

Implements PLOTTER.

Definition at line 121 of file GERBER_plotter.cpp.

123{
124 wxASSERT( aMirror == false );
125 m_plotMirror = false;
126 m_plotOffset = aOffset;
127 wxASSERT( aScale == 1 ); // aScale parameter is not used in Gerber
128 m_plotScale = 1; // Plot scale is *always* 1.0
129
130 m_IUsPerDecimil = aIusPerDecimil;
131
132 // gives now a default value to iuPerDeviceUnit (because the units of the caller is now known)
133 // which could be modified later by calling SetGerberCoordinatesFormat()
134 m_iuPerDeviceUnit = pow( 10.0, m_gerberUnitFmt ) / ( m_IUsPerDecimil * 10000.0 );
135
136 // We don't handle the filmbox, and it's more useful to keep the
137 // origin at the origin
138 m_paperSize.x = 0;
139 m_paperSize.y = 0;
140}
bool m_plotMirror
Definition: plotter.h:627
VECTOR2I m_plotOffset
Definition: plotter.h:626
VECTOR2I m_paperSize
Definition: plotter.h:646

References m_gerberUnitFmt, PLOTTER::m_iuPerDeviceUnit, PLOTTER::m_IUsPerDecimil, PLOTTER::m_paperSize, PLOTTER::m_plotMirror, PLOTTER::m_plotOffset, PLOTTER::m_plotScale, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GERBER_WRITER::createDrillFile(), and PLACEFILE_GERBER_WRITER::CreatePlaceFile().

◆ sketchOval()

void PLOTTER::sketchOval ( const VECTOR2I aPos,
const VECTOR2I aSize,
const EDA_ANGLE aOrient,
int  aWidth 
)
protectedinherited

Definition at line 496 of file plotter.cpp.

498{
499 SetCurrentLineWidth( aWidth );
500
501 EDA_ANGLE orient( aOrient );
502 VECTOR2I size( aSize );
503
504 if( size.x > size.y )
505 {
506 std::swap( size.x, size.y );
507 orient += ANGLE_90;
508 }
509
510 int deltaxy = size.y - size.x; /* distance between centers of the oval */
511 int radius = size.x / 2;
512
513 // Build a vertical oval shape giving the start and end points of arcs and edges,
514 // and the middle point of arcs
515 std::vector<VECTOR2I> corners;
516 corners.reserve( 6 );
517 // Shape is (x = corner and arc ends, c = arc centre)
518 // xcx
519 //
520 // xcx
521 int half_height = deltaxy / 2;
522 corners.emplace_back( -radius, -half_height );
523 corners.emplace_back( -radius, half_height );
524 corners.emplace_back( 0, half_height );
525 corners.emplace_back( radius, half_height );
526 corners.emplace_back( radius, -half_height );
527 corners.emplace_back( 0, -half_height );
528
529 // Rotate and move to the actual position
530 for( size_t ii = 0; ii < corners.size(); ii++ )
531 {
532 RotatePoint( corners[ii], orient );
533 corners[ii] += aPos;
534 }
535
536 // Gen shape:
537 MoveTo( corners[0] );
538 FinishTo( corners[1] );
539
540 Arc( corners[2], orient + ANGLE_180, orient + ANGLE_360, radius, FILL_T::NO_FILL );
541
542 MoveTo( corners[3] );
543 FinishTo( corners[4] );
544
545 Arc( corners[5], orient, orient + ANGLE_180, radius, FILL_T::NO_FILL );
546}

References ANGLE_180, ANGLE_360, ANGLE_90, PLOTTER::Arc(), PLOTTER::FinishTo(), PLOTTER::MoveTo(), NO_FILL, RotatePoint(), PLOTTER::SetCurrentLineWidth(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by FlashPadOval(), HPGL_PLOTTER::FlashPadOval(), PSLIKE_PLOTTER::FlashPadOval(), and DXF_PLOTTER::FlashPadOval().

◆ StartBlock()

void GERBER_PLOTTER::StartBlock ( void *  aData)
overridevirtual

Calling this function allows one to define the beginning of a group of drawing items (used in X2 format with netlist attributes).

Parameters
aDatacan define any parameter.

Reimplemented from PLOTTER.

Definition at line 189 of file GERBER_plotter.cpp.

190{
191 // Currently, it is the same as EndBlock(): clear all aperture net attributes
192 EndBlock( aData );
193}
virtual void EndBlock(void *aData) override
Define the end of a group of drawing items the group is started by StartBlock().

References EndBlock().

◆ StartPlot()

bool GERBER_PLOTTER::StartPlot ( const wxString &  pageNumber)
overridevirtual

Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.

Implements PLOTTER.

Definition at line 237 of file GERBER_plotter.cpp.

238{
239 m_hasApertureRoundRect = false; // true is at least one round rect aperture is in use
240 m_hasApertureRotOval = false; // true is at least one oval rotated aperture is in use
241 m_hasApertureRotRect = false; // true is at least one rect. rotated aperture is in use
242 m_hasApertureOutline4P = false; // true is at least one rotated rect/trapezoid aperture
243 // is in use
244 m_hasApertureChamferedRect = false; // true is at least one chamfered rect is in use
246
247 wxASSERT( m_outputFile );
248
249 finalFile = m_outputFile; // the actual gerber file will be created later
250
251 // Create a temp file in system temp to avoid potential network share buffer issues for
252 // the final read and save.
253 m_workFilename = wxFileName::CreateTempFileName( "" );
254 workFile = wxFopen( m_workFilename, wxT( "wt" ));
256 wxASSERT( m_outputFile );
257
258 if( m_outputFile == nullptr )
259 return false;
260
261 for( unsigned ii = 0; ii < m_headerExtraLines.GetCount(); ii++ )
262 {
263 if( ! m_headerExtraLines[ii].IsEmpty() )
264 fprintf( m_outputFile, "%s\n", TO_UTF8( m_headerExtraLines[ii] ) );
265 }
266
267 // Set coordinate format to 3.6 or 4.5 absolute, leading zero omitted
268 // the number of digits for the integer part of coordinates is needed
269 // in gerber format, but is not very important when omitting leading zeros
270 // It is fixed here to 3 (inch) or 4 (mm), but is not actually used
271 int leadingDigitCount = m_gerberUnitInch ? 3 : 4;
272
273 fprintf( m_outputFile, "%%FSLAX%d%dY%d%d*%%\n",
274 leadingDigitCount, m_gerberUnitFmt,
275 leadingDigitCount, m_gerberUnitFmt );
276 fprintf( m_outputFile,
277 "G04 Gerber Fmt %d.%d, Leading zero omitted, Abs format (unit %s)*\n",
278 leadingDigitCount, m_gerberUnitFmt,
279 m_gerberUnitInch ? "inch" : "mm" );
280
281 wxString Title = m_creator + wxT( " " ) + GetBuildVersion();
282
283 // In gerber files, ASCII7 chars only are allowed.
284 // So use a ISO date format (using a space as separator between date and time),
285 // not a localized date format
286 wxDateTime date = wxDateTime::Now();
287 fprintf( m_outputFile, "G04 Created by KiCad (%s) date %s*\n",
288 TO_UTF8( Title ), TO_UTF8( date.FormatISOCombined( ' ') ) );
289
290 /* Mass parameter: unit = INCHES/MM */
291 if( m_gerberUnitInch )
292 fputs( "%MOIN*%\n", m_outputFile );
293 else
294 fputs( "%MOMM*%\n", m_outputFile );
295
296 // Be sure the usual dark polarity is selected:
297 fputs( "%LPD*%\n", m_outputFile );
298
299 // Set initial interpolation mode: always G01 (linear):
300 fputs( "G01*\n", m_outputFile );
301
302 // Add aperture list start point
303 fputs( "G04 APERTURE LIST*\n", m_outputFile );
304
305 // Give a minimal value to the default pen size, used to plot items in sketch mode
306 if( m_renderSettings )
307 {
308 const int pen_min = 0.1 * m_IUsPerDecimil * 10000 / 25.4; // for min width = 0.1 mm
310 pen_min ) );
311 }
312
313 return true;
314}
wxString GetBuildVersion()
Get the full KiCad version string.
void SetDefaultPenWidth(int aWidth)

References APER_MACRO_FREEPOLY_LIST::ClearList(), finalFile, GetBuildVersion(), KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), m_am_freepoly_list, PLOTTER::m_creator, m_gerberUnitFmt, m_gerberUnitInch, m_hasApertureChamferedRect, m_hasApertureOutline4P, m_hasApertureRotOval, m_hasApertureRotRect, m_hasApertureRoundRect, PLOTTER::m_headerExtraLines, PLOTTER::m_IUsPerDecimil, PLOTTER::m_outputFile, PLOTTER::m_renderSettings, m_workFilename, KIGFX::RENDER_SETTINGS::SetDefaultPenWidth(), TO_UTF8, and workFile.

Referenced by GERBER_WRITER::createDrillFile(), and PLACEFILE_GERBER_WRITER::CreatePlaceFile().

◆ Text()

void GERBER_PLOTTER::Text ( const VECTOR2I aPos,
const COLOR4D aColor,
const wxString &  aText,
const EDA_ANGLE aOrient,
const VECTOR2I aSize,
enum GR_TEXT_H_ALIGN_T  aH_justify,
enum GR_TEXT_V_ALIGN_T  aV_justify,
int  aPenWidth,
bool  aItalic,
bool  aBold,
bool  aMultilineAllowed = false,
KIFONT::FONT aFont = nullptr,
void *  aData = nullptr 
)
overridevirtual

Draw text with the plotter.

Same as GRText, but plot graphic text instead of draw it.

For convenience it accept the color to use for specific plotters (GERBER) aData is used to pass extra parameters.

Parameters
aPosis the text position (according to aH_justify, aV_justify).
aColoris the text color.
aTextis the text to draw.
aOrientis the angle.
aSizeis the text size (size.x or size.y can be < 0 for mirrored texts).
aH_justifyis the horizontal justification (Left, center, right).
aV_justifyis the vertical justification (bottom, center, top).
aPenWidthis the line width (if = 0, use plot default line width).
aItalicis the true to simulate an italic font.
aBolduse true to use a bold font Useful only with default width value (aPenWidth = 0).
aMultilineAlloweduse true to plot text as multiline, otherwise single line.
aDatais a parameter used by some plotters in SetCurrentLineWidth(), not directly used here.

Reimplemented from PLOTTER.

Definition at line 1973 of file GERBER_plotter.cpp.

1986{
1987 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1988
1989 if( gbr_metadata )
1990 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1991
1992 PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
1993 aItalic, aBold, aMultilineAllowed, aFont, aData );
1994}
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aPenWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, void *aData=nullptr)
Draw text with the plotter.
Definition: plotter.cpp:714

References formatNetAttribute(), GBR_METADATA::m_NetlistMetadata, and PLOTTER::Text().

◆ ThickArc() [1/3]

void GERBER_PLOTTER::ThickArc ( const EDA_SHAPE aArcShape,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual

Reimplemented from PLOTTER.

Definition at line 1190 of file GERBER_plotter.cpp.

1192{
1193 wxASSERT( aArcShape.GetShape() == SHAPE_T::ARC );
1194
1195 ThickArc( aArcShape.getCenter(), aArcShape.GetStart(), aArcShape.GetEnd(),
1196 aArcShape.GetWidth(), aTraceMode, aData );
1197}
VECTOR2I getCenter() const
Definition: eda_shape.cpp:444
SHAPE_T GetShape() const
Definition: eda_shape.h:113
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:145
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:120
int GetWidth() const
Definition: eda_shape.h:109
virtual void ThickArc(const VECTOR2I &aCentre, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, OUTLINE_MODE aTraceMode, void *aData) override

References ARC, EDA_SHAPE::getCenter(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), EDA_SHAPE::GetWidth(), and ThickArc().

◆ ThickArc() [2/3]

void GERBER_PLOTTER::ThickArc ( const VECTOR2I aCentre,
const EDA_ANGLE aStartAngle,
const EDA_ANGLE aEndAngle,
int  aRadius,
int  aWidth,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overrideprotectedvirtual

Reimplemented from PLOTTER.

Definition at line 1137 of file GERBER_plotter.cpp.

1140{
1141 GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
1142 SetCurrentLineWidth( aWidth, gbr_metadata );
1143
1144 if( gbr_metadata )
1145 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1146
1147 if( aTraceMode == FILLED )
1148 {
1149 Arc( aCentre, aStartAngle, aEndAngle, aRadius, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH );
1150 }
1151 else
1152 {
1154 Arc( aCentre, aStartAngle, aEndAngle, aRadius - ( aWidth - m_currentPenWidth ) / 2,
1156 Arc( aCentre, aStartAngle, aEndAngle, aRadius + ( aWidth - m_currentPenWidth ) / 2,
1158 }
1159}

References Arc(), PLOTTER::DO_NOT_SET_LINE_WIDTH, FILLED, formatNetAttribute(), PLOTTER::m_currentPenWidth, GBR_METADATA::m_NetlistMetadata, NO_FILL, SetCurrentLineWidth(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

◆ ThickArc() [3/3]

void GERBER_PLOTTER::ThickArc ( const VECTOR2I aCentre,
const VECTOR2I aStart,
const VECTOR2I aEnd,
int  aWidth,
OUTLINE_MODE  aTraceMode,
void *  aData 
)
overridevirtual

Reimplemented from PLOTTER.

Definition at line 1162 of file GERBER_plotter.cpp.

1165{
1166 EDA_ANGLE start_angle( aStart - aCentre );
1167 EDA_ANGLE end_angle( aEnd - aCentre );
1168
1169 if( start_angle > end_angle )
1170 {
1171 if( end_angle < ANGLE_0 )
1172 end_angle.Normalize();
1173 else
1174 start_angle = start_angle.Normalize() - ANGLE_360;
1175 }
1176
1177 int radius = (aStart - aCentre).EuclideanNorm();
1178
1179 if( !m_yaxisReversed ) // should be always the case
1180 {
1181 std::swap( end_angle, start_angle );
1182 end_angle = -end_angle;
1183 start_angle = -start_angle;
1184 }
1185
1186 ThickArc( aCentre, start_angle, end_angle, radius, aWidth, aTraceMode, aData );
1187}
bool m_yaxisReversed
Definition: plotter.h:630

References ANGLE_0, ANGLE_360, EuclideanNorm(), PLOTTER::m_yaxisReversed, EDA_ANGLE::Normalize(), and ThickArc().

Referenced by ThickArc().

◆ ThickCircle()

void GERBER_PLOTTER::ThickCircle ( const VECTOR2I pos,
int  diametre,
int  width,
OUTLINE_MODE  tracemode,
void *  aData 
)
overridevirtual

Reimplemented from PLOTTER.

Definition at line 1230 of file GERBER_plotter.cpp.

1232{
1233 GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
1234 SetCurrentLineWidth( width, gbr_metadata );
1235
1236 if( gbr_metadata )
1237 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1238
1239 if( tracemode == FILLED )
1240 {
1241 Circle( pos, diametre, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH );
1242 }
1243 else
1244 {
1246 Circle( pos, diametre - (width - m_currentPenWidth), FILL_T::NO_FILL,
1248 Circle( pos, diametre + (width - m_currentPenWidth), FILL_T::NO_FILL,
1250 }
1251}

References Circle(), PLOTTER::DO_NOT_SET_LINE_WIDTH, FILLED, formatNetAttribute(), PLOTTER::m_currentPenWidth, GBR_METADATA::m_NetlistMetadata, NO_FILL, SetCurrentLineWidth(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

◆ ThickRect()

void GERBER_PLOTTER::ThickRect ( const VECTOR2I p1,
const VECTOR2I p2,
int  width,
OUTLINE_MODE  tracemode,
void *  aData 
)
overridevirtual

Reimplemented from PLOTTER.

Definition at line 1200 of file GERBER_plotter.cpp.

1202{
1203 GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
1204 SetCurrentLineWidth( width, gbr_metadata );
1205
1206 if( gbr_metadata )
1207 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1208
1209 if( tracemode == FILLED )
1210 {
1212 }
1213 else
1214 {
1216 VECTOR2I offsetp1( p1.x - ( width - m_currentPenWidth ) / 2,
1217 p1.y - (width - m_currentPenWidth) / 2 );
1218 VECTOR2I offsetp2( p2.x + ( width - m_currentPenWidth ) / 2,
1219 p2.y + (width - m_currentPenWidth) / 2 );
1220 Rect( offsetp1, offsetp2, FILL_T::NO_FILL, -1 );
1221 offsetp1.x += (width - m_currentPenWidth);
1222 offsetp1.y += (width - m_currentPenWidth);
1223 offsetp2.x -= (width - m_currentPenWidth);
1224 offsetp2.y -= (width - m_currentPenWidth);
1225 Rect( offsetp1, offsetp2, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH );
1226 }
1227}

References PLOTTER::DO_NOT_SET_LINE_WIDTH, FILLED, formatNetAttribute(), PLOTTER::m_currentPenWidth, GBR_METADATA::m_NetlistMetadata, NO_FILL, Rect(), SetCurrentLineWidth(), PLOTTER::USE_DEFAULT_LINE_WIDTH, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ ThickSegment()

void GERBER_PLOTTER::ThickSegment ( const VECTOR2I start,
const VECTOR2I end,
int  width,
OUTLINE_MODE  tracemode,
void *  aData 
)
overridevirtual

Reimplemented from PLOTTER.

Definition at line 1116 of file GERBER_plotter.cpp.

1118{
1119 if( tracemode == FILLED )
1120 {
1121 GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
1122 SetCurrentLineWidth( width, gbr_metadata );
1123
1124 if( gbr_metadata )
1125 formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
1126
1127 MoveTo( start );
1128 FinishTo( end );
1129 }
1130 else
1131 {
1133 segmentAsOval( start, end, width, tracemode );
1134 }
1135}
void segmentAsOval(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode)
Convert a thick segment and plot it as an oval.
Definition: plotter.cpp:481

References FILLED, PLOTTER::FinishTo(), formatNetAttribute(), GBR_METADATA::m_NetlistMetadata, PLOTTER::MoveTo(), PLOTTER::segmentAsOval(), SetCurrentLineWidth(), and PLOTTER::USE_DEFAULT_LINE_WIDTH.

Referenced by GERBER_WRITER::createDrillFile().

◆ userToDeviceCoordinates()

VECTOR2D PLOTTER::userToDeviceCoordinates ( const VECTOR2I aCoordinate)
protectedvirtualinherited

Modify coordinates according to the orientation, scale factor, and offsets trace.

Also convert from a VECTOR2I to VECTOR2D, since some output engines needs floating point coordinates.

Definition at line 90 of file plotter.cpp.

91{
92 VECTOR2I pos = aCoordinate - m_plotOffset;
93
94 double x = pos.x * m_plotScale;
95 double y = ( m_paperSize.y - pos.y * m_plotScale );
96
97 if( m_plotMirror )
98 {
100 x = ( m_paperSize.x - pos.x * m_plotScale );
101 else
102 y = pos.y * m_plotScale;
103 }
104
105 if( m_yaxisReversed )
106 y = m_paperSize.y - y;
107
110
111 return VECTOR2D( x, y );
112}
bool m_mirrorIsHorizontal
Definition: plotter.h:629
VECTOR2< double > VECTOR2D
Definition: vector2d.h:617

References PLOTTER::m_iuPerDeviceUnit, PLOTTER::m_mirrorIsHorizontal, PLOTTER::m_paperSize, PLOTTER::m_plotMirror, PLOTTER::m_plotOffset, PLOTTER::m_plotScale, PLOTTER::m_yaxisReversed, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by DXF_PLOTTER::Arc(), HPGL_PLOTTER::Arc(), SVG_PLOTTER::Arc(), PS_PLOTTER::Arc(), PDF_PLOTTER::Arc(), SVG_PLOTTER::BezierCurve(), HPGL_PLOTTER::Circle(), DXF_PLOTTER::Circle(), PS_PLOTTER::Circle(), PDF_PLOTTER::Circle(), SVG_PLOTTER::Circle(), PSLIKE_PLOTTER::computeTextParameters(), FlashPadChamferRoundRect(), HPGL_PLOTTER::FlashPadCircle(), FlashPadCircle(), FlashPadCustom(), FlashPadOval(), FlashPadRect(), FlashPadRoundRect(), FlashPadTrapez(), FlashRegularPolygon(), DXF_PLOTTER::PenTo(), PenTo(), HPGL_PLOTTER::PenTo(), PS_PLOTTER::PenTo(), PDF_PLOTTER::PenTo(), SVG_PLOTTER::PenTo(), plotArc(), PS_PLOTTER::PlotImage(), PDF_PLOTTER::PlotImage(), HPGL_PLOTTER::PlotPoly(), PS_PLOTTER::PlotPoly(), PDF_PLOTTER::PlotPoly(), SVG_PLOTTER::PlotPoly(), HPGL_PLOTTER::Rect(), PS_PLOTTER::Rect(), PDF_PLOTTER::Rect(), SVG_PLOTTER::Rect(), DXF_PLOTTER::Text(), PS_PLOTTER::Text(), and SVG_PLOTTER::Text().

◆ userToDeviceSize() [1/2]

◆ userToDeviceSize() [2/2]

double PLOTTER::userToDeviceSize ( double  size) const
protectedvirtualinherited

Modify size according to the plotter scale factors (simple double version).

Definition at line 122 of file plotter.cpp.

123{
124 return size * m_plotScale * m_iuPerDeviceUnit;
125}

References PLOTTER::m_iuPerDeviceUnit, and PLOTTER::m_plotScale.

◆ UseX2format()

void GERBER_PLOTTER::UseX2format ( bool  aEnable)
inline

◆ UseX2NetAttributes()

void GERBER_PLOTTER::UseX2NetAttributes ( bool  aEnable)
inline

◆ writeApertureList()

void GERBER_PLOTTER::writeApertureList ( )
protected

Generate the table of D codes.

Definition at line 572 of file GERBER_plotter.cpp.

573{
574 wxASSERT( m_outputFile );
575 char cbuf[1024];
576 std::string buffer;
577
578 bool useX1StructuredComment = false;
579
580 if( !m_useX2format )
581 useX1StructuredComment = true;
582
583 // Init
584 for( APERTURE& tool : m_apertures )
585 {
586 // aperture sizes are in inch or mm, regardless the
587 // coordinates format
588 double fscale = 0.0001 * m_plotScale / m_IUsPerDecimil; // inches
589
590 if(! m_gerberUnitInch )
591 fscale *= 25.4; // size in mm
592
593 int attribute = tool.m_ApertureAttribute;
594
595 if( attribute != m_apertureAttribute )
596 {
599 useX1StructuredComment ).c_str(), m_outputFile );
600 }
601
602 sprintf( cbuf, "%%ADD%d", tool.m_DCode );
603 buffer = cbuf;
604
605 /* Please note: the Gerber specs for mass parameters say that
606 exponential syntax is *not* allowed and the decimal point should
607 also be always inserted. So the %g format is ruled out, but %f is fine
608 (the # modifier forces the decimal point). Sadly the %f formatter
609 can't remove trailing zeros but that's not a problem, since nothing
610 forbid it (the file is only slightly longer) */
611
612 switch( tool.m_Type )
613 {
615 sprintf( cbuf, "C,%#f*%%\n", tool.GetDiameter() * fscale );
616 break;
617
619 sprintf( cbuf, "R,%#fX%#f*%%\n", tool.m_Size.x * fscale,
620 tool.m_Size.y * fscale );
621 break;
622
624 sprintf( cbuf, "C,%#f*%%\n", tool.m_Size.x * fscale );
625 break;
626
628 sprintf( cbuf, "O,%#fX%#f*%%\n", tool.m_Size.x * fscale,
629 tool.m_Size.y * fscale );
630 break;
631
643 sprintf( cbuf, "P,%#fX%dX%#f*%%\n", tool.GetDiameter() * fscale,
644 tool.GetRegPolyVerticeCount(), tool.GetRotation().AsDegrees() );
645 break;
646
647 case APERTURE::AM_ROUND_RECT: // Aperture macro for round rect pads
648 {
649 // The aperture macro needs coordinates of the centers of the 4 corners
650 std::vector<VECTOR2I> corners;
651 VECTOR2I half_size( tool.m_Size.x/2-tool.m_Radius, tool.m_Size.y/2-tool.m_Radius );
652
653 corners.emplace_back( -half_size.x, -half_size.y );
654 corners.emplace_back( half_size.x, -half_size.y );
655 corners.emplace_back( half_size.x, half_size.y );
656 corners.emplace_back( -half_size.x, half_size.y );
657
658 // Rotate the corner coordinates:
659 for( int ii = 0; ii < 4; ii++ )
660 RotatePoint( corners[ii], -tool.m_Rotation );
661
662 sprintf( cbuf, "%s,%#fX", APER_MACRO_ROUNDRECT_NAME,
663 tool.m_Radius * fscale );
664 buffer += cbuf;
665
666 // Add each corner
667 for( int ii = 0; ii < 4; ii++ )
668 {
669 sprintf( cbuf, "%#fX%#fX",
670 corners[ii].x * fscale, corners[ii].y * fscale );
671 buffer += cbuf;
672 }
673
674 sprintf( cbuf, "0*%%\n" );
675 }
676 break;
677
678 case APERTURE::AM_ROT_RECT: // Aperture macro for rotated rect pads
679 sprintf( cbuf, "%s,%#fX%#fX%#f*%%\n", APER_MACRO_ROT_RECT_NAME,
680 tool.m_Size.x * fscale, tool.m_Size.y * fscale,
681 tool.m_Rotation.AsDegrees() );
682 break;
683
684 case APERTURE::APER_MACRO_OUTLINE4P: // Aperture macro for trapezoid pads
685 case APERTURE::APER_MACRO_OUTLINE5P: // Aperture macro for chamfered rect pads
686 case APERTURE::APER_MACRO_OUTLINE6P: // Aperture macro for chamfered rect pads
687 case APERTURE::APER_MACRO_OUTLINE7P: // Aperture macro for chamfered rect pads
688 case APERTURE::APER_MACRO_OUTLINE8P: // Aperture macro for chamfered rect pads
689 switch( tool.m_Type )
690 {
692 sprintf( cbuf, "%s,", APER_MACRO_OUTLINE4P_NAME ); break;
694 sprintf( cbuf, "%s,", APER_MACRO_OUTLINE5P_NAME ); break;
696 sprintf( cbuf, "%s,", APER_MACRO_OUTLINE6P_NAME ); break;
698 sprintf( cbuf, "%s,", APER_MACRO_OUTLINE7P_NAME ); break;
700 sprintf( cbuf, "%s,", APER_MACRO_OUTLINE8P_NAME ); break;
701 default:
702 break;
703 }
704
705 buffer += cbuf;
706
707 // Output all corners (should be 4 to 8 corners)
708 // Remember: the Y coordinate must be negated, due to the fact in Pcbnew
709 // the Y axis is from top to bottom
710 for( size_t ii = 0; ii < tool.m_Corners.size(); ii++ )
711 {
712 sprintf( cbuf, "%#fX%#fX",
713 tool.m_Corners[ii].x * fscale, -tool.m_Corners[ii].y * fscale );
714 buffer += cbuf;
715 }
716
717 // close outline and output rotation
718 sprintf( cbuf, "%#f*%%\n", tool.m_Rotation.AsDegrees() );
719 break;
720
721 case APERTURE::AM_ROTATED_OVAL: // Aperture macro for rotated oval pads
722 // (not rotated is a primitive)
723 // m_Size.x = full length; m_Size.y = width, and the macro aperture expects
724 // the position of ends
725 {
726 // the seg_len is the distance between the 2 circle centers
727 int seg_len = tool.m_Size.x - tool.m_Size.y;
728 // Center of the circle on the segment start point:
729 VECTOR2I start( seg_len/2, 0 );
730 // Center of the circle on the segment end point:
731 VECTOR2I end( - seg_len/2, 0 );
732
733 RotatePoint( start, tool.m_Rotation );
734 RotatePoint( end, tool.m_Rotation );
735
736 sprintf( cbuf, "%s,%#fX%#fX%#fX%#fX%#fX0*%%\n", APER_MACRO_SHAPE_OVAL_NAME,
737 tool.m_Size.y * fscale, // width
738 start.x * fscale, -start.y * fscale, // X,Y corner start pos
739 end.x * fscale, -end.y * fscale ); // X,Y cornerend pos
740 }
741 break;
742
744 {
745 // Find the aperture macro name in the list of aperture macro
746 // created on the fly for this polygon:
747 int idx = m_am_freepoly_list.FindAm( tool.m_Corners );
748
749 // Write DCODE id ( "%ADDxx" is already in buffer) and rotation
750 // the full line is something like :%ADD12FreePoly1,45.000000*%
751 sprintf( cbuf, "%s%d,%#f*%%\n",
753 idx,
754 tool.m_Rotation.AsDegrees() );
755 break;
756 }
757 }
758
759 buffer += cbuf;
760 fputs( buffer.c_str(), m_outputFile );
761
762 m_apertureAttribute = attribute;
763
764 // Currently reset the aperture attribute. Perhaps a better optimization
765 // is to store the last attribute
766 if( attribute )
767 {
768 if( m_useX2format )
769 fputs( "%TD*%\n", m_outputFile );
770 else
771 fputs( "G04 #@! TD*\n", m_outputFile );
772
774 }
775
776 }
777}
#define AM_FREEPOLY_BASENAME
#define APER_MACRO_OUTLINE6P_NAME
#define APER_MACRO_OUTLINE4P_NAME
#define APER_MACRO_ROT_RECT_NAME
#define APER_MACRO_SHAPE_OVAL_NAME
#define APER_MACRO_OUTLINE5P_NAME
#define APER_MACRO_OUTLINE8P_NAME
#define APER_MACRO_ROUNDRECT_NAME
#define APER_MACRO_OUTLINE7P_NAME

References APERTURE::AM_FREE_POLYGON, AM_FREEPOLY_BASENAME, APERTURE::AM_ROT_RECT, APERTURE::AM_ROTATED_OVAL, APERTURE::AM_ROUND_RECT, APERTURE::APER_MACRO_OUTLINE4P, APER_MACRO_OUTLINE4P_NAME, APERTURE::APER_MACRO_OUTLINE5P, APER_MACRO_OUTLINE5P_NAME, APERTURE::APER_MACRO_OUTLINE6P, APER_MACRO_OUTLINE6P_NAME, APERTURE::APER_MACRO_OUTLINE7P, APER_MACRO_OUTLINE7P_NAME, APERTURE::APER_MACRO_OUTLINE8P, APER_MACRO_OUTLINE8P_NAME, APER_MACRO_ROT_RECT_NAME, APER_MACRO_ROUNDRECT_NAME, APER_MACRO_SHAPE_OVAL_NAME, APERTURE::AT_CIRCLE, APERTURE::AT_OVAL, APERTURE::AT_PLOTTING, APERTURE::AT_RECT, APERTURE::AT_REGULAR_POLY, APERTURE::AT_REGULAR_POLY10, APERTURE::AT_REGULAR_POLY11, APERTURE::AT_REGULAR_POLY12, APERTURE::AT_REGULAR_POLY3, APERTURE::AT_REGULAR_POLY4, APERTURE::AT_REGULAR_POLY5, APERTURE::AT_REGULAR_POLY6, APERTURE::AT_REGULAR_POLY7, APERTURE::AT_REGULAR_POLY8, APERTURE::AT_REGULAR_POLY9, APER_MACRO_FREEPOLY_LIST::FindAm(), GBR_APERTURE_METADATA::FormatAttribute(), m_am_freepoly_list, m_apertureAttribute, m_apertures, m_gerberUnitInch, PLOTTER::m_IUsPerDecimil, PLOTTER::m_outputFile, PLOTTER::m_plotScale, m_useX2format, RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by EndPlot().

Member Data Documentation

◆ DO_NOT_SET_LINE_WIDTH

◆ finalFile

FILE* GERBER_PLOTTER::finalFile
protected

Definition at line 361 of file plotter_gerber.h.

Referenced by EndPlot(), GERBER_PLOTTER(), and StartPlot().

◆ m_am_freepoly_list

APER_MACRO_FREEPOLY_LIST GERBER_PLOTTER::m_am_freepoly_list
protected

Definition at line 395 of file plotter_gerber.h.

Referenced by EndPlot(), GetOrCreateAperture(), StartPlot(), and writeApertureList().

◆ m_apertureAttribute

int GERBER_PLOTTER::m_apertureAttribute
protected

Definition at line 358 of file plotter_gerber.h.

Referenced by GERBER_PLOTTER(), and writeApertureList().

◆ m_apertures

std::vector<APERTURE> GERBER_PLOTTER::m_apertures
protected

Definition at line 369 of file plotter_gerber.h.

Referenced by GetOrCreateAperture(), selectAperture(), and writeApertureList().

◆ m_colorMode

◆ m_creator

wxString PLOTTER::m_creator
protectedinherited

◆ m_currentApertureIdx

int GERBER_PLOTTER::m_currentApertureIdx
protected

Definition at line 370 of file plotter_gerber.h.

Referenced by GERBER_PLOTTER(), and selectAperture().

◆ m_currentPenWidth

◆ m_filename

wxString PLOTTER::m_filename
protectedinherited

◆ m_gerberDisableApertMacros

bool GERBER_PLOTTER::m_gerberDisableApertMacros
protected

◆ m_gerberUnitFmt

int GERBER_PLOTTER::m_gerberUnitFmt
protected

◆ m_gerberUnitInch

bool GERBER_PLOTTER::m_gerberUnitInch
protected

◆ m_hasApertureChamferedRect

bool GERBER_PLOTTER::m_hasApertureChamferedRect
protected

Definition at line 376 of file plotter_gerber.h.

Referenced by EndPlot(), FlashPadChamferRoundRect(), GERBER_PLOTTER(), and StartPlot().

◆ m_hasApertureOutline4P

bool GERBER_PLOTTER::m_hasApertureOutline4P
protected

◆ m_hasApertureRotOval

bool GERBER_PLOTTER::m_hasApertureRotOval
protected

Definition at line 372 of file plotter_gerber.h.

Referenced by EndPlot(), FlashPadOval(), GERBER_PLOTTER(), and StartPlot().

◆ m_hasApertureRotRect

bool GERBER_PLOTTER::m_hasApertureRotRect
protected

Definition at line 373 of file plotter_gerber.h.

Referenced by EndPlot(), FlashPadRect(), GERBER_PLOTTER(), and StartPlot().

◆ m_hasApertureRoundRect

bool GERBER_PLOTTER::m_hasApertureRoundRect
protected

Definition at line 371 of file plotter_gerber.h.

Referenced by EndPlot(), FlashPadRoundRect(), GERBER_PLOTTER(), and StartPlot().

◆ m_headerExtraLines

wxArrayString PLOTTER::m_headerExtraLines
protectedinherited

Definition at line 648 of file plotter.h.

Referenced by PLOTTER::AddLineToHeader(), PLOTTER::ClearHeaderLinesList(), and StartPlot().

◆ m_iuPerDeviceUnit

◆ m_IUsPerDecimil

◆ m_mirrorIsHorizontal

bool PLOTTER::m_mirrorIsHorizontal
protectedinherited

Definition at line 629 of file plotter.h.

Referenced by SVG_PLOTTER::Arc(), PLOTTER::PLOTTER(), and PLOTTER::userToDeviceCoordinates().

◆ m_negativeMode

bool PLOTTER::m_negativeMode
protectedinherited

Definition at line 637 of file plotter.h.

Referenced by PLOTTER::PLOTTER(), PSLIKE_PLOTTER::SetColor(), and PLOTTER::SetNegative().

◆ m_objectAttributesDictionary

std::string GERBER_PLOTTER::m_objectAttributesDictionary
protected

Definition at line 355 of file plotter_gerber.h.

Referenced by ClearAllAttributes(), clearNetAttribute(), and formatNetAttribute().

◆ m_outputFile

FILE* PLOTTER::m_outputFile
protectedinherited

Output file.

Definition at line 633 of file plotter.h.

Referenced by DXF_PLOTTER::Arc(), SVG_PLOTTER::Arc(), PS_PLOTTER::Arc(), SVG_PLOTTER::BezierCurve(), HPGL_PLOTTER::Circle(), DXF_PLOTTER::Circle(), PS_PLOTTER::Circle(), SVG_PLOTTER::Circle(), ClearAllAttributes(), clearNetAttribute(), PDF_PLOTTER::ClosePage(), PDF_PLOTTER::closePdfObject(), PDF_PLOTTER::closePdfStream(), emitDcode(), PDF_PLOTTER::emitGoToAction(), PDF_PLOTTER::emitOutline(), PDF_PLOTTER::emitOutlineNode(), PS_PLOTTER::emitSetRGBColor(), SVG_PLOTTER::EndBlock(), DXF_PLOTTER::EndPlot(), EndPlot(), HPGL_PLOTTER::EndPlot(), PS_PLOTTER::EndPlot(), PDF_PLOTTER::EndPlot(), SVG_PLOTTER::EndPlot(), HPGL_PLOTTER::FlashPadCircle(), DXF_PLOTTER::FlashPadCircle(), FlashPadOval(), HPGL_PLOTTER::FlashPadOval(), PSLIKE_PLOTTER::FlashPadOval(), DXF_PLOTTER::FlashPadOval(), FlashPadRect(), DXF_PLOTTER::FlashPadRect(), FlashPadRoundRect(), DXF_PLOTTER::FlashPadTrapez(), formatNetAttribute(), PLOTTER::OpenFile(), PDF_PLOTTER::OpenFile(), DXF_PLOTTER::PenTo(), PenTo(), HPGL_PLOTTER::PenTo(), PS_PLOTTER::PenTo(), SVG_PLOTTER::PenTo(), plotArc(), PlotGerberRegion(), PS_PLOTTER::PlotImage(), SVG_PLOTTER::PlotImage(), PlotPoly(), PS_PLOTTER::PlotPoly(), SVG_PLOTTER::PlotPoly(), plotRoundRectAsRegion(), PLOTTER::PLOTTER(), HPGL_PLOTTER::Rect(), DXF_PLOTTER::Rect(), PS_PLOTTER::Rect(), SVG_PLOTTER::Rect(), selectAperture(), PS_PLOTTER::SetCurrentLineWidth(), PS_PLOTTER::SetDash(), SetLayerPolarity(), SVG_PLOTTER::setSVGPlotStyle(), PS_PLOTTER::SetViewport(), SVG_PLOTTER::StartBlock(), PDF_PLOTTER::StartPage(), PDF_PLOTTER::startPdfObject(), PDF_PLOTTER::startPdfStream(), DXF_PLOTTER::StartPlot(), HPGL_PLOTTER::StartPlot(), PS_PLOTTER::StartPlot(), SVG_PLOTTER::StartPlot(), PDF_PLOTTER::StartPlot(), StartPlot(), DXF_PLOTTER::Text(), PS_PLOTTER::Text(), SVG_PLOTTER::Text(), HPGL_PLOTTER::ThickSegment(), writeApertureList(), and PLOTTER::~PLOTTER().

◆ m_pageInfo

◆ m_paperSize

◆ m_penLastpos

VECTOR2I PLOTTER::m_penLastpos
protectedinherited

◆ m_penState

char PLOTTER::m_penState
protectedinherited

◆ m_plotMirror

◆ m_plotOffset

◆ m_plotScale

double PLOTTER::m_plotScale
protectedinherited

◆ m_renderSettings

◆ m_title

wxString PLOTTER::m_title
protectedinherited

Definition at line 644 of file plotter.h.

Referenced by PDF_PLOTTER::EndPlot(), PLOTTER::SetTitle(), and PS_PLOTTER::StartPlot().

◆ m_useNetAttributes

bool GERBER_PLOTTER::m_useNetAttributes
protected

Definition at line 387 of file plotter_gerber.h.

Referenced by formatNetAttribute(), GERBER_PLOTTER(), and UseX2NetAttributes().

◆ m_useX2format

bool GERBER_PLOTTER::m_useX2format
protected

◆ m_workFilename

wxString GERBER_PLOTTER::m_workFilename
protected

Definition at line 362 of file plotter_gerber.h.

Referenced by EndPlot(), and StartPlot().

◆ m_yaxisReversed

bool PLOTTER::m_yaxisReversed
protectedinherited

◆ MARKER_COUNT

const unsigned PLOTTER::MARKER_COUNT = 58
staticinherited

Draw a marker (used for the drill map).

Definition at line 466 of file plotter.h.

Referenced by PLOTTER::Marker().

◆ USE_DEFAULT_LINE_WIDTH

◆ workFile

FILE* GERBER_PLOTTER::workFile
protected

Definition at line 360 of file plotter_gerber.h.

Referenced by EndPlot(), GERBER_PLOTTER(), and StartPlot().


The documentation for this class was generated from the following files: