105 bool aLayerNegative )
110 aGbrItem->
m_DCode = Dcode_index;
159 bool aLayerNegative )
163 aGbrItem->
m_Size = aPenSize;
166 aGbrItem->
m_End = aEnd;
168 aGbrItem->
m_DCode = Dcode_index;
205 bool aClockwise,
bool aMultiquadrant,
bool aLayerNegative )
210 aGbrItem->
m_Size = aPenSize;
218 center = aStart + aRelCenter;
228 delta = aEnd - aStart;
246 center.
x = -center.
x;
264 center.
x = -center.
x;
265 center.
y = -center.
y;
274 center.
y = -center.
y;
288 aGbrItem->
m_End = aEnd;
293 aGbrItem->
m_End = aStart;
298 aGbrItem->
m_DCode = Dcode_index;
330 const VECTOR2I& rel_center,
bool aClockwise,
bool aMultiquadrant,
331 bool aLayerNegative )
341 aClockwise, aMultiquadrant, aLayerNegative );
367 if( start_angle >= end_angle )
370 EDA_ANGLE arc_angle = start_angle - end_angle;
385 for(
int ii = 0; ii <= count; ii++ )
391 rot = increment_angle * ii;
393 rot = increment_angle * ( count - ii );
398 end_arc = aClockwise ? end : start;
412 retval = strtol( aText + 1, &endptr, 10 );
414 if( endptr == aText || errno != 0 )
417 wxCHECK_MSG( retval < std::numeric_limits<int>::max(), 0,
_(
"Invalid Code Number" ) );
421 return static_cast<int>( retval );
448 if( strncmp(
text,
" #@! ", 5 ) == 0 )
466 char* cptr = (
char*)x2buf.data();
549 msg.Printf( wxT(
"G%0.2d command not handled" ), G_command );
726 msg.Printf( wxT(
"RS274D: DCODE Command: interpol error (type %X)" ),
constexpr EDA_IU_SCALE gerbIUScale
SHAPE_POLY_SET * GetApertureMacroShape(const GERBER_DRAW_ITEM *aParent, const VECTOR2I &aShapePos)
Calculate the primitive shape for flashed items.
A gerber DCODE (also called Aperture) definition.
APERTURE_MACRO * GetMacro() const
int m_Num_Dcode
D code value ( >= 10 )
VECTOR2I m_Size
Horizontal and vertical dimensions.
APERTURE_T m_ApertType
Aperture type ( Line, rectangle, circle, oval poly, macro )
bool m_InUse
false if the aperture (previously defined) is not used to draw something
void SetLayerPolarity(bool aNegative)
D_CODE * GetDcodeDescr() const
Return the GetDcodeDescr of this object, or NULL.
SHAPE_POLY_SET m_ShapeAsPolygon
GBR_BASIC_SHAPE_TYPE m_ShapeType
GERBER_FILE_IMAGE * m_GerberImageFile
void SetNetAttributes(const GBR_NETLIST_METADATA &aNetAttributes)
bool Execute_G_Command(char *&text, int G_command)
int m_Last_Pen_Command
Current or last pen state (0..9, set by Dn option with n < 10.
GERBER_DRAW_ITEM * GetLastItemInList() const
static char m_LineBuffer[GERBER_BUFZ+1]
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Gerber format has a command Step an Repeat.
VECTOR2I m_PreviousPos
old current specified coord for plot
void AddMessageToList(const wxString &aMessage)
Add a message to the message list.
VECTOR2I m_IJPos
IJ coord (for arcs & circles )
bool m_Relative
false = absolute Coord, true = relative Coord.
bool Execute_DCODE_Command(char *&text, int D_command)
D_CODE * GetDCODE(int aDCODE) const
Return a pointer to the D_CODE within this GERBER for the given aDCODE.
int m_PolygonFillModeState
a collection of APERTURE_MACROS, sorted by name
bool GetEndOfBlock(char *aBuff, unsigned int aBuffSize, char *&aText, FILE *aGerberFile)
int m_Current_Tool
Current Tool (Dcode) number selected.
void AddItemToList(GERBER_DRAW_ITEM *aItem)
Add a new GERBER_DRAW_ITEM item to the drawings list.
bool ExecuteRS274XCommand(int aCommand, char *aBuff, unsigned int aBuffSize, char *&aText)
Execute a RS274X command.
int ReadXCommandID(char *&text)
Read two bytes of data and assembles them into an int with the first byte in the sequence put into th...
bool m_GerbMetric
false = Inches, true = metric
GBR_NETLIST_METADATA m_NetAttributeDict
int m_Iterpolation
Linear, 90 arc, Circ.
VECTOR2I m_CurrentPos
current specified coord for plot
bool m_LastCoordIsIJPos
A value ( = radius in circular routing in Excellon files ).
int CodeNumber(char *&aText)
Reads the next number and returns the value.
GERBER_LAYER & GetLayerParams()
int VertexCount(int aOutline=-1, int aHole=-1) const
Return the number of vertices in a given outline/hole.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
int NewOutline()
Creates a new empty polygon in the set and returns its index.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the index-th vertex in a given hole outline within a given outline.
int OutlineCount() const
Return the number of outlines in the set.
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
APERTURE_T
The set of all gerber aperture types allowed from ADD dcode command, like ADD11C,0....
static constexpr EDA_ANGLE ANGLE_360
void fillFlashedGBRITEM(GERBER_DRAW_ITEM *aGbrItem, APERTURE_T aAperture, int Dcode_index, const VECTOR2I &aPos, VECTOR2I aSize, bool aLayerNegative)
functions to read the rs274d commands from a rs274d/rs274x file
void fillArcGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aRelCenter, VECTOR2I aPenSize, bool aClockwise, bool aMultiquadrant, bool aLayerNegative)
Initialize a given GBRITEM so that it can draw an arc G code.
void fillLineGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const VECTOR2I &aStart, const VECTOR2I &aEnd, VECTOR2I aPenSize, bool aLayerNegative)
Initialize a given GBRITEM so that it can draw a linear D code.
a few functions useful in geometry calculations.
int GetArcToSegmentCount(int aRadius, int aErrorMax, const EDA_ANGLE &aArcAngle)
@ GC_SPECIFY_RELATIVEES_COORD
@ GC_TURN_ON_360_INTERPOL
@ GC_TURN_OFF_360_INTERPOL
@ GC_SPECIFY_ABSOLUES_COORD
@ GERB_INTERPOL_LINEAR_1X
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
void fillFlashedGBRITEM(GERBER_DRAW_ITEM *aGbrItem, APERTURE_T aAperture, int Dcode_index, const VECTOR2I &aPos, VECTOR2I aSize, bool aLayerNegative)
functions to read the rs274d commands from a rs274d/rs274x file
static void fillArcPOLY(GERBER_DRAW_ITEM *aGbrItem, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &rel_center, bool aClockwise, bool aMultiquadrant, bool aLayerNegative)
Create an arc G code when found in polygon outlines.
void fillArcGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aRelCenter, VECTOR2I aPenSize, bool aClockwise, bool aMultiquadrant, bool aLayerNegative)
Initialize a given GBRITEM so that it can draw an arc G code.
void fillLineGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const VECTOR2I &aStart, const VECTOR2I &aEnd, VECTOR2I aPenSize, bool aLayerNegative)
Initialize a given GBRITEM so that it can draw a linear D code.
constexpr int mmToIU(double mm) const
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I