Commit 22f483e1 authored by jean-pierre charras's avatar jean-pierre charras

Gerbview: minor changes: Added comments, fixed errors in comments, fixed a very minor error.

parents 961a51bd 748a2051
......@@ -233,27 +233,15 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
halfPenWidth = m_Size.x >> 1;
if( isFilled == SKETCH )
if( !isFilled )
{
// draw the border of the pen's path using two circles, each as narrow as possible
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( halfPenWidth ) < L_MIN_DESSIN )
#else
if( panel->GetScreen()->Scale( halfPenWidth ) < L_MIN_DESSIN )
#endif
{
GRCircle( &panel->m_ClipBox, DC, m_Start.x,
m_Start.y, radius, 0, color );
}
else
{
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
radius - halfPenWidth, 0, color );
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
radius + halfPenWidth, 0, color );
}
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
radius - halfPenWidth, 0, color );
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
radius + halfPenWidth, 0, color );
}
else
else // Filled mode
{
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
radius, m_Size.x, color );
......
......@@ -20,14 +20,14 @@
* 1 to 999
*
* D_CODES:
* D01 ... D9 = action codes:
* D01 = activating light (lower pen) when di placement
* D02 = light extinction (lift pen) when di placement
* D03 Flash
* D09 = VAPE Flash
* D10 ... = Indentification Tool (Shape id)
* D01 ... D9 = command codes:
* D01 = activating light (pen down) while moving
* D02 = light extinction (pen up) while moving
* D03 = Flash
* D04 to D09 = non used
* D10 ... D999 = Indentification Tool (Shape id)
*
* For tools:
* For tools defining a shape):
* DCode min = D10
* DCode max = 999
*/
......@@ -96,7 +96,16 @@ const wxChar* D_CODE::ShowApertureType( APERTURE_T aType )
return ret;
}
/** Function Read_D_Code_File
* Can be useful only with old RS274D Gerber file format.
* Is not needed with RS274X files format.
* These files need an auxiliary DCode file description. Ther is no defined file format for this.
* This function read a file format I needed a long time ago.
* reads in a dcode file assuming ALSPCB file format with ';' indicating comments.
* Format is like CSV but with optional ';' delineated comments:
* tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)]
* ex: 1, 12, 12, 0, 0, 0, 3 ; D10
*/
int WinEDA_GerberFrame::Read_D_Code_File( const wxString& D_Code_FullFileName )
{
int current_Dcode, ii, dcode_scale;
......@@ -112,9 +121,7 @@ int WinEDA_GerberFrame::Read_D_Code_File( const wxString& D_Code_FullFileName )
int type_outil;
if( g_GERBER_List[layer] == NULL )
{
g_GERBER_List[layer] = new GERBER( layer );
}
GERBER* gerber = g_GERBER_List[layer];
......@@ -158,13 +165,11 @@ int WinEDA_GerberFrame::Read_D_Code_File( const wxString& D_Code_FullFileName )
if( ii >= 6 ) /* valeurs en mils */
{
sscanf( line, "%d,%d,%d,%d,%d,%d,%d", &ii,
&dimH, &dimV, &drill,
&dummy, &dummy,
&type_outil );
&dimH, &dimV, &drill, &dummy, &dummy, &type_outil );
dimH = (int) ( (dimH * dcode_scale) + 0.5 );
dimV = (int) ( (dimV * dcode_scale) + 0.5 );
drill = (int) ( (drill * dcode_scale) + 0.5 );
dimH = wxRound( dimH * dcode_scale );
dimV = wxRound( dimV * dcode_scale );
drill = wxRound( drill * dcode_scale );
if( ii < 1 )
ii = 1;
current_Dcode = ii - 1 + FIRST_DCODE;
......@@ -187,9 +192,9 @@ int WinEDA_GerberFrame::Read_D_Code_File( const wxString& D_Code_FullFileName )
ptcar++;
}
dimH = (int) ( (fdimH * dcode_scale * 1000) + 0.5 );
dimV = (int) ( (fdimV * dcode_scale * 1000) + 0.5 );
drill = (int) ( (fdrill * dcode_scale * 1000) + 0.5 );
dimH = wxRound( fdimH * dcode_scale * 1000 );
dimV = wxRound( fdimV * dcode_scale * 1000 );
drill = wxRound( fdrill * dcode_scale * 1000 );
if( strchr( "CLROP", c_type_outil[0] ) )
type_outil = (APERTURE_T) c_type_outil[0];
......
......@@ -17,12 +17,13 @@
* http://gerbv.sourceforge.net/docs/rs274xrevd_e.pdf
*/
enum APERTURE_T {
APT_CIRCLE = 'C',
APT_LINE = 'L',
APT_RECT = 'R',
APT_OVAL = '0',
APT_POLYGON = 'P',
APT_MACRO = 'M'
APT_CIRCLE = 'C', // Flashed shape: Circle with or without hole
APT_LINE = 'L', // tool to draw line. Not used to flash items
APT_RECT = 'R', // Flashed shape: Rectangle with or without hole
APT_OVAL = '0', // Flashed shape: Oval with or without hole
APT_POLYGON = 'P', // Flashed shape: Regular polygon (3 to 12 edges)
// with or without hole. Can be rotated
APT_MACRO = 'M' // Complex shape given by a macro definition (see AM_PRIMITIVE_ID)
};
// In aperture definition, round, oval and rectangular flashed shapes
......@@ -101,18 +102,20 @@ private:
* Enum AM_PRIMITIVE_ID
* is the set of all "aperture macro primitives" (primitive numbers). See
* Table 3 in http://gerbv.sourceforge.net/docs/rs274xrevd_e.pdf
* aperture macro primitives are basic shapes which can be combined to create a complex shape
* This complex shape is flashed.
*/
enum AM_PRIMITIVE_ID {
AMP_CIRCLE = 1,
AMP_LINE2 = 2,
AMP_LINE20 = 20,
AMP_LINE_CENTER = 21,
AMP_LINE_LOWER_LEFT = 22,
AMP_EOF = 3,
AMP_OUTLINE = 4,
AMP_POLYGON = 5,
AMP_MOIRE = 6,
AMP_THERMAL = 7,
AMP_CIRCLE = 1, // Circle. (diameter and position)
AMP_LINE2 = 2, // Line with rectangle ends. (Width, start and end pos + rotation)
AMP_LINE20 = 20, // Same as AMP_LINE2
AMP_LINE_CENTER = 21, // Rectangle. (height, width and center pos + rotation)
AMP_LINE_LOWER_LEFT = 22, // Rectangle. (height, width and lrft bottom corner pos + rotation)
AMP_EOF = 3, // End Of File marquer: not really a shape
AMP_OUTLINE = 4, // Free polyline (n corners + rotation)
AMP_POLYGON = 5, // Closed regular polygon(diameter, number of vertices (3 to 10), rotation)
AMP_MOIRE = 6, // A cross hair with n concentric circles + rotation
AMP_THERMAL = 7, // Thermal shape (pos, outer and inner dioameter, cross hair thickness + rotation)
};
......@@ -197,9 +200,9 @@ class D_CODE
*/
DCODE_PARAMS m_am_params;
std::vector <wxPoint> m_PolyCorners; /* Polygon used to draw AMP_POLYGON shape and some other
std::vector <wxPoint> m_PolyCorners; /* Polygon used to draw APT_POLYGON shape and some other
* complex shapes which are converted to polygon
* (shapes with hole, rotated rectangles ...
* (shapes with hole )
*/
public:
......
......@@ -19,32 +19,26 @@
#define IsNumber( x ) ( ( ( (x) >= '0' ) && ( (x) <='9' ) ) \
|| ( (x) == '-' ) || ( (x) == '+' ) || ( (x) == '.' ) )
/* Format Gerber: NOTES:
* Functions history:
/* Gerber: NOTES about some important commands found in RS274D and RS274X (G codes):
* Gn =
* G01 linear interpolation (right trace)
* G02, G20, G21 Circular interpolation, meaning trig <0
* G03, G30, G31 Circular interpolation, meaning trigo> 0
* G04 review
* G04 = comment
* G06 parabolic interpolation
* G07 Cubic Interpolation
* G10 linear interpolation (scale x10)
* G11 linear interpolation (0.1x range)
* G12 linear interpolation (0.01x scale)
* G52 plot symbol reference code by Dnn
* G53 plot symbol reference by Dnn; symbol rotates from -90 degrees
* G36 Start polygon mode
* G37 Stop polygon mode (and close it)
* G54 Selection Tool
* G55 Fashion photo exhibition
* G56 plot symbol reference code for DNN
* G57 displays the symbol link to the console
* G58 plot displays the symbol and link to the console
* G60 linear interpolation (scale x100)
* G70 Units = Inches
* G71 Units = Millimeters
* G74 circular interpolation removes 360 degree, has returned G01
* Active G75 circular interpolation on 360 degree
* G70 Select Units = Inches
* G71 Select Units = Millimeters
* G74 circular interpolation removes 360 degree (arc draw mode) finishing by G01
* G75 circular interpolation on 360 degree
* G90 mode absolute coordinates
* G91 Fashion Related Contacts
*
* X, Y
* X and Y are followed by + or - and m + n digits (not separated)
......@@ -53,23 +47,20 @@
* Classic formats: m = 2, n = 3 (size 2.3)
* m = 3, n = 4 (size 3.4)
* eg
* G__ X00345Y-06123 * D__
* GxxX00345Y-06123*
*
* Tools and D_CODES
* Tool number (identification of shapes)
* 1 to 99 (Classical)
* 1 to 999
* 10 to 999
* D_CODES:
* 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
*
* D01 ... D9 = action codes:
* D01 = activating light (lower pen) when placement
* D02 = light extinction (lift pen) when placement
* D03 = Flash
* D09 = VAPE Flash
* D51 = G54 preceded by -> Select VAPE
*
* D10 ... D255 = Identification Tool (Opening)
* Not tj in order (see table in PCBPLOT.H)
* D10 ... D999 = Identification Tool: tool selection
*/
// Photoplot actions:
......@@ -999,9 +990,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame,
NEGATE( gbritem->m_End.y );
gbritem->m_PolyCorners.push_back( gbritem->m_End );
// the first track of each polygon has a netcode of zero,
// otherwise one. Set the erasure flag in that special track,
// if a negative polygon.
// Set the erasure flag of gbritem if a negative polygon.
if( !m_PolygonFillModeState )
{
if( m_LayerNegative ^ m_ImageNegative )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment