48 #define GBR_USE_MACROS_FOR_CHAMFERED_ROUND_RECT 49 #define GBR_USE_MACROS_FOR_CHAMFERED_RECT 50 #define GBR_USE_MACROS_FOR_ROUNDRECT 51 #define GBR_USE_MACROS_FOR_TRAPEZOID 52 #define GBR_USE_MACROS_FOR_ROTATED_OVAL 53 #define GBR_USE_MACROS_FOR_ROTATED_RECT 54 #define GBR_USE_MACROS_FOR_CUSTOM_PAD 63 #define GBR_MACRO_FOR_CUSTOM_PAD_MAX_CORNER_COUNT 4990 64 #define AM_FREEPOLY_BASENAME "FreePoly" 71 static bool polyCompare(
const std::vector<wxPoint>& aPolygon,
72 const std::vector<wxPoint>& aTestPolygon )
75 if( aTestPolygon.size() != aPolygon.size() )
80 for(
size_t jj = 0; jj < aPolygon.size(); jj++ )
82 if( std::abs( aPolygon[jj].x - aTestPolygon[jj].x ) > margin ||
83 std::abs( aPolygon[jj].y - aTestPolygon[jj].y ) > margin )
122 double aScale,
bool aMirror )
124 wxASSERT( aMirror ==
false );
127 wxASSERT( aScale == 1 );
208 if( aData ==
nullptr )
217 std::string short_attribute_string;
220 aData, clearDict, useX1StructuredComment ) )
226 if( !short_attribute_string.empty() )
277 "G04 Gerber Fmt %d.%d, Leading zero omitted, Abs format (unit %s)*\n",
286 wxDateTime date = wxDateTime::Now();
287 fprintf(
m_outputFile,
"G04 Created by KiCad (%s) date %s*\n",
334 while( fgets( line, 1024,
workFile ) )
338 char* substr = strtok( line,
"\n\r" );
340 if( substr && strcmp( substr,
"G04 APERTURE LIST*" ) == 0 )
381 fputs(
"G04 Aperture macros list end*\n",
m_outputFile );
405 wxASSERT_MSG( aWidth >= 0, wxT(
"Plotter called to set negative pen width" ) );
407 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
421 for(
int idx = 0; idx < (int)
m_apertures.size(); ++idx )
426 if( (tool->
m_Type == aType) && (tool->
m_Size == aSize) &&
438 new_tool.
m_DCode = last_D_code + 1;
464 for(
int idx = 0; idx < (int)
m_apertures.size(); ++idx )
470 if( (tool->
m_Type == aType) &&
471 (tool->
m_Corners.size() == aCorners.size() ) &&
487 new_tool.
m_Size = wxSize( 0, 0 );
491 new_tool.
m_DCode = last_D_code + 1;
516 aType, aApertureAttribute );
532 for(
size_t ii = 0; ii < aCorners.size(); ii++ )
549 aType, aApertureAttribute );
562 wxASSERT( aType>= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY3 &&
563 aType <= APERTURE::APERTURE_TYPE::AT_REGULAR_POLY12 );
565 wxSize size( aDiameter, (
int)( aPolygonRotation * 1000.0 ) );
566 selectAperture( wxSize( 0, 0), aDiameter/2, aPolygonRotation, aType, aApertureAttribute );
575 bool useX1StructuredComment =
false;
578 useX1StructuredComment =
true;
590 int attribute = tool.m_ApertureAttribute;
599 sprintf( cbuf,
"%%ADD%d", tool.m_DCode );
609 switch( tool.m_Type )
612 sprintf( cbuf,
"C,%#f*%%\n", tool.GetDiameter() * fscale );
616 sprintf( cbuf,
"R,%#fX%#f*%%\n", tool.m_Size.x * fscale,
617 tool.m_Size.y * fscale );
621 sprintf( cbuf,
"C,%#f*%%\n", tool.m_Size.x * fscale );
625 sprintf( cbuf,
"O,%#fX%#f*%%\n", tool.m_Size.x * fscale,
626 tool.m_Size.y * fscale );
640 sprintf( cbuf,
"P,%#fX%dX%#f*%%\n", tool.GetDiameter() * fscale,
641 tool.GetRegPolyVerticeCount(), tool.GetRotation() );
647 std::vector<VECTOR2I> corners;
648 wxSize half_size( tool.m_Size.x/2-tool.m_Radius, tool.m_Size.y/2-tool.m_Radius );
650 corners.emplace_back( -half_size.x, -half_size.y );
651 corners.emplace_back( half_size.x, -half_size.y );
652 corners.emplace_back( half_size.x, half_size.y );
653 corners.emplace_back( -half_size.x, half_size.y );
656 for(
int ii = 0; ii < 4; ii++ )
660 tool.m_Radius * fscale );
664 for(
int ii = 0; ii < 4; ii++ )
666 sprintf( cbuf,
"%#fX%#fX",
667 corners[ii].x * fscale, corners[ii].y * fscale );
671 sprintf( cbuf,
"0*%%\n" );
677 tool.m_Size.x * fscale, tool.m_Size.y * fscale,
686 switch( tool.m_Type )
707 for(
size_t ii = 0; ii < tool.m_Corners.size(); ii++ )
709 sprintf( cbuf,
"%#fX%#fX",
710 tool.m_Corners[ii].x * fscale, -tool.m_Corners[ii].y * fscale );
715 sprintf( cbuf,
"%#f*%%\n", tool.m_Rotation );
724 int seg_len = tool.m_Size.x - tool.m_Size.y;
734 tool.m_Size.y * fscale,
735 start.
x * fscale, -start.
y * fscale,
736 end.
x * fscale, -end.
y * fscale );
798 std::vector< wxPoint > cornerList;
801 cornerList.push_back( p1 );
802 wxPoint corner(p1.x, p2.y);
803 cornerList.push_back( corner );
804 cornerList.push_back( p2 );
807 cornerList.push_back( corner );
808 cornerList.push_back( p1 );
810 PlotPoly( cornerList, fill, width );
816 Arc( aCenter, 0, 3600, aDiameter / 2, aFill, aWidth );
822 FILL_T aFill,
int aWidth )
827 plotArc( aCenter, aStAngle, aEndAngle, aRadius,
false );
842 wxPoint start( aArc.
GetP0() );
843 wxPoint end( aArc.
GetP1() );
876 int aRadius,
bool aPlotInRegion )
894 if( aStAngle < aEndAngle )
912 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
914 bool clearTA_AperFunction =
false;
920 if( !attrib.empty() )
923 clearTA_AperFunction =
true;
930 if( clearTA_AperFunction )
946 if( aCornerList.size() <= 2 )
949 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
951 bool clearTA_AperFunction =
false;
957 if( !attrib.empty() )
960 clearTA_AperFunction =
true;
967 if( clearTA_AperFunction )
984 if( aPoly.
CPoints().size() <= 1 )
990 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1003 for(
int ii = 1; ii < aPoly.
PointCount(); ii++ )
1005 int arcindex = aPoly.
ArcIndex( ii );
1037 for(
int ii = 1; ii < aPoly.
PointCount(); ii++ )
1039 int arcindex = aPoly.
ArcIndex( ii );
1071 if( aCornerList.size() <= 1 )
1077 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1086 MoveTo( aCornerList[0] );
1089 for(
unsigned ii = 1; ii < aCornerList.size(); ii++ )
1090 LineTo( aCornerList[ii] );
1093 if( aCornerList[0] != aCornerList[aCornerList.size()-1] )
1103 MoveTo( aCornerList[0] );
1105 for(
unsigned ii = 1; ii < aCornerList.size(); ii++ )
1106 LineTo( aCornerList[ii] );
1110 if( aFill !=
FILL_T::NO_FILL && ( aCornerList[aCornerList.size() - 1] != aCornerList[0] ) )
1111 LineTo( aCornerList[0] );
1121 if( tracemode ==
FILLED )
1123 GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
1140 int radius,
int width,
OUTLINE_MODE tracemode,
void* aData )
1142 GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
1148 if( tracemode ==
FILLED )
1166 GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
1172 if( tracemode ==
FILLED )
1196 GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
1202 if( tracemode ==
FILLED )
1222 GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
1227 if( tracemode ==
FILLED )
1245 wxSize size( diametre, diametre );
1246 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1248 if( trace_mode ==
SKETCH )
1276 wxSize size( aSize );
1277 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1280 if( ( orient == 0 || orient == 900 || orient == 1800 || orient == 2700 )
1281 && trace_mode ==
FILLED )
1283 if( orient == 900 || orient == 2700 )
1284 std::swap( size.x, size.y );
1298 if( trace_mode ==
FILLED )
1300 #ifdef GBR_USE_MACROS_FOR_ROTATED_OVAL 1308 if( size.x < size.y )
1310 std::swap( size.x, size.y );
1335 if( size.x > size.y )
1337 std::swap( size.x, size.y );
1356 wxSize size( aSize );
1357 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1360 switch(
int( orient ) )
1364 std::swap( size.x, size.y );
1369 if( trace_mode ==
SKETCH )
1375 Rect( wxPoint( pos.x - ( size.x / 2 ), pos.y - ( size.y / 2 ) ),
1376 wxPoint( pos.x + ( size.x / 2 ), pos.y + ( size.y / 2 ) ),
1393 #ifdef GBR_USE_MACROS_FOR_ROTATED_RECT 1417 coord[0].x = -size.x/2;
1418 coord[0].y = size.y/2;
1419 coord[1].x = -size.x/2;
1420 coord[1].y = -size.y/2;
1421 coord[2].x = size.x/2;
1422 coord[2].y = -size.y/2;
1423 coord[3].x = size.x/2;
1424 coord[3].y = size.y/2;
1433 int aCornerRadius,
double aOrient,
1437 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1439 if( aTraceMode !=
FILLED )
1447 std::vector< wxPoint > cornerList;
1452 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
1453 cornerList.emplace_back( poly.
CPoint( ii ).
x, poly.
CPoint( ii ).
y );
1456 cornerList.push_back( cornerList[0] );
1463 #ifdef GBR_USE_MACROS_FOR_ROUNDRECT 1483 bool clearTA_AperFunction =
false;
1490 if( !attrib.empty() )
1493 clearTA_AperFunction =
true;
1501 if( clearTA_AperFunction )
1513 int aCornerRadius,
double aOrient )
1531 double m_arc_angle_start;
1534 const double arc_angle = -900.0;
1535 int hsizeX = aSize.x/2;
1536 int hsizeY = aSize.y/2;
1539 std::vector<RR_EDGE> rr_outline;
1544 curr_edge.m_start.x = -hsizeX;
1545 curr_edge.m_start.y = hsizeY - aCornerRadius;
1546 curr_edge.m_end.x = curr_edge.m_start.x;
1547 curr_edge.m_end.y = -hsizeY + aCornerRadius;
1548 curr_edge.m_center.x = -hsizeX + aCornerRadius;
1549 curr_edge.m_center.y = curr_edge.m_end.y;
1550 curr_edge.m_arc_angle_start = aOrient + 1800.0;
1552 rr_outline.push_back( curr_edge );
1555 curr_edge.m_start.x = -hsizeX + aCornerRadius;
1556 curr_edge.m_start.y = -hsizeY;
1557 curr_edge.m_end.x = hsizeX - aCornerRadius;
1558 curr_edge.m_end.y = curr_edge.m_start.y;
1559 curr_edge.m_center.x = curr_edge.m_end.x;
1560 curr_edge.m_center.y = -hsizeY + aCornerRadius;
1561 curr_edge.m_arc_angle_start = aOrient + 900.0;
1563 rr_outline.push_back( curr_edge );
1566 curr_edge.m_start.x = hsizeX;
1567 curr_edge.m_start.y = -hsizeY + aCornerRadius;
1568 curr_edge.m_end.x = curr_edge.m_start.x;
1569 curr_edge.m_end.y = hsizeY - aCornerRadius;
1570 curr_edge.m_center.x = hsizeX - aCornerRadius;
1571 curr_edge.m_center.y = curr_edge.m_end.y;
1572 curr_edge.m_arc_angle_start = aOrient + 0.0;
1574 rr_outline.push_back( curr_edge );
1577 curr_edge.m_start.x = hsizeX - aCornerRadius;
1578 curr_edge.m_start.y = hsizeY;
1579 curr_edge.m_end.x = -hsizeX + aCornerRadius;
1580 curr_edge.m_end.y = curr_edge.m_start.y;
1581 curr_edge.m_center.x = curr_edge.m_end.x;
1582 curr_edge.m_center.y = hsizeY - aCornerRadius;
1583 curr_edge.m_arc_angle_start = aOrient - 900.0;
1585 rr_outline.push_back( curr_edge );
1588 wxPoint arc_last_center;
1589 int arc_last_angle = curr_edge.m_arc_angle_start+arc_angle;
1591 for( RR_EDGE& rr_edge: rr_outline )
1596 rr_edge.m_start += aRectCenter;
1597 rr_edge.m_end += aRectCenter;
1598 rr_edge.m_center += aRectCenter;
1599 arc_last_center = rr_edge.m_center;
1607 last_pt.x = arc_last_center.x +
KiROUND(
cosdecideg( aCornerRadius, arc_last_angle ) );
1608 last_pt.y = arc_last_center.y -
KiROUND(
sindecideg( aCornerRadius, arc_last_angle ) );
1610 wxPoint first_pt = rr_outline[0].m_start;
1612 #if 0 // For test only: 1613 if( last_pt != first_pt )
1614 wxLogMessage( wxT(
"first pt %d %d last pt %d %d" ),
1615 first_pt.x, first_pt.y, last_pt.x, last_pt.y );
1623 for( RR_EDGE& rr_edge: rr_outline )
1628 plotArc( rr_edge.m_center, rr_edge.m_arc_angle_start,
1629 rr_edge.m_arc_angle_start+arc_angle, aCornerRadius,
true );
1650 gbr_metadata = *static_cast<GBR_METADATA*>( aData );
1654 if( aTraceMode !=
FILLED )
1659 std::vector< wxPoint > cornerList;
1661 for(
int cnt = 0; cnt < polyshape.
OutlineCount(); ++cnt )
1667 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
1668 cornerList.emplace_back( poly.
CPoint( ii ).
x, poly.
CPoint( ii ).
y );
1671 cornerList.push_back( cornerList[0] );
1673 if( aTraceMode ==
SKETCH )
1679 #ifdef GBR_USE_MACROS_FOR_CUSTOM_PAD 1687 for(
size_t ii = 0; ii < cornerList.size(); ii++ )
1689 cornerList[ii] -= aPadPos;
1709 int aCornerRadius,
double aChamferRatio,
1710 int aChamferPositions,
double aPadOrient,
1717 gbr_metadata = *static_cast<GBR_METADATA*>( aData );
1723 std::vector<wxPoint> cornerList;
1725 bool hasRoundedCorner = aCornerRadius != 0 && aChamferPositions != 15;
1727 #ifdef GBR_USE_MACROS_FOR_CHAMFERED_RECT 1733 aCornerRadius, aChamferRatio, aChamferPositions, 0,
1739 for(
int ii = 0; ii < corners.
PointCount(); ii++ )
1740 cornerList.emplace_back( corners.
CPoint( ii ).
x, corners.
CPoint( ii ).
y );
1743 cornerList.push_back( cornerList[0] );
1745 if( aPlotMode ==
SKETCH )
1749 #ifdef GBR_USE_MACROS_FOR_CHAMFERED_ROUND_RECT 1758 for(
size_t ii = 0; ii < cornerList.size(); ii++ )
1760 cornerList[ii] -= aShapePos;
1780 aChamferRatio, aChamferPositions, 0,
1787 for(
int ii = 0; ii < corners.
PointCount(); ii++ )
1788 cornerList.emplace_back( corners.
CPoint( ii ).
x, corners.
CPoint( ii ).
y );
1790 switch( cornerList.size() )
1823 wxLogMessage( wxT(
"FlashPadChamferRoundRect(): Unexpected number of corners (%d)" ),
1824 (
int)cornerList.size() );
1835 double aPadOrient,
OUTLINE_MODE aTrace_Mode,
void* aData )
1839 std::vector<wxPoint> cornerList = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
1842 for(
unsigned ii = 0; ii < 4; ii++ )
1845 cornerList[ii] += aPadPos;
1849 cornerList.push_back( cornerList[0] );
1850 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1855 metadata = *gbr_metadata;
1857 if( aTrace_Mode ==
SKETCH )
1864 #ifdef GBR_USE_MACROS_FOR_TRAPEZOID 1871 std::vector<wxPoint> corners = { aCorners[0], aCorners[1], aCorners[2], aCorners[3] };
1887 int aCornerCount,
double aOrient,
1890 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1895 metadata = *gbr_metadata;
1897 if( aTraceMode ==
SKETCH )
1900 std::vector< wxPoint > cornerList;
1902 double angle_delta = 3600.0 / aCornerCount;
1904 for(
int ii = 0; ii < aCornerCount; ii++ )
1906 double rot = aOrient + (angle_delta*ii);
1907 wxPoint vertice( aDiameter/2, 0 );
1909 vertice += aShapePos;
1910 cornerList.push_back( vertice );
1913 cornerList.push_back( cornerList[0] );
1925 selectAperture( aDiameter, aOrient, apert_type, aperture_attrib );
1936 const wxString& aText,
double aOrient,
const wxSize& aSize,
1939 bool aBold,
bool aMultilineAllowed,
void* aData )
1941 GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
1946 PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
1947 aBold, aMultilineAllowed, aData );
1970 fprintf( aOutput,
"4,1,%d,", (
int)
m_Corners.size() );
1973 int curr_line_corner_count = 0;
1974 const int curr_line_count_max = 20;
1976 for(
size_t ii = 0; ii <=
m_Corners.size(); ii++ )
1984 fprintf( aOutput,
"%#f,%#f,",
1987 if( curr_line_count_max >= 0 && ++curr_line_corner_count >= curr_line_count_max )
1989 fprintf( aOutput,
"\n" );
1990 curr_line_corner_count = 0;
1995 fputs(
"$1*%\n", aOutput );
2001 for(
int idx = 0; idx <
AmCount(); idx++ )
2014 for(
int idx = 0; idx <
AmCount(); idx++ )
2016 if(
m_AMList[idx].IsSamePoly( aPolygon ) )
void segmentAsOval(const wxPoint &start, const wxPoint &end, int width, OUTLINE_MODE tracemode)
Convert a thick segment and plot it as an oval.
virtual void FlashRegularPolygon(const wxPoint &aShapePos, int aDiameter, int aCornerCount, double aOrient, OUTLINE_MODE aTraceMode, void *aData) override
Flash a regular polygon.
void FinishTo(const wxPoint &pos)
#define APER_MACRO_ROUNDRECT_NAME
#define APER_MACRO_ROT_RECT_HEADER
specialized plotter for GERBER files format
const SHAPE_ARC & Arc(size_t aArc) const
void writeApertureList()
Generate the table of D codes.
void clearNetAttribute()
Clear a Gerber net attribute record (clear object attribute dictionary) and output the clear object a...
virtual void PenTo(const wxPoint &pos, char plume) override
Moveto/lineto primitive, moves the 'pen' to the specified direction.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void plotRoundRectAsRegion(const wxPoint &aRectCenter, const wxSize &aSize, int aCornerRadius, double aOrient)
Plot a round rect (a round rect shape in fact) as a Gerber region using lines and arcs for corners.
virtual void SetLayerPolarity(bool aPositive) override
Change the plot polarity and begin a new layer.
virtual void EndBlock(void *aData) override
Define the end of a group of drawing items the group is started by StartBlock().
bool m_hasApertureChamferedRect
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, OUTLINE_MODE tracemode, void *aData) override
void FlashPadChamferRoundRect(const wxPoint &aShapePos, const wxSize &aPadSize, int aCornerRadius, double aChamferRatio, int aChamferPositions, double aPadOrient, OUTLINE_MODE aPlotMode, void *aData)
Flash a chamfered round rect pad.
#define APER_MACRO_SHAPE_OVAL_NAME
void formatNetAttribute(GBR_NETLIST_METADATA *aData)
Print a Gerber net attribute object record.
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, OUTLINE_MODE aTraceMode, void *aData) override
Flash a trapezoidal pad.
bool m_hasApertureRotOval
static bool polyCompare(const std::vector< wxPoint > &aPolygon, const std::vector< wxPoint > &aTestPolygon)
FILE * m_outputFile
Output file.
void plotArc(const wxPoint &aCenter, double aStAngle, double aEndAngle, int aRadius, bool aPlotInRegion)
Plot a Gerber arc.
std::string m_objectAttributesDictionary
virtual void ThickArc(const wxPoint ¢re, double StAngle, double EndAngle, int rayon, int width, OUTLINE_MODE tracemode, void *aData) override
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
#define APER_MACRO_OUTLINE7P_NAME
APER_MACRO_FREEPOLY_LIST m_am_freepoly_list
void RotatePoint(int *pX, int *pY, double angle)
int PointCount() const
Return the number of points (vertices) in this line chain.
wxArrayString m_headerExtraLines
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &size, double orient, OUTLINE_MODE trace_mode, void *aData) override
#define APER_MACRO_OUTLINE6P_HEADER
bool m_hasApertureOutline4P
virtual bool StartPlot() override
Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.
void Append(const std::vector< wxPoint > &aPolygon)
append a new APER_MACRO_FREEPOLY containing the polygon aPolygon to the current list
This file contains miscellaneous commonly used macros and functions.
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double 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.
bool m_hasApertureRoundRect
double m_plotScale
Plot scale - chosen by the user (even implicitly with 'fit in a4')
ssize_t ArcIndex(size_t aSegment) const
Return the arc index for the given segment index.
virtual int GetCurrentLineWidth() const
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
virtual void FlashPadCustom(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, SHAPE_POLY_SET *aPolygons, OUTLINE_MODE aTraceMode, void *aData) override
void LineTo(const wxPoint &pos)
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
static const int USE_DEFAULT_LINE_WIDTH
virtual void PlotPoly(const std::vector< wxPoint > &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.
std::vector< APERTURE > m_apertures
#define APER_MACRO_SHAPE_OVAL_HEADER
#define APER_MACRO_OUTLINE5P_HEADER
void ClearAllAttributes()
Remove (clear) all attributes from object attributes dictionary (TO.
bool IsClosed() const override
const std::vector< VECTOR2I > & CPoints() const
wxString GetBuildVersion()
Get the full KiCad version string.
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, OUTLINE_MODE aTraceMode, void *aData) override
virtual void ThickCircle(const wxPoint &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData) override
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
const VECTOR2I & GetP0() const
std::vector< wxPoint > m_Corners
const VECTOR2I & GetArcMid() const
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
#define APER_MACRO_ROUNDRECT_HEADER
#define APER_MACRO_OUTLINE5P_NAME
virtual void Text(const wxPoint &aPos, const COLOR4D &aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=nullptr) override
Draw text with the plotter.
RENDER_SETTINGS * m_renderSettings
virtual void SetCurrentLineWidth(int width, void *aData=nullptr) override
Set the line width for the next drawing.
#define APER_MACRO_OUTLINE8P_NAME
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &size, double orient, OUTLINE_MODE trace_mode, void *aData) override
#define APER_MACRO_ROT_RECT_NAME
void emitDcode(const DPOINT &pt, int dcode)
Emit a D-Code record, using proper conversions to format a leading zero omitted gerber coordinate.
std::vector< APER_MACRO_FREEPOLY > m_AMList
#define AM_FREEPOLY_BASENAME
bool m_hasApertureRotRect
void selectAperture(const wxSize &aSize, int aRadius, double aRotDegree, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
Pick an existing aperture or create a new one, matching the size, type and attributes.
void MoveTo(const wxPoint &pos)
virtual DPOINT userToDeviceCoordinates(const wxPoint &aCoordinate)
Modify coordinates according to the orientation, scale factor, and offsets trace.
double cosdecideg(double r, double a)
Circle generation utility: computes r * cos(a) Where a is in decidegrees, not in radians.
#define APER_MACRO_OUTLINE4P_NAME
virtual void ThickRect(const wxPoint &p1, const wxPoint &p2, int width, OUTLINE_MODE tracemode, void *aData) override
#define APER_MACRO_OUTLINE7P_HEADER
double sindecideg(double r, double a)
Circle generation utility: computes r * sin(a) Where a is in decidegrees, not in radians.
std::vector< wxPoint > m_Corners
virtual void StartBlock(void *aData) override
Calling this function allows one to define the beginning of a group of drawing items (used in X2 form...
virtual void Arc(const wxPoint &aCenter, double aStAngle, double aEndAngle, int aRadius, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH) override
Generic fallback: arc rendered as a polyline.
int FindAm(const std::vector< wxPoint > &aPolygon) const
int GetOrCreateAperture(const wxSize &aSize, int aRadius, double aRotDegree, APERTURE::APERTURE_TYPE aType, int aApertureAttribute)
#define APER_MACRO_OUTLINE6P_NAME
virtual bool EndPlot() override
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
#define APER_MACRO_OUTLINE4P_HEADER
void Format(FILE *aOutput, double aIu2GbrMacroUnit)
print the aperture macro definition to aOutput
#define GBR_MACRO_FOR_CUSTOM_PAD_MAX_CORNER_COUNT
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
int GetPlotterArcHighDef() const
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false) override
Selection of Gerber units and resolution (number of digits in mantissa).
int GetDefaultPenWidth() const
virtual void Text(const wxPoint &aPos, const COLOR4D &aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=nullptr)
Draw text with the plotter.
#define APER_MACRO_OUTLINE8P_HEADER
virtual void FlashPadCircle(const wxPoint &pos, int diametre, OUTLINE_MODE trace_mode, void *aData) override
Filled circular flashes are stored as apertures.
void PlotGerberRegion(const std::vector< wxPoint > &aCornerList, void *aData=nullptr)
Plot a Gerber region: similar to PlotPoly but plot only filled polygon, and add the TA....
void Format(FILE *aOutput, double aIu2GbrMacroUnit)
print the aperture macro list to aOutput
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH) override
virtual void FilledCircle(const wxPoint &pos, int diametre, OUTLINE_MODE tracemode, void *aData) override
void SetDefaultPenWidth(int aWidth)
bool m_gerberDisableApertMacros
bool IsSamePoly(const std::vector< wxPoint > &aPolygon) const
static const int DO_NOT_SET_LINE_WIDTH
void sketchOval(const wxPoint &pos, const wxSize &size, double orient, int width)
const VECTOR2I & GetP1() const
VECTOR2I GetCenter() const
A color representation with 4 components: red, green, blue, alpha.