2009-11-09 14:00:22 +00:00
|
|
|
/********************/
|
|
|
|
/**** rs274d.cpp ****/
|
|
|
|
/********************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2010-10-11 20:57:25 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "gerbview.h"
|
2010-01-08 12:28:13 +00:00
|
|
|
#include "trigo.h"
|
2010-10-11 20:57:25 +00:00
|
|
|
#include "macros.h"
|
2010-09-28 14:42:05 +00:00
|
|
|
#include "class_gerber_draw_item.h"
|
2010-10-06 17:28:07 +00:00
|
|
|
#include "class_GERBER.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-01-08 12:28:13 +00:00
|
|
|
#include <math.h>
|
|
|
|
|
2010-09-29 19:00:35 +00:00
|
|
|
/* Gerber: NOTES about some important commands found in RS274D and RS274X (G codes):
|
2009-11-09 14:00:22 +00:00
|
|
|
* Gn =
|
|
|
|
* G01 linear interpolation (right trace)
|
2010-10-11 20:57:25 +00:00
|
|
|
* G02, G20, G21 Circular interpolation, meaning trig <0 (clockwise)
|
|
|
|
* G03, G30, G31 Circular interpolation, meaning trigo> 0 (counterclockwise)
|
2010-09-29 19:00:35 +00:00
|
|
|
* G04 = comment
|
2009-11-09 14:00:22 +00:00
|
|
|
* G06 parabolic interpolation
|
|
|
|
* G07 Cubic Interpolation
|
|
|
|
* G10 linear interpolation (scale x10)
|
|
|
|
* G11 linear interpolation (0.1x range)
|
|
|
|
* G12 linear interpolation (0.01x scale)
|
2010-09-29 19:00:35 +00:00
|
|
|
* G36 Start polygon mode
|
|
|
|
* G37 Stop polygon mode (and close it)
|
2009-11-09 14:00:22 +00:00
|
|
|
* G54 Selection Tool
|
|
|
|
* G60 linear interpolation (scale x100)
|
2010-09-29 19:00:35 +00:00
|
|
|
* G70 Select Units = Inches
|
|
|
|
* G71 Select Units = Millimeters
|
2010-10-04 15:20:37 +00:00
|
|
|
* G74 disable 360 degrees circular interpolation (return to 90 deg mode)
|
2010-10-05 11:44:34 +00:00
|
|
|
* and perhaps circular interpolation (return to linear interpolation )
|
|
|
|
* see rs274xrevd_e.pdf pages 47 and 48
|
|
|
|
* Unfortunately page 47 said G74 disable G02 or G03
|
|
|
|
* and page 48 said G01 must be used to disable G02 or G03.
|
|
|
|
* Currently Gerbview disable G02 or G03 after a G74 command (tests using 2 gerber files).
|
|
|
|
* G75 enable 360 degrees circular interpolation
|
2009-11-09 14:00:22 +00:00
|
|
|
* G90 mode absolute coordinates
|
2008-04-17 16:25:29 +00:00
|
|
|
*
|
2009-11-09 14:00:22 +00:00
|
|
|
* X, Y
|
|
|
|
* X and Y are followed by + or - and m + n digits (not separated)
|
|
|
|
* m = integer part
|
|
|
|
* n = part after the comma
|
|
|
|
* Classic formats: m = 2, n = 3 (size 2.3)
|
|
|
|
* m = 3, n = 4 (size 3.4)
|
|
|
|
* eg
|
2010-09-29 19:00:35 +00:00
|
|
|
* GxxX00345Y-06123*
|
2008-04-17 16:25:29 +00:00
|
|
|
*
|
2009-11-09 14:00:22 +00:00
|
|
|
* Tools and D_CODES
|
|
|
|
* Tool number (identification of shapes)
|
2010-09-29 19:00:35 +00:00
|
|
|
* 10 to 999
|
2009-11-09 14:00:22 +00:00
|
|
|
* D_CODES:
|
2010-09-29 19:00:35 +00:00
|
|
|
* D01 ... D9 = command codes:
|
|
|
|
* D01 = activating light (pen down) when placement
|
|
|
|
* D02 = light extinction (pen up) when placement
|
|
|
|
* D03 = Flash
|
|
|
|
* D09 = VAPE Flash (I never see this command in gerber file)
|
|
|
|
* D51 = G54 preceded by -> Select VAPE
|
2008-04-17 16:25:29 +00:00
|
|
|
*
|
2010-09-29 19:00:35 +00:00
|
|
|
* D10 ... D999 = Identification Tool: tool selection
|
2007-09-26 04:09:22 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
// Photoplot actions:
|
|
|
|
#define GERB_ACTIVE_DRAW 1 // Activate light (lower pen)
|
|
|
|
#define GERB_STOP_DRAW 2 // Extinguish light (lift pen)
|
2007-09-26 04:09:22 +00:00
|
|
|
#define GERB_FLASH 3 // Flash
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
static wxPoint LastPosition;
|
|
|
|
|
2008-12-16 02:20:21 +00:00
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
/* Local Functions (are lower case since they are private to this source file)
|
2010-09-28 14:42:05 +00:00
|
|
|
**/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-14 07:46:43 +00:00
|
|
|
|
2008-12-29 18:02:54 +00:00
|
|
|
/**
|
2010-10-03 15:39:06 +00:00
|
|
|
* Function fillFlashedGBRITEM
|
2010-09-28 14:42:05 +00:00
|
|
|
* initializes a given GBRITEM so that it can draw a circle which is filled and
|
2008-12-29 18:02:54 +00:00
|
|
|
* has no pen border.
|
2008-11-14 17:49:38 +00:00
|
|
|
*
|
2010-09-28 14:42:05 +00:00
|
|
|
* @param aGbrItem The GBRITEM to fill in.
|
2010-10-03 15:39:06 +00:00
|
|
|
* @param aAperture the associated type of aperture
|
2008-11-14 17:49:38 +00:00
|
|
|
* @param Dcode_index The DCODE value, like D14
|
2010-09-28 14:42:05 +00:00
|
|
|
* @param aLayer The layer index to set into the GBRITEM
|
2008-11-14 17:49:38 +00:00
|
|
|
* @param aPos The center point of the flash
|
2010-10-03 15:39:06 +00:00
|
|
|
* @param aSize The diameter of the round flash
|
|
|
|
* @param aLayerNegative = true if the current layer is negative
|
2007-09-26 04:09:22 +00:00
|
|
|
*/
|
2010-10-03 15:39:06 +00:00
|
|
|
static void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
|
|
|
APERTURE_T aAperture,
|
|
|
|
int Dcode_index,
|
|
|
|
int aLayer,
|
|
|
|
const wxPoint& aPos,
|
|
|
|
wxSize aSize,
|
2010-10-16 14:51:22 +00:00
|
|
|
bool aLayerNegative )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
aGbrItem->SetLayer( aLayer );
|
2010-10-03 15:39:06 +00:00
|
|
|
aGbrItem->m_Size = aSize;
|
2010-09-28 14:42:05 +00:00
|
|
|
aGbrItem->m_Start = aPos;
|
2010-10-03 15:39:06 +00:00
|
|
|
aGbrItem->m_End = aGbrItem->m_Start;
|
2010-09-28 14:42:05 +00:00
|
|
|
aGbrItem->m_DCode = Dcode_index;
|
2010-10-16 14:51:22 +00:00
|
|
|
aGbrItem->SetLayerPolarity( aLayerNegative );
|
2010-09-28 14:42:05 +00:00
|
|
|
aGbrItem->m_Flashed = true;
|
2010-10-03 15:39:06 +00:00
|
|
|
switch( aAperture )
|
2008-12-04 04:28:11 +00:00
|
|
|
{
|
2010-10-03 15:39:06 +00:00
|
|
|
case APT_POLYGON: // flashed regular polygon
|
|
|
|
aGbrItem->m_Shape = GBR_SPOT_POLY;
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-10-03 15:39:06 +00:00
|
|
|
case APT_CIRCLE:
|
|
|
|
aGbrItem->m_Shape = GBR_SPOT_CIRCLE;
|
|
|
|
aGbrItem->m_Size.y = aGbrItem->m_Size.x;
|
|
|
|
break;
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2010-10-03 15:39:06 +00:00
|
|
|
case APT_OVAL:
|
|
|
|
aGbrItem->m_Shape = GBR_SPOT_OVAL;
|
|
|
|
break;
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2010-10-03 15:39:06 +00:00
|
|
|
case APT_RECT:
|
|
|
|
aGbrItem->m_Shape = GBR_SPOT_RECT;
|
|
|
|
break;
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2010-10-03 15:39:06 +00:00
|
|
|
case APT_MACRO:
|
|
|
|
aGbrItem->m_Shape = GBR_SPOT_MACRO;
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-11-14 17:49:38 +00:00
|
|
|
/**
|
2010-09-28 14:42:05 +00:00
|
|
|
* Function fillLineGBRITEM
|
|
|
|
* initializes a given GBRITEM so that it can draw a linear D code.
|
2008-11-14 17:49:38 +00:00
|
|
|
*
|
2010-09-28 14:42:05 +00:00
|
|
|
* @param aGbrItem The GERBER_DRAW_ITEM to fill in.
|
2008-11-14 17:49:38 +00:00
|
|
|
* @param Dcode_index The DCODE value, like D14
|
2010-09-28 14:42:05 +00:00
|
|
|
* @param aLayer The layer index to set into the GBRITEM
|
2010-10-25 07:43:50 +00:00
|
|
|
* @param aStart The starting point of the line
|
|
|
|
* @param aEnd The ending point of the line
|
|
|
|
* @param aPenSize The size of the flash. Note rectangular shapes are legal.
|
2010-10-03 15:39:06 +00:00
|
|
|
* @param aLayerNegative = true if the current layer is negative
|
2008-11-14 17:49:38 +00:00
|
|
|
*/
|
2010-09-28 14:42:05 +00:00
|
|
|
static void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
|
|
|
int Dcode_index,
|
|
|
|
int aLayer,
|
|
|
|
const wxPoint& aStart,
|
|
|
|
const wxPoint& aEnd,
|
2010-10-25 07:43:50 +00:00
|
|
|
wxSize aPenSize,
|
2010-10-16 14:51:22 +00:00
|
|
|
bool aLayerNegative )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
aGbrItem->SetLayer( aLayer );
|
|
|
|
aGbrItem->m_Flashed = false;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-10-25 07:43:50 +00:00
|
|
|
aGbrItem->m_Size = aPenSize;
|
2008-11-14 07:46:43 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
aGbrItem->m_Start = aStart;
|
2010-10-11 20:57:25 +00:00
|
|
|
aGbrItem->m_End = aEnd;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
aGbrItem->m_DCode = Dcode_index;
|
2010-10-16 14:51:22 +00:00
|
|
|
aGbrItem->SetLayerPolarity( aLayerNegative );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2008-11-14 17:49:38 +00:00
|
|
|
/**
|
2010-09-28 14:42:05 +00:00
|
|
|
* Function fillArcGBRITEM
|
|
|
|
* initializes a given GBRITEM so that it can draw an arc G code.
|
2008-12-29 20:05:47 +00:00
|
|
|
* <p>
|
2009-11-09 14:00:22 +00:00
|
|
|
* if multiquadrant == true : arc can be 0 to 360 degrees
|
|
|
|
* and \a rel_center is the center coordinate relative to start point.
|
2008-12-29 20:05:47 +00:00
|
|
|
* <p>
|
|
|
|
* if multiquadrant == false arc can be only 0 to 90 deg,
|
|
|
|
* and only in the same quadrant :
|
|
|
|
* <ul>
|
|
|
|
* <li> absolute angle 0 to 90 (quadrant 1) or
|
|
|
|
* <li> absolute angle 90 to 180 (quadrant 2) or
|
|
|
|
* <li> absolute angle 180 to 270 (quadrant 3) or
|
|
|
|
* <li> absolute angle 270 to 0 (quadrant 4)
|
|
|
|
* </ul><p>
|
2010-12-18 18:47:58 +00:00
|
|
|
* @param aGbrItem is the GBRITEM to fill in.
|
2008-12-29 20:05:47 +00:00
|
|
|
* @param Dcode_index is the DCODE value, like D14
|
2010-09-28 14:42:05 +00:00
|
|
|
* @param aLayer is the layer index to set into the GBRITEM
|
2008-12-29 20:05:47 +00:00
|
|
|
* @param aStart is the starting point
|
|
|
|
* @param aEnd is the ending point
|
2010-12-18 18:47:58 +00:00
|
|
|
* @param aRelCenter is the center coordinate relative to start point,
|
2009-11-09 14:00:22 +00:00
|
|
|
* given in ABSOLUTE VALUE and the sign of values x et y de rel_center
|
|
|
|
* must be calculated from the previously given constraint: arc only in the
|
|
|
|
* same quadrant.
|
2010-12-18 18:47:58 +00:00
|
|
|
* @param aClockwise true if arc must be created clockwise
|
2010-10-25 07:43:50 +00:00
|
|
|
* @param aPenSize The size of the flash. Note rectangular shapes are legal.
|
2010-12-18 18:47:58 +00:00
|
|
|
* @param aMultiquadrant = true to create arcs upto 360 deg,
|
|
|
|
* false when arc is inside one quadrant
|
2010-10-03 15:39:06 +00:00
|
|
|
* @param aLayerNegative = true if the current layer is negative
|
2008-11-14 17:49:38 +00:00
|
|
|
*/
|
2010-09-28 14:42:05 +00:00
|
|
|
static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, int aLayer,
|
|
|
|
const wxPoint& aStart, const wxPoint& aEnd,
|
2010-10-25 07:43:50 +00:00
|
|
|
const wxPoint& aRelCenter, wxSize aPenSize,
|
2010-10-11 20:57:25 +00:00
|
|
|
bool aClockwise, bool aMultiquadrant,
|
2010-10-16 14:51:22 +00:00
|
|
|
bool aLayerNegative )
|
2008-11-14 17:49:38 +00:00
|
|
|
{
|
|
|
|
wxPoint center, delta;
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
aGbrItem->m_Shape = GBR_ARC;
|
|
|
|
aGbrItem->SetLayer( aLayer );
|
2010-10-25 07:43:50 +00:00
|
|
|
aGbrItem->m_Size = aPenSize;
|
2010-09-28 14:42:05 +00:00
|
|
|
aGbrItem->m_Flashed = false;
|
2007-09-26 04:09:22 +00:00
|
|
|
|
|
|
|
|
2010-10-11 20:57:25 +00:00
|
|
|
if( aMultiquadrant )
|
|
|
|
center = aStart + aRelCenter;
|
2007-09-26 04:09:22 +00:00
|
|
|
else
|
|
|
|
{
|
2010-10-11 20:57:25 +00:00
|
|
|
// in single quadrant mode the relative coordinate aRelCenter is always >= 0
|
|
|
|
// So we must recalculate the actual sign of aRelCenter.x and aRelCenter.y
|
|
|
|
center = aRelCenter;
|
|
|
|
|
2010-12-18 18:47:58 +00:00
|
|
|
// calculate arc end coordinate relative to the starting point,
|
2010-10-11 20:57:25 +00:00
|
|
|
// because center is relative to the center point
|
2010-09-28 14:42:05 +00:00
|
|
|
delta = aEnd - aStart;
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2010-10-11 20:57:25 +00:00
|
|
|
// now calculate the relative to aStart center position, for a draw function
|
|
|
|
// that use trigonometric arc angle (or counter-clockwise)
|
|
|
|
/* Quadrants:
|
|
|
|
* Y
|
|
|
|
* 2 | 1
|
|
|
|
* -------X
|
|
|
|
* 3 | 4
|
|
|
|
* C = actual relative arc center, S = arc start (axis origin) E = relative arc end
|
|
|
|
*/
|
2009-05-10 15:43:41 +00:00
|
|
|
if( (delta.x >= 0) && (delta.y >= 0) )
|
2007-09-26 04:09:22 +00:00
|
|
|
{
|
2010-10-11 20:57:25 +00:00
|
|
|
/* Quadrant 1 (trigo or cclockwise):
|
|
|
|
* C | E
|
|
|
|
* ---S---
|
|
|
|
* 3 | 4
|
|
|
|
*/
|
|
|
|
NEGATE( center.x);
|
2007-09-26 04:09:22 +00:00
|
|
|
}
|
2009-05-10 15:43:41 +00:00
|
|
|
else if( (delta.x >= 0) && (delta.y < 0) )
|
2007-09-26 04:09:22 +00:00
|
|
|
{
|
2010-10-11 20:57:25 +00:00
|
|
|
/* Quadrant 4 (trigo or cclockwise):
|
|
|
|
* 2 | C
|
|
|
|
* ---S---
|
|
|
|
* 3 | E
|
|
|
|
*/
|
|
|
|
// Nothing to do
|
2007-09-26 04:09:22 +00:00
|
|
|
}
|
2009-05-10 15:43:41 +00:00
|
|
|
else if( (delta.x < 0) && (delta.y >= 0) )
|
2007-09-26 04:09:22 +00:00
|
|
|
{
|
2010-10-11 20:57:25 +00:00
|
|
|
/* Quadrant 2 (trigo or cclockwise):
|
|
|
|
* E | 1
|
|
|
|
* ---S---
|
|
|
|
* C | 4
|
|
|
|
*/
|
|
|
|
NEGATE( center.x);
|
|
|
|
NEGATE( center.y);
|
2007-09-26 04:09:22 +00:00
|
|
|
}
|
2009-05-10 15:43:41 +00:00
|
|
|
else
|
2007-09-26 04:09:22 +00:00
|
|
|
{
|
2010-10-11 20:57:25 +00:00
|
|
|
/* Quadrant 3 (trigo or cclockwise):
|
|
|
|
* 2 | 1
|
|
|
|
* ---S---
|
|
|
|
* E | C
|
|
|
|
*/
|
|
|
|
NEGATE( center.y);
|
2007-09-26 04:09:22 +00:00
|
|
|
}
|
|
|
|
|
2010-10-11 20:57:25 +00:00
|
|
|
// Due to your draw arc function, we need this:
|
|
|
|
if( !aClockwise )
|
|
|
|
center = - center;
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2010-10-11 20:57:25 +00:00
|
|
|
// Calculate actual arc center coordinate:
|
|
|
|
center += aStart;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aClockwise )
|
|
|
|
{
|
|
|
|
aGbrItem->m_Start = aStart;
|
|
|
|
aGbrItem->m_End = aEnd;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aGbrItem->m_Start = aEnd;
|
|
|
|
aGbrItem->m_End = aStart;
|
2007-09-26 04:09:22 +00:00
|
|
|
}
|
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
aGbrItem->m_ArcCentre = center;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2010-10-11 20:57:25 +00:00
|
|
|
aGbrItem->m_DCode = Dcode_index;
|
2010-10-16 14:51:22 +00:00
|
|
|
aGbrItem->SetLayerPolarity( aLayerNegative );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-08 12:28:13 +00:00
|
|
|
/**
|
|
|
|
* Function fillArcPOLY
|
|
|
|
* creates an arc G code when found in poly outlines.
|
|
|
|
* <p>
|
|
|
|
* if multiquadrant == true : arc can be 0 to 360 degrees
|
|
|
|
* and \a rel_center is the center coordinate relative to start point.
|
|
|
|
* <p>
|
|
|
|
* if multiquadrant == false arc can be only 0 to 90 deg,
|
|
|
|
* and only in the same quadrant :
|
|
|
|
* <ul>
|
|
|
|
* <li> absolute angle 0 to 90 (quadrant 1) or
|
|
|
|
* <li> absolute angle 90 to 180 (quadrant 2) or
|
|
|
|
* <li> absolute angle 180 to 270 (quadrant 3) or
|
|
|
|
* <li> absolute angle 270 to 0 (quadrant 4)
|
|
|
|
* </ul><p>
|
|
|
|
* @param aPcb is the board.
|
2010-12-18 18:47:58 +00:00
|
|
|
* @param aGbrItem is the GBRITEM to fill in.
|
2010-01-08 12:28:13 +00:00
|
|
|
* @param aStart is the starting point
|
|
|
|
* @param aEnd is the ending point
|
|
|
|
* @param rel_center is the center coordinate relative to start point,
|
|
|
|
* given in ABSOLUTE VALUE and the sign of values x et y de rel_center
|
|
|
|
* must be calculated from the previously given constraint: arc only in the
|
|
|
|
* same quadrant.
|
2010-12-18 18:47:58 +00:00
|
|
|
* @param aClockwise true if arc must be created clockwise
|
|
|
|
* @param aMultiquadrant = true to create arcs upto 360 deg,
|
|
|
|
* false when arc is inside one quadrant
|
2010-10-03 15:39:06 +00:00
|
|
|
* @param aLayerNegative = true if the current layer is negative
|
2007-09-26 04:09:22 +00:00
|
|
|
*/
|
2010-10-03 15:39:06 +00:00
|
|
|
static void fillArcPOLY( BOARD* aPcb, GERBER_DRAW_ITEM* aGbrItem,
|
2010-09-28 14:42:05 +00:00
|
|
|
const wxPoint& aStart, const wxPoint& aEnd,
|
|
|
|
const wxPoint& rel_center,
|
2010-12-18 18:47:58 +00:00
|
|
|
bool aClockwise, bool aMultiquadrant,
|
2010-10-16 14:51:22 +00:00
|
|
|
bool aLayerNegative )
|
2010-01-08 12:28:13 +00:00
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
/* in order to calculate arc parameters, we use fillArcGBRITEM
|
|
|
|
* so we muse create a dummy track and use its geometric parameters
|
2010-01-08 12:28:13 +00:00
|
|
|
*/
|
2010-10-09 20:05:03 +00:00
|
|
|
static GERBER_DRAW_ITEM dummyGbrItem( NULL, NULL );
|
2010-01-08 12:28:13 +00:00
|
|
|
|
2010-10-16 14:51:22 +00:00
|
|
|
aGbrItem->SetLayerPolarity( aLayerNegative );
|
2010-10-03 15:39:06 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
fillArcGBRITEM( &dummyGbrItem, 0, 0,
|
2010-10-25 07:43:50 +00:00
|
|
|
aStart, aEnd, rel_center, wxSize(0, 0),
|
2010-12-18 18:47:58 +00:00
|
|
|
aClockwise, aMultiquadrant, aLayerNegative );
|
2010-01-08 12:28:13 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
wxPoint center;
|
|
|
|
center = dummyGbrItem.m_ArcCentre;
|
2010-01-08 12:28:13 +00:00
|
|
|
|
2010-10-11 20:57:25 +00:00
|
|
|
// Calculate coordinates relative to arc center;
|
2010-09-28 14:42:05 +00:00
|
|
|
wxPoint start = dummyGbrItem.m_Start - center;
|
|
|
|
wxPoint end = dummyGbrItem.m_End - center;
|
2010-01-08 12:28:13 +00:00
|
|
|
|
|
|
|
/* Calculate angle arc
|
2010-10-11 20:57:25 +00:00
|
|
|
* angles are in 0.1 deg
|
|
|
|
* angle is trigonometrical (counter-clockwise),
|
|
|
|
* and axis is the X,Y gerber coordinates
|
2010-01-08 12:28:13 +00:00
|
|
|
*/
|
2010-10-11 20:57:25 +00:00
|
|
|
int start_angle = wxRound(atan2( (double) start.y, (double) start.x ) * 1800 / M_PI);
|
|
|
|
int end_angle = wxRound(atan2( (double) end.y, (double) end.x ) * 1800 / M_PI);
|
|
|
|
|
|
|
|
// dummyTrack has right geometric parameters, but
|
2010-10-12 10:28:30 +00:00
|
|
|
// fillArcGBRITEM calculates arc parameters for a draw function that expects
|
2010-10-11 20:57:25 +00:00
|
|
|
// start_angle < end_angle. So ensure this is the case here:
|
|
|
|
// Due to the fact atan2 returns angles between -180 to + 180 degrees,
|
2010-10-12 10:28:30 +00:00
|
|
|
// this is not always the case ( a modulo 360.0 degrees can be lost )
|
2010-10-11 20:57:25 +00:00
|
|
|
if( start_angle > end_angle )
|
|
|
|
end_angle += 3600;
|
|
|
|
|
|
|
|
int arc_angle = start_angle - end_angle;
|
|
|
|
// Approximate arc by 36 segments per 360 degree
|
2010-10-12 10:28:30 +00:00
|
|
|
const int increment_angle = 3600 / 36;
|
2010-10-11 20:57:25 +00:00
|
|
|
int count = ABS( arc_angle / increment_angle );
|
2010-01-08 12:28:13 +00:00
|
|
|
|
2010-10-11 20:57:25 +00:00
|
|
|
// calculate polygon corners
|
2010-10-12 10:28:30 +00:00
|
|
|
// when arc is counter-clockwise, dummyGbrItem arc goes from end to start
|
|
|
|
// and we must always create a polygon from start to end.
|
2010-01-08 12:28:13 +00:00
|
|
|
wxPoint start_arc = start;
|
2010-10-11 20:57:25 +00:00
|
|
|
for( int ii = 0; ii <= count; ii++ )
|
2010-01-08 12:28:13 +00:00
|
|
|
{
|
2010-10-11 20:57:25 +00:00
|
|
|
int rot;
|
2010-01-08 12:28:13 +00:00
|
|
|
wxPoint end_arc = start;
|
2010-12-18 18:47:58 +00:00
|
|
|
if( aClockwise )
|
2010-10-11 20:57:25 +00:00
|
|
|
rot = ii * increment_angle; // rot is in 0.1 deg
|
2010-01-08 12:28:13 +00:00
|
|
|
else
|
2010-10-11 20:57:25 +00:00
|
|
|
rot = (count - ii) * increment_angle; // rot is in 0.1 deg
|
2010-09-28 14:42:05 +00:00
|
|
|
|
2010-10-11 20:57:25 +00:00
|
|
|
if( ii < count )
|
|
|
|
RotatePoint( &end_arc, -rot );
|
|
|
|
else // last point
|
2010-12-18 18:47:58 +00:00
|
|
|
end_arc = aClockwise ? end : start;
|
2010-01-08 12:28:13 +00:00
|
|
|
|
2010-10-03 15:39:06 +00:00
|
|
|
aGbrItem->m_PolyCorners.push_back( end_arc + center );
|
2010-01-08 12:28:13 +00:00
|
|
|
|
|
|
|
start_arc = end_arc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
/* Read the Gnn sequence and returns the value nn.
|
|
|
|
*/
|
2010-10-16 14:51:22 +00:00
|
|
|
int GERBER_IMAGE::ReturnGCodeNumber( char*& Text )
|
2009-04-29 17:09:00 +00:00
|
|
|
{
|
2007-09-26 04:09:22 +00:00
|
|
|
int ii = 0;
|
|
|
|
char* text;
|
|
|
|
char line[1024];
|
|
|
|
|
|
|
|
if( Text == NULL )
|
|
|
|
return 0;
|
|
|
|
Text++;
|
|
|
|
text = line;
|
|
|
|
while( IsNumber( *Text ) )
|
|
|
|
{
|
|
|
|
*(text++) = *(Text++);
|
|
|
|
}
|
|
|
|
|
|
|
|
*text = 0;
|
|
|
|
ii = atoi( line );
|
|
|
|
return ii;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
/* Get the sequence Dnn and returns the value nn
|
|
|
|
*/
|
2010-10-16 14:51:22 +00:00
|
|
|
int GERBER_IMAGE::ReturnDCodeNumber( char*& Text )
|
2009-04-29 17:09:00 +00:00
|
|
|
{
|
2007-09-26 04:09:22 +00:00
|
|
|
int ii = 0;
|
|
|
|
char* text;
|
|
|
|
char line[1024];
|
|
|
|
|
|
|
|
if( Text == NULL )
|
|
|
|
return 0;
|
2008-12-16 02:20:21 +00:00
|
|
|
|
2007-09-26 04:09:22 +00:00
|
|
|
Text++;
|
|
|
|
text = line;
|
|
|
|
while( IsNumber( *Text ) )
|
|
|
|
*(text++) = *(Text++);
|
|
|
|
|
|
|
|
*text = 0;
|
|
|
|
ii = atoi( line );
|
|
|
|
return ii;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2010-10-16 14:51:22 +00:00
|
|
|
bool GERBER_IMAGE::Execute_G_Command( char*& text, int G_commande )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-10-03 15:39:06 +00:00
|
|
|
// D( printf( "%22s: G_CODE<%d>\n", __func__, G_commande ); )
|
2008-12-29 20:05:47 +00:00
|
|
|
|
2007-09-26 04:09:22 +00:00
|
|
|
switch( G_commande )
|
|
|
|
{
|
2009-11-09 14:00:22 +00:00
|
|
|
case GC_PHOTO_MODE: // can starts a D03 flash command: redundant, can
|
|
|
|
// be safely ignored
|
2008-12-17 14:51:39 +00:00
|
|
|
break;
|
|
|
|
|
2007-09-26 04:09:22 +00:00
|
|
|
case GC_LINEAR_INTERPOL_1X:
|
|
|
|
m_Iterpolation = GERB_INTERPOL_LINEAR_1X;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_CIRCLE_NEG_INTERPOL:
|
|
|
|
m_Iterpolation = GERB_INTERPOL_ARC_NEG;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_CIRCLE_POS_INTERPOL:
|
|
|
|
m_Iterpolation = GERB_INTERPOL_ARC_POS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_COMMENT:
|
2010-11-04 18:51:18 +00:00
|
|
|
// Skip comment
|
|
|
|
while ( *text && (*text != '*') )
|
|
|
|
text++;
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_LINEAR_INTERPOL_10X:
|
|
|
|
m_Iterpolation = GERB_INTERPOL_LINEAR_10X;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_LINEAR_INTERPOL_0P1X:
|
|
|
|
m_Iterpolation = GERB_INTERPOL_LINEAR_01X;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_LINEAR_INTERPOL_0P01X:
|
|
|
|
m_Iterpolation = GERB_INTERPOL_LINEAR_001X;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_SELECT_TOOL:
|
|
|
|
{
|
|
|
|
int D_commande = ReturnDCodeNumber( text );
|
|
|
|
if( D_commande < FIRST_DCODE )
|
2008-11-14 17:49:38 +00:00
|
|
|
return false;
|
2010-09-28 14:42:05 +00:00
|
|
|
if( D_commande > (TOOLS_MAX_COUNT - 1) )
|
|
|
|
D_commande = TOOLS_MAX_COUNT - 1;
|
2007-09-26 04:09:22 +00:00
|
|
|
m_Current_Tool = D_commande;
|
2008-11-09 02:58:16 +00:00
|
|
|
D_CODE* pt_Dcode = GetDCODE( D_commande, false );
|
2007-09-26 04:09:22 +00:00
|
|
|
if( pt_Dcode )
|
2008-11-14 17:49:38 +00:00
|
|
|
pt_Dcode->m_InUse = true;
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case GC_SPECIFY_INCHES:
|
2008-11-14 17:49:38 +00:00
|
|
|
m_GerbMetric = false; // false = Inches, true = metric
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_SPECIFY_MILLIMETERS:
|
2008-11-14 17:49:38 +00:00
|
|
|
m_GerbMetric = true; // false = Inches, true = metric
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
|
2010-10-04 15:20:37 +00:00
|
|
|
case GC_TURN_OFF_360_INTERPOL: // disable Multi cadran arc and Arc interpol
|
2010-10-11 20:57:25 +00:00
|
|
|
m_360Arc_enbl = false;
|
|
|
|
m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // not sure it should be done
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_TURN_ON_360_INTERPOL:
|
2008-11-14 17:49:38 +00:00
|
|
|
m_360Arc_enbl = true;
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_SPECIFY_ABSOLUES_COORD:
|
2010-01-08 12:28:13 +00:00
|
|
|
m_Relative = false; // false = absolute Coord, true = relative
|
2009-11-09 14:00:22 +00:00
|
|
|
// Coord
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_SPECIFY_RELATIVEES_COORD:
|
2010-01-08 12:28:13 +00:00
|
|
|
m_Relative = true; // false = absolute Coord, true = relative
|
2009-11-09 14:00:22 +00:00
|
|
|
// Coord
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_TURN_ON_POLY_FILL:
|
2008-11-14 17:49:38 +00:00
|
|
|
m_PolygonFillMode = true;
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GC_TURN_OFF_POLY_FILL:
|
2010-10-15 18:59:26 +00:00
|
|
|
if( m_Exposure && m_Parent->GetBoard()->m_Drawings ) // End of polygon
|
|
|
|
{
|
|
|
|
GERBER_DRAW_ITEM * gbritem =
|
|
|
|
(GERBER_DRAW_ITEM*)( m_Parent->GetBoard()->m_Drawings.GetLast() );
|
|
|
|
StepAndRepeatItem( *gbritem );
|
|
|
|
}
|
|
|
|
m_Exposure = false;
|
2009-04-29 17:09:00 +00:00
|
|
|
m_PolygonFillMode = false;
|
2007-09-26 04:09:22 +00:00
|
|
|
m_PolygonFillModeState = 0;
|
|
|
|
break;
|
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
case GC_MOVE: // Non existent
|
2007-09-26 04:09:22 +00:00
|
|
|
default:
|
|
|
|
{
|
2010-10-06 17:28:07 +00:00
|
|
|
wxString msg;
|
|
|
|
msg.Printf( wxT( "G%0.2d command not handled" ), G_commande );
|
|
|
|
ReportMessage( msg );
|
2008-11-14 17:49:38 +00:00
|
|
|
return false;
|
2007-09-26 04:09:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-11-14 17:49:38 +00:00
|
|
|
return true;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2008-11-14 07:46:43 +00:00
|
|
|
/**
|
|
|
|
* Function scale
|
|
|
|
* converts a distance given in floating point to our deci-mils
|
|
|
|
*/
|
2010-10-01 19:11:30 +00:00
|
|
|
int scale( double aCoord, bool isMetric )
|
2008-11-14 07:46:43 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if( isMetric )
|
2009-04-05 20:49:15 +00:00
|
|
|
ret = wxRound( aCoord / 0.00254 );
|
2008-11-14 07:46:43 +00:00
|
|
|
else
|
2009-04-05 20:49:15 +00:00
|
|
|
ret = wxRound( aCoord * PCB_INTERNAL_UNIT );
|
2008-11-14 07:46:43 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-16 14:51:22 +00:00
|
|
|
bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
wxSize size( 15, 15 );
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
APERTURE_T aperture = APT_CIRCLE;
|
|
|
|
GERBER_DRAW_ITEM* gbritem;
|
2010-10-15 18:59:26 +00:00
|
|
|
BOARD* pcb = m_Parent->GetBoard();
|
2008-11-14 17:49:38 +00:00
|
|
|
|
2010-10-15 18:59:26 +00:00
|
|
|
int activeLayer = m_Parent->GetScreen()->m_Active_Layer;
|
2008-11-08 06:44:07 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
int dcode = 0;
|
|
|
|
D_CODE* tool = NULL;
|
|
|
|
wxString msg;
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2010-10-03 15:39:06 +00:00
|
|
|
// D( printf( "%22s: D_CODE<%d>\n", __func__, D_commande ); )
|
2008-12-29 20:05:47 +00:00
|
|
|
|
2007-09-26 04:09:22 +00:00
|
|
|
if( D_commande >= FIRST_DCODE ) // This is a "Set tool" command
|
|
|
|
{
|
2010-09-28 14:42:05 +00:00
|
|
|
if( D_commande > (TOOLS_MAX_COUNT - 1) )
|
|
|
|
D_commande = TOOLS_MAX_COUNT - 1;
|
2008-11-10 07:13:37 +00:00
|
|
|
|
2009-11-09 14:00:22 +00:00
|
|
|
// remember which tool is selected, nothing is done with it in this
|
|
|
|
// call
|
2007-09-26 04:09:22 +00:00
|
|
|
m_Current_Tool = D_commande;
|
2008-11-14 07:46:43 +00:00
|
|
|
|
2008-11-09 02:58:16 +00:00
|
|
|
D_CODE* pt_Dcode = GetDCODE( D_commande, false );
|
2007-09-26 04:09:22 +00:00
|
|
|
if( pt_Dcode )
|
2008-11-14 17:49:38 +00:00
|
|
|
pt_Dcode->m_InUse = true;
|
2008-11-10 07:13:37 +00:00
|
|
|
|
2008-11-14 17:49:38 +00:00
|
|
|
return true;
|
2007-09-26 04:09:22 +00:00
|
|
|
}
|
2009-11-09 14:00:22 +00:00
|
|
|
else // D_commande = 0..9: this is a pen command (usually D1, D2 or D3)
|
2007-09-26 04:09:22 +00:00
|
|
|
{
|
|
|
|
m_Last_Pen_Command = D_commande;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_PolygonFillMode ) // Enter a polygon description:
|
|
|
|
{
|
|
|
|
switch( D_commande )
|
|
|
|
{
|
2008-11-10 07:13:37 +00:00
|
|
|
case 1: // code D01 Draw line, exposure ON
|
2010-09-28 14:42:05 +00:00
|
|
|
if( !m_Exposure )
|
|
|
|
{
|
|
|
|
m_Exposure = true;
|
2010-10-09 20:05:03 +00:00
|
|
|
gbritem = new GERBER_DRAW_ITEM( pcb, this );
|
2010-09-28 14:42:05 +00:00
|
|
|
pcb->m_Drawings.Append( gbritem );
|
|
|
|
gbritem->m_Shape = GBR_POLYGON;
|
|
|
|
gbritem->SetLayer( activeLayer );
|
2010-10-11 20:57:25 +00:00
|
|
|
gbritem->m_Flashed = false;
|
2010-09-28 14:42:05 +00:00
|
|
|
}
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2010-01-08 12:28:13 +00:00
|
|
|
switch( m_Iterpolation )
|
2008-12-29 18:02:54 +00:00
|
|
|
{
|
2010-01-08 12:28:13 +00:00
|
|
|
case GERB_INTERPOL_ARC_NEG:
|
|
|
|
case GERB_INTERPOL_ARC_POS:
|
2010-09-28 14:42:05 +00:00
|
|
|
gbritem = (GERBER_DRAW_ITEM*)( pcb->m_Drawings.GetLast() );
|
2010-10-11 20:57:25 +00:00
|
|
|
|
|
|
|
// D( printf( "Add arc poly %d,%d to %d,%d fill %d interpol %d 360_enb %d\n",
|
|
|
|
// m_PreviousPos.x, m_PreviousPos.y, m_CurrentPos.x,
|
|
|
|
// m_CurrentPos.y, m_PolygonFillModeState,
|
2010-10-04 15:20:37 +00:00
|
|
|
// m_Iterpolation, m_360Arc_enbl ); )
|
2010-09-28 14:42:05 +00:00
|
|
|
fillArcPOLY( pcb, gbritem, m_PreviousPos,
|
2010-10-11 20:57:25 +00:00
|
|
|
m_CurrentPos, m_IJPos,
|
|
|
|
( m_Iterpolation == GERB_INTERPOL_ARC_NEG ) ? false : true,
|
2010-10-16 14:51:22 +00:00
|
|
|
m_360Arc_enbl, GetLayerParams().m_LayerNegative );
|
2010-01-08 12:28:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-09-28 14:42:05 +00:00
|
|
|
gbritem = (GERBER_DRAW_ITEM*)( pcb->m_Drawings.GetLast() );
|
2010-10-11 20:57:25 +00:00
|
|
|
|
2010-10-03 15:39:06 +00:00
|
|
|
// D( printf( "Add poly edge %d,%d to %d,%d fill %d\n",
|
|
|
|
// m_PreviousPos.x, m_PreviousPos.y,
|
|
|
|
// m_CurrentPos.x, m_CurrentPos.y, m_Iterpolation ); )
|
2010-01-08 12:28:13 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
gbritem->m_Start = m_PreviousPos; // m_Start is used as temporary storage
|
|
|
|
if( gbritem->m_PolyCorners.size() == 0 )
|
|
|
|
gbritem->m_PolyCorners.push_back( gbritem->m_Start );
|
2010-01-08 12:28:13 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
gbritem->m_End = m_CurrentPos; // m_End is used as temporary storage
|
|
|
|
gbritem->m_PolyCorners.push_back( gbritem->m_End );
|
2010-01-08 12:28:13 +00:00
|
|
|
break;
|
2008-12-29 18:02:54 +00:00
|
|
|
}
|
2008-12-29 20:05:47 +00:00
|
|
|
|
2007-09-26 04:09:22 +00:00
|
|
|
m_PreviousPos = m_CurrentPos;
|
|
|
|
m_PolygonFillModeState = 1;
|
|
|
|
break;
|
|
|
|
|
2008-11-10 07:13:37 +00:00
|
|
|
case 2: // code D2: exposure OFF (i.e. "move to")
|
2010-10-15 18:59:26 +00:00
|
|
|
if( m_Exposure && pcb->m_Drawings ) // End of polygon
|
|
|
|
{
|
|
|
|
gbritem = (GERBER_DRAW_ITEM*)( pcb->m_Drawings.GetLast() );
|
|
|
|
StepAndRepeatItem( *gbritem );
|
|
|
|
}
|
2009-04-29 17:09:00 +00:00
|
|
|
m_Exposure = false;
|
2007-09-26 04:09:22 +00:00
|
|
|
m_PreviousPos = m_CurrentPos;
|
|
|
|
m_PolygonFillModeState = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2008-11-14 17:49:38 +00:00
|
|
|
return false;
|
2007-09-26 04:09:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2008-12-16 02:20:21 +00:00
|
|
|
{
|
2007-09-26 04:09:22 +00:00
|
|
|
switch( D_commande )
|
|
|
|
{
|
2008-11-10 07:13:37 +00:00
|
|
|
case 1: // code D01 Draw line, exposure ON
|
2008-11-14 07:46:43 +00:00
|
|
|
m_Exposure = true;
|
|
|
|
|
|
|
|
tool = GetDCODE( m_Current_Tool, false );
|
|
|
|
if( tool )
|
2007-09-26 04:09:22 +00:00
|
|
|
{
|
2008-11-14 07:46:43 +00:00
|
|
|
size = tool->m_Size;
|
|
|
|
dcode = tool->m_Num_Dcode;
|
|
|
|
aperture = tool->m_Shape;
|
2007-09-26 04:09:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch( m_Iterpolation )
|
|
|
|
{
|
|
|
|
case GERB_INTERPOL_LINEAR_1X:
|
2010-10-09 20:05:03 +00:00
|
|
|
gbritem = new GERBER_DRAW_ITEM( pcb, this );
|
2010-09-28 14:42:05 +00:00
|
|
|
pcb->m_Drawings.Append( gbritem );
|
2010-10-11 20:57:25 +00:00
|
|
|
|
2010-10-04 15:20:37 +00:00
|
|
|
// D( printf( "Add line %d,%d to %d,%d\n",
|
|
|
|
// m_PreviousPos.x, m_PreviousPos.y,
|
|
|
|
// m_CurrentPos.x, m_CurrentPos.y ); )
|
2010-09-28 14:42:05 +00:00
|
|
|
fillLineGBRITEM( gbritem, dcode, activeLayer, m_PreviousPos,
|
2010-10-25 07:43:50 +00:00
|
|
|
m_CurrentPos, size, GetLayerParams().m_LayerNegative );
|
2010-10-15 18:59:26 +00:00
|
|
|
StepAndRepeatItem( *gbritem );
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GERB_INTERPOL_LINEAR_01X:
|
|
|
|
case GERB_INTERPOL_LINEAR_001X:
|
|
|
|
case GERB_INTERPOL_LINEAR_10X:
|
|
|
|
wxBell();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GERB_INTERPOL_ARC_NEG:
|
|
|
|
case GERB_INTERPOL_ARC_POS:
|
2010-10-09 20:05:03 +00:00
|
|
|
gbritem = new GERBER_DRAW_ITEM( pcb, this );
|
2010-09-28 14:42:05 +00:00
|
|
|
pcb->m_Drawings.Append( gbritem );
|
2010-10-11 20:57:25 +00:00
|
|
|
|
2010-10-04 15:20:37 +00:00
|
|
|
// D( printf( "Add arc %d,%d to %d,%d center %d, %d interpol %d 360_enb %d\n",
|
|
|
|
// m_PreviousPos.x, m_PreviousPos.y, m_CurrentPos.x,
|
|
|
|
// m_CurrentPos.y, m_IJPos.x,
|
|
|
|
// m_IJPos.y, m_Iterpolation, m_360Arc_enbl ); )
|
2010-09-28 14:42:05 +00:00
|
|
|
fillArcGBRITEM( gbritem, dcode, activeLayer, m_PreviousPos,
|
2010-10-25 07:43:50 +00:00
|
|
|
m_CurrentPos, m_IJPos, size,
|
2010-10-11 20:57:25 +00:00
|
|
|
( m_Iterpolation == GERB_INTERPOL_ARC_NEG ) ?
|
2010-10-16 14:51:22 +00:00
|
|
|
false : true, m_360Arc_enbl, GetLayerParams().m_LayerNegative );
|
2010-10-15 18:59:26 +00:00
|
|
|
StepAndRepeatItem( *gbritem );
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-10-05 19:54:27 +00:00
|
|
|
msg.Printf( wxT( "RS274D: DCODE Command: interpol error (type %X)" ),
|
2009-05-21 17:42:42 +00:00
|
|
|
m_Iterpolation );
|
2010-10-05 11:44:34 +00:00
|
|
|
ReportMessage( msg );
|
2007-09-26 04:09:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_PreviousPos = m_CurrentPos;
|
|
|
|
break;
|
|
|
|
|
2008-11-10 07:13:37 +00:00
|
|
|
case 2: // code D2: exposure OFF (i.e. "move to")
|
2010-10-11 20:57:25 +00:00
|
|
|
m_Exposure = false;
|
|
|
|
|
2010-10-04 15:20:37 +00:00
|
|
|
// D( printf( "Move to %d,%d to %d,%d\n",
|
|
|
|
// m_PreviousPos.x, m_PreviousPos.y,
|
|
|
|
// m_CurrentPos.x, m_CurrentPos.y ); )
|
2007-09-26 04:09:22 +00:00
|
|
|
m_PreviousPos = m_CurrentPos;
|
|
|
|
break;
|
|
|
|
|
2008-11-10 07:13:37 +00:00
|
|
|
case 3: // code D3: flash aperture
|
2008-11-14 07:46:43 +00:00
|
|
|
tool = GetDCODE( m_Current_Tool, false );
|
|
|
|
if( tool )
|
2007-09-26 04:09:22 +00:00
|
|
|
{
|
2008-11-14 07:46:43 +00:00
|
|
|
size = tool->m_Size;
|
|
|
|
dcode = tool->m_Num_Dcode;
|
|
|
|
aperture = tool->m_Shape;
|
2007-09-26 04:09:22 +00:00
|
|
|
}
|
|
|
|
|
2010-10-09 20:05:03 +00:00
|
|
|
gbritem = new GERBER_DRAW_ITEM( pcb, this );
|
2010-10-03 15:39:06 +00:00
|
|
|
pcb->m_Drawings.Append( gbritem );
|
2010-10-11 20:57:25 +00:00
|
|
|
|
2010-10-04 15:20:37 +00:00
|
|
|
// D( printf( "Add flashed dcode %d layer %d at %d %d\n", dcode, activeLayer,
|
|
|
|
// m_CurrentPos.x, m_CurrentPos.y ); )
|
2010-10-03 15:39:06 +00:00
|
|
|
fillFlashedGBRITEM( gbritem, aperture,
|
|
|
|
dcode, activeLayer, m_CurrentPos,
|
2010-10-16 14:51:22 +00:00
|
|
|
size, GetLayerParams().m_LayerNegative );
|
2010-10-15 18:59:26 +00:00
|
|
|
StepAndRepeatItem( *gbritem );
|
2007-09-26 04:09:22 +00:00
|
|
|
m_PreviousPos = m_CurrentPos;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2008-11-14 17:49:38 +00:00
|
|
|
return false;
|
2007-09-26 04:09:22 +00:00
|
|
|
}
|
2008-12-16 02:20:21 +00:00
|
|
|
}
|
2007-09-26 04:09:22 +00:00
|
|
|
|
2008-11-14 17:49:38 +00:00
|
|
|
return true;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|