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