Added definitions for FIRST_COPPER_LAYER and LAST_COPPER_LAYER

This commit is contained in:
g_harland 2007-11-01 05:27:31 +00:00
parent 74b4e03234
commit 5746386290
18 changed files with 818 additions and 696 deletions

View File

@ -59,7 +59,8 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
glRotatef(g_Parm_3D_Visu.m_Rot[1], 0.0, 1.0, 0.0);
glRotatef(g_Parm_3D_Visu.m_Rot[2], 0.0, 0.0, 1.0);
if( m_gllist ) glCallList( m_gllist );
if( m_gllist )
glCallList( m_gllist );
else
{
m_gllist = CreateDrawGL_List();
@ -67,10 +68,12 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
}
glFlush();
if (finish) glFinish();
if( finish )
glFinish();
SwapBuffers();
}
/**********************************************/
GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
/**********************************************/
@ -102,7 +105,8 @@ int ii;
if( ii < g_Parm_3D_Visu.m_Layers )
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width * ii
/ (g_Parm_3D_Visu.m_Layers - 1);
else g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width;
else
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width;
}
GLfloat zpos_cu = 500 * g_Parm_3D_Visu.m_BoardScale;
GLfloat zpos_cmp = g_Parm_3D_Visu.m_Epoxy_Width + zpos_cu;
@ -124,19 +128,25 @@ int ii;
SetGLColor(WHITE);
glBegin(GL_LINES);
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
glVertex3f( 0.0 , 0.0, 0.0); glVertex3f(1.0, 0.0, 0.0); // X axis
glVertex3f( 0.0 , 0.0, 0.0); glVertex3f(0.0, -1.0, 0.0); // y axis
glVertex3f( 0.0, 0.0, 0.0 );
glVertex3f( 1.0, 0.0, 0.0 ); // X axis
glVertex3f( 0.0, 0.0, 0.0);
glVertex3f( 0.0, -1.0, 0.0); // Y axis
glNormal3f( 1.0, 0.0, 0.0); // Normal is Y axis
glVertex3f( 0.0 , 0.0, 0.0); glVertex3f(0.0, 0.0, 0.3); // z axis
glVertex3f( 0.0 , 0.0, 0.0);
glVertex3f( 0.0, 0.0, 0.3 ); // Z axis
glEnd();
/* Draw epoxy limits (do not use, works and test in progress) */
#if 0
glEnable(GL_FOG);
GLfloat param;
// param = GL_LINEAR; glFogfv(GL_FOG_MODE,& param);
param = 0.2; glFogfv(GL_FOG_DENSITY,& param);
param = g_Parm_3D_Visu.m_LayerZcoord[15]; glFogfv(GL_FOG_END,& param);
// param = GL_LINEAR;
// glFogfv(GL_FOG_MODE, & param);
param = 0.2;
glFogfv(GL_FOG_DENSITY, & param);
param = g_Parm_3D_Visu.m_LayerZcoord[15];
glFogfv(GL_FOG_END, & param);
glBegin(GL_QUADS);
SetGLColor(g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N]);
double sx = DataScale3D * g_Parm_3D_Visu.m_BoardSize.x / 2;
@ -170,7 +180,8 @@ glEnable(GL_FOG);
{
if( pt_piste->Type() == TYPEVIA )
Draw3D_Via((SEGVIA*)pt_piste);
else Draw3D_Track( pt_piste);
else
Draw3D_Track( pt_piste);
}
/* Tracé des edges */
@ -178,7 +189,8 @@ EDA_BaseStruct * PtStruct;
for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{
#define STRUCT ((DRAWSEGMENT *) PtStruct)
if( PtStruct->Type() != TYPEDRAWSEGMENT ) continue;
if( PtStruct->Type() != TYPEDRAWSEGMENT )
continue;
Draw3D_DrawSegment(STRUCT);
}
@ -197,6 +209,7 @@ MODULE * Module = (MODULE*) pcb->m_Modules;
return gllist;
}
/************************************************/
void Pcb3D_GLCanvas::Draw3D_Track(TRACK * track)
/************************************************/
@ -207,8 +220,9 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
double ox, oy, fx, fy;
double w;
if ( color & ITEM_NOT_SHOW ) return;
if ( layer == CMP_N )
if( color & ITEM_NOT_SHOW )
return;
if( layer == LAST_COPPER_LAYER )
layer = g_Parm_3D_Visu.m_Layers - 1;
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
@ -223,6 +237,7 @@ double w;
Draw3D_FilledSegment(ox, -oy, fx, -fy, w, zpos);
}
/********************************************/
void Pcb3D_GLCanvas::Draw3D_Via(SEGVIA * via)
/*********************************************/
@ -247,13 +262,15 @@ int color;
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
if( layer < g_Parm_3D_Visu.m_Layers - 1 )
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
else color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N];
if ( color & ITEM_NOT_SHOW ) continue;
else
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N];
if( color & ITEM_NOT_SHOW )
continue;
SetGLColor(color);
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
Draw3D_FilledCircle(x, -y, r, hole, zpos);
if ( layer >= top_layer) break;
if( layer >= top_layer)
break;
}
// Drawing hole:
SetGLColor(DARKGRAY);
@ -271,7 +288,8 @@ double x, y, xf, yf;
double zpos, w;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()];
if ( color & ITEM_NOT_SHOW ) return;
if( color & ITEM_NOT_SHOW )
return;
SetGLColor(color);
w = segment->m_Width * g_Parm_3D_Visu.m_BoardScale;
@ -298,7 +316,6 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()];
}
/*********************************************/
void MODULE::Draw3D(Pcb3D_GLCanvas * glcanvas)
/*********************************************/
@ -308,11 +325,13 @@ D_PAD * pad = m_Pads;
#if 0
if( ! DisplayOpt.Show_Modules_Cmp )
{
if(m_Layer == CMP_N) return;
if( m_Layer == CMP_N )
return;
}
if( ! DisplayOpt.Show_Modules_Cu )
{
if(m_Layer == COPPER_LAYER_N) return;
if( m_Layer == COPPER_LAYER_N )
return;
}
#endif
@ -367,12 +386,14 @@ bool As3dShape = FALSE;
((EDGE_MODULE *) Struct)->Draw3D(glcanvas);
break;
default: break;
default:
break;
}
}
}
}
/***************************************************/
void EDGE_MODULE::Draw3D(Pcb3D_GLCanvas * glcanvas)
/***************************************************/
@ -381,7 +402,8 @@ int ux0, uy0, dx, dy,rayon, StAngle, EndAngle;
double scale, x, y, fx, fy, w, zpos;
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
if ( color & ITEM_NOT_SHOW ) return;
if( color & ITEM_NOT_SHOW )
return;
SetGLColor(color);
glNormal3f( 0.0, 0.0, (m_Layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
@ -477,14 +499,19 @@ int color;
x = xc * scale;
y = yc * scale;
r = (double)dx * scale;
for ( layer = COPPER_LAYER_N; layer <= CMP_N; layer ++)
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
{
if (layer && (layer == nlmax) ) layer = CMP_N;
if ( (layer == CMP_N) && ! Oncmp ) continue;
if ( (layer == COPPER_LAYER_N) && ! Oncu ) continue;
if ( (layer > COPPER_LAYER_N) && (layer < CMP_N) && !Both) continue;
if( layer && (layer == nlmax) )
layer = CMP_N;
if( (layer == CMP_N) && ! Oncmp )
continue;
if( (layer == COPPER_LAYER_N) && ! Oncu )
continue;
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both)
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
if ( color & ITEM_NOT_SHOW ) continue;
if( color & ITEM_NOT_SHOW )
continue;
SetGLColor(color);
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
@ -496,13 +523,15 @@ int color;
/* calcul de l'entraxe de l'ellipse */
if( dx > dy ) /* ellipse horizontale */
{
delta_cx = dx - dy; delta_cy = 0;
delta_cx = dx - dy;
delta_cy = 0;
w = m_Size.y * scale;
delta_angle = angle + 900;
}
else /* ellipse verticale */
{
delta_cx = 0; delta_cy = dy - dx;
delta_cx = 0;
delta_cy = dy - dx;
w = m_Size.x * scale;
delta_angle = angle;
}
@ -513,15 +542,20 @@ int color;
oy = (double)(uy0 + delta_cy) * scale;
fx = (double)(ux0 - delta_cx) * scale;
fy = (double)(uy0 - delta_cy) * scale;
for ( layer = COPPER_LAYER_N; layer <= CMP_N; layer ++)
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer ++ )
{
if (layer && (layer == nlmax) ) layer = CMP_N;
if ( (layer == CMP_N) && ! Oncmp ) continue;
if ( (layer == COPPER_LAYER_N) && ! Oncu ) continue;
if ( (layer > COPPER_LAYER_N) && (layer < CMP_N) && !Both) continue;
if( layer && (layer == nlmax) )
layer = CMP_N;
if( (layer == CMP_N) && ! Oncmp )
continue;
if( (layer == COPPER_LAYER_N) && ! Oncu )
continue;
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
if ( color & ITEM_NOT_SHOW ) continue;
if( color & ITEM_NOT_SHOW )
continue;
SetGLColor(color);
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
Draw3D_FilledSegmentWithHole(ox, -oy, fx, -fy, w, drillx, -drilly, hole, zpos);
@ -558,12 +592,16 @@ int color;
fcoord[ll][0] = coord[ii][0] * scale;
fcoord[ll][1] = coord[ii][1] * scale;
}
for( ii = 0; ii < 7; ii += 2 )
{
ll = ii+2; if (ll > 7) ll -= 8;
ll = ii + 2;
if( ll > 7 )
ll -= 8;
fcoord[ii + 1][0] = (fcoord[ii][0] + fcoord[ll][0]) / 2;
fcoord[ii + 1][1] = (fcoord[ii][1] + fcoord[ll][1]) / 2;
}
for( ii = 0; ii < 8; ii++ )
{
f_hole_coord[ii][0] = -hole * 0.707;
@ -574,15 +612,20 @@ int color;
f_hole_coord[ii][1] += drilly;
}
for ( layer = COPPER_LAYER_N; layer <= CMP_N; layer ++)
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
{
if (layer && (layer == nlmax) ) layer = CMP_N;
if ( (layer == CMP_N) && ! Oncmp ) continue;
if ( (layer == COPPER_LAYER_N) && ! Oncu ) continue;
if ( (layer > COPPER_LAYER_N) && (layer < CMP_N) && !Both) continue;
if( layer && (layer == nlmax) )
layer = CMP_N;
if( (layer == CMP_N) && ! Oncmp )
continue;
if( (layer == COPPER_LAYER_N) && ! Oncu )
continue;
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
continue;
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
if ( color & ITEM_NOT_SHOW ) continue;
if( color & ITEM_NOT_SHOW )
continue;
SetGLColor(color);
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
glBegin(GL_QUAD_STRIP);
@ -595,6 +638,7 @@ int color;
glVertex3f( fcoord[0][0], -fcoord[0][1], zpos );
glEnd();
}
}
break;
default:
@ -602,7 +646,6 @@ int color;
}
}
}
/*************************/
void SetGLColor(int color)
@ -617,6 +660,7 @@ StructColors colordata = ColorRefs[color & MASKCOLOR];
glColor3f(red, green, blue);
}
/********************************************************/
static void Draw3D_FilledCircle(double posx, double posy,
double rayon, double hole, double zpos)
@ -628,16 +672,19 @@ double x, y;
glBegin(GL_QUAD_STRIP);
for( ii = 0; ii <= slice; ii++ )
{
x = hole; y = 0.0;
x = hole;
y = 0.0;
RotatePoint(&x, &y, ii * 225);
glVertex3f( x + posx, y + posy, zpos );
x = rayon; y = 0.0;
x = rayon;
y = 0.0;
RotatePoint(&x, &y, ii * 225);
glVertex3f( x + posx, y + posy, zpos );
}
glEnd();
}
/*********************************************************/
static void Draw3D_FilledCylinder(double posx, double posy,
double rayon, double height, double zpos)
@ -657,7 +704,8 @@ double tmp = DataScale3D;
for( ii = 0; ii <= NB_SEGM; ii++ )
{
x = rayon; y = 0.0;
x = rayon;
y = 0.0;
RotatePoint(&x, &y, ii * (3600 / NB_SEGM));
coords[2].x = coords[3].x = posx + x;
coords[2].y = coords[3].y = posy + y;
@ -671,6 +719,7 @@ double tmp = DataScale3D;
DataScale3D = tmp;
}
/*****************************************************************/
static void Draw3D_FilledSegment(double startx, double starty,
double endx, double endy,double width, double zpos)
@ -681,11 +730,12 @@ static void Draw3D_FilledSegment(double startx, double starty,
double dx, dy, x, y, firstx=0, firsty=0;
int ii, angle;
/* on va calculer les coordonnées du segment supposé horizontal,
puis tourner les cordonnes de l'angle voulu */
// on va calculer les coordonnées du segment supposé horizontal,
// puis tourner les cordonnes de l'angle voulu
dx = endx - startx; dy = endy - starty;
angle = (int)(( atan2( dy, dx ) / M_PI * 1800)+0.5) ;
dx = endx - startx;
dy = endy - starty;
angle = (int)( ( atan2(dy, dx) * 1800 / M_PI ) + 0.5 );
RotatePoint(&dx, &dy, angle); // apres rotation: dx = longueur du segment
// dy = 0;
@ -695,7 +745,8 @@ int ii, angle;
// tracé de l'arrondi a droite (1er demi polygone a la fin du segment)
for( ii = 0; ii <= 8; ii++ )
{
x = 0.0; y =-width;
x = 0.0;
y = -width;
RotatePoint(&x, &y, -ii * 225);
x += dx;
RotatePoint(&x, &y, -angle);
@ -710,7 +761,8 @@ int ii, angle;
for( ii = 0; ii <= 8; ii++ )
{
int jj = ii * 225;
x = 0.0; y = width;
x = 0.0;
y = width;
RotatePoint(&x, &y, -angle - jj);
glVertex3f( startx + x, starty+y, zpos );
}
@ -719,6 +771,7 @@ int ii, angle;
glEnd();
}
/*****************************************************************/
static void Draw3D_FilledSegmentWithHole(double startx, double starty,
double endx, double endy, double width,
@ -731,13 +784,15 @@ double x, y, xin, yin;
double firstx = 0, firsty = 0, firstxin = 0, firstyin = 0;
int ii, angle, theta;
/* on va calculer les coordonnées du segment supposé horizontal,
puis tourner les cordonnes de l'angle voulu
Tous des calculs se font avec startx, starty comme origine du tracé */
// on va calculer les coordonnées du segment supposé horizontal,
// puis tourner les cordonnes de l'angle voulu
// Tous des calculs se font avec startx, starty comme origine du tracé
endx -= startx; endy -= starty;
holex -= startx; holey -= starty;
angle = (int)(( atan2( endy, endx ) / M_PI * 1800)+0.5) ;
endx -= startx;
endy -= starty;
holex -= startx;
holey -= starty;
angle = (int)( ( atan2(endy, endx) * 1800 / M_PI ) + 0.5 );
RotatePoint(&endx, &endy, angle); // apres rotation: endx = longueur du segment
// endy = 0;
@ -749,8 +804,10 @@ int ii, angle, theta;
// autour du demi-trou de percage
for( ii = 0; ii <= 8; ii++ )
{
x = 0.0; y = -width;
xin = 0.0; yin = - holeradius;
x = 0.0;
y = -width;
xin = 0.0;
yin = -holeradius;
theta = -ii * 225;
RotatePoint(&x, &y, theta);
RotatePoint(&xin, &yin, theta);
@ -772,9 +829,11 @@ int ii, angle, theta;
for( ii = 0; ii <= 8; ii++ )
{
theta = -ii * 225;
x = 0.0; y = width;
x = 0.0;
y = width;
RotatePoint(&x, &y, -angle + theta);
xin = 0.0; yin = holeradius;
xin = 0.0;
yin = holeradius;
RotatePoint(&xin, &yin, theta);
xin += holex;
RotatePoint(&xin, &yin, -angle);
@ -786,4 +845,3 @@ int ii, angle, theta;
glVertex3f( firstx, firsty, zpos );
glEnd();
}

View File

@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Nov-01 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ pcbnew
* Provided new definitions of FIRST_COPPER_LAYER and LAST_COPPER_LAYER within
include/pcbstruct.h, and used those definitions within various other files.
Beautified and generally refined 3d-viewer/3d_draw.cpp and pcbnew/plotgerb.cpp.
2007-Oct-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+kicad:
@ -401,8 +409,8 @@ email address.
field. (Refer to 2007-Oct-2 UPDATE notes for the relevance of this.)
* Beautification and house keeping.
+ eeschema
* The editpart.cpp and editpart.cpp files (which are no longer used) have been
removed, and replaced with editpart.cpp.notused and editpart.cpp.notused
* The editpart.cpp and libedpart.cpp files (which are no longer used) have been
removed, and replaced with editpart.cpp.notused and libedpart.cpp.notused
+ cvpcb
* Additional "OK", "Cancel", and "Apply" buttons have now been provided for the
"Options" dialog box which lists various display options for footprints.

View File

@ -153,7 +153,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* aFile,
if( pcb_layer_number < 0 )
continue;
if( pcb_layer_number > CMP_N )
if( pcb_layer_number > LAST_COPPER_LAYER )
{
DRAWSEGMENT* drawitem = new DRAWSEGMENT( pcb, TYPEDRAWSEGMENT );

View File

@ -266,7 +266,7 @@ bool AsCmpLayer = false;
AsCmpLayer = true;
else
{
if( LayerLookUpTable[ii] >= CMP_N )
if( LayerLookUpTable[ii] >= LAST_COPPER_LAYER )
continue; // not a copper layer
if( LayerLookUpTable[ii] >= g_DesignSettings.m_CopperLayerCount )
g_DesignSettings.m_CopperLayerCount++;
@ -275,8 +275,8 @@ bool AsCmpLayer = false;
if( AsCmpLayer )
g_DesignSettings.m_CopperLayerCount++;
if( g_DesignSettings.m_CopperLayerCount > CMP_N + 1 ) // should not occur.
g_DesignSettings.m_CopperLayerCount = CMP_N + 1;
if( g_DesignSettings.m_CopperLayerCount > NB_COPPER_LAYERS ) // should not occur.
g_DesignSettings.m_CopperLayerCount = NB_COPPER_LAYERS;
EndModal( 1 );
}

View File

@ -35,6 +35,7 @@
/* Layer identification (layer number) */
#define FIRST_COPPER_LAYER 0
#define COPPER_LAYER_N 0
#define LAYER_N_2 1 /* Numero layer 2 */
#define LAYER_N_3 2 /* Numero layer 3 */
@ -52,7 +53,8 @@
#define LAYER_N_15 14 /* Numero layer 15 */
#define LAYER_CMP_N 15
#define CMP_N 15
#define NB_COPPER_LAYERS (CMP_N + 1)
#define LAST_COPPER_LAYER 15
#define NB_COPPER_LAYERS (LAST_COPPER_LAYER + 1)
#define FIRST_NO_COPPER_LAYER 16
#define ADHESIVE_N_CU 16

View File

@ -181,7 +181,7 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
// Copper layers cannot be selected unconditionally; how many
// of those layers are currently enabled needs to be checked.
if( (layer >= COPPER_LAYER_N) && (layer <= CMP_N) )
if( (layer >= FIRST_COPPER_LAYER) && (layer <= LAST_COPPER_LAYER) )
{
// If only one copper layer is enabled, the only such layer
// that can be selected to is the "Copper" layer (so the

View File

@ -173,7 +173,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
GRSetDrawMode( DC, draw_mode );
typeaff = frame->m_DisplayModEdge;
if( m_Layer <= CMP_N )
if( m_Layer <= LAST_COPPER_LAYER )
{
typeaff = frame->m_DisplayPcbTrackFill;
if( !typeaff )

View File

@ -99,8 +99,8 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum )
{
sscanf( Line + 2, " %d %d %lX %d\n", &m_Layer, &m_Miroir,
&m_TimeStamp, &dummy );
if( m_Layer < COPPER_LAYER_N )
m_Layer = COPPER_LAYER_N;
if( m_Layer < FIRST_COPPER_LAYER )
m_Layer = FIRST_COPPER_LAYER;
if( m_Layer > LAST_NO_COPPER_LAYER )
m_Layer = LAST_NO_COPPER_LAYER;

View File

@ -268,7 +268,7 @@ int TRACK::ReturnMaskLayer()
if( via_type == VIA_THROUGH )
return ALL_CU_LAYERS;
// VIA_BLIND ou VIA_BURIED:
// VIA_BLIND or VIA_BURIED:
int bottom_layer, top_layer;
@ -720,7 +720,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
}
/* Shows clearance (for tracks and vias, not for zone segments */
if( DisplayOpt.DisplayTrackIsol && ( m_Layer <= CMP_N )
if( DisplayOpt.DisplayTrackIsol && ( m_Layer <= LAST_COPPER_LAYER )
&& ( Type() == TYPETRACK || Type() == TYPEVIA) )
{
GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,

View File

@ -136,12 +136,12 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame*
wxDefaultPosition, wxDefaultSize );
LeftBoxSizer->Add( m_SelLayerBox, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
int ii;
for( ii = CMP_N + 1; ii < NB_LAYERS; ii++ )
for( ii = FIRST_NO_COPPER_LAYER; ii < NB_LAYERS; ii++ )
{
m_SelLayerBox->Append( ReturnPcbLayerName( ii ) );
}
m_SelLayerBox->SetSelection( Cotation->GetLayer() - (CMP_N + 1) );
m_SelLayerBox->SetSelection( Cotation->GetLayer() - FIRST_NO_COPPER_LAYER );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
@ -175,8 +175,8 @@ void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event )
m_TxtWidthCtrl->GetValue();
CurrentCotation->m_Text->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0;
CurrentCotation->SetLayer( m_SelLayerBox->GetChoice() + CMP_N + 1 );
CurrentCotation->m_Text->SetLayer( m_SelLayerBox->GetChoice() + CMP_N + 1 );
CurrentCotation->SetLayer( m_SelLayerBox->GetChoice() + FIRST_NO_COPPER_LAYER );
CurrentCotation->m_Text->SetLayer( m_SelLayerBox->GetChoice() + FIRST_NO_COPPER_LAYER );
CurrentCotation->m_Text->CreateDrawData();

View File

@ -194,11 +194,11 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC )
/* Ask for the new layer */
new_layer = SelectLayer( new_layer, COPPER_LAYER_N, LAST_NO_COPPER_LAYER );
new_layer = SelectLayer( new_layer, FIRST_COPPER_LAYER, LAST_NO_COPPER_LAYER );
if( new_layer < 0 )
return;
if ( new_layer >= COPPER_LAYER_N && new_layer <= LAYER_CMP_N )
if ( new_layer >= FIRST_COPPER_LAYER && new_layer <= LAST_COPPER_LAYER )
/* an edge is put on a copper layer, and it is very dangerous. a confirmation is requested */
{
if ( ! IsOK(this, _("The graphic item will be on a copper layer.It is very dangerous. Are you sure") ) )

View File

@ -632,7 +632,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_SELECT_CU_LAYER:
itmp = SelectLayer( GetScreen()->m_Active_Layer, -1, CMP_N );
itmp = SelectLayer( GetScreen()->m_Active_Layer, -1, LAST_COPPER_LAYER );
if( itmp >= 0 )
GetScreen()->m_Active_Layer = itmp;
break;
@ -1005,7 +1005,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
// Copper layers cannot be selected unconditionally; how many
// of those layers are currently enabled needs to be checked.
if( (layer >= COPPER_LAYER_N) && (layer <= CMP_N) )
if( (layer >= FIRST_COPPER_LAYER) && (layer <= LAST_COPPER_LAYER) )
{
// If only one copper layer is enabled, the only such layer
// that can be selected to is the "Copper" layer (so the

View File

@ -162,7 +162,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
COTATION* Cotation;
int layer = Segment->GetLayer();
if( layer <= CMP_N )
if( layer <= LAST_COPPER_LAYER )
{
DisplayError( this, _( "Copper layer global delete not allowed!" ), 20 );
return;

View File

@ -202,12 +202,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_SWITCH_LAYER_TO_PREVIOUS:
ll = GetScreen()->m_Active_Layer;
if( (ll <= COPPER_LAYER_N) || (ll > CMP_N) )
if( (ll <= FIRST_COPPER_LAYER) || (ll > LAST_COPPER_LAYER) )
break;
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer
ll = COPPER_LAYER_N;
else if( ll == CMP_N )
ll = MAX( COPPER_LAYER_N, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 );
else if( ll == LAST_COPPER_LAYER )
ll = MAX( FIRST_COPPER_LAYER, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 );
else
ll--;
SwitchLayer( DC, ll );
@ -215,12 +215,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_SWITCH_LAYER_TO_NEXT:
ll = GetScreen()->m_Active_Layer;
if( (ll < COPPER_LAYER_N) || (ll >= CMP_N) )
if( (ll < FIRST_COPPER_LAYER) || (ll >= LAST_COPPER_LAYER) )
break;
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer
ll = COPPER_LAYER_N;
else if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 )
ll = CMP_N;
ll = LAST_COPPER_LAYER;
else
ll++;
SwitchLayer( DC, ll );
@ -299,7 +299,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break;
case HK_BACK_SPACE:
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= CMP_N )
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= LAST_COPPER_LAYER )
{
if( ItemFree )
{
@ -570,7 +570,7 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
switch( m_ID_current_state )
{
case ID_TRACK_BUTT:
if( GetScreen()->m_Active_Layer > CMP_N )
if( GetScreen()->m_Active_Layer > LAST_COPPER_LAYER )
return FALSE;
if( ItemFree )
{

View File

@ -163,9 +163,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( m_ID_current_state == ID_PCB_ARC_BUTT )
shape = S_ARC;
if( GetScreen()->m_Active_Layer <= CMP_N )
if( GetScreen()->m_Active_Layer <= LAST_COPPER_LAYER )
{
DisplayError( this, _( "Graphic not autorized on Copper layers" ) );
DisplayError( this, _( "Graphic not authorized on Copper layers" ) );
break;
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
@ -186,7 +186,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
case ID_TRACK_BUTT:
if( GetScreen()->m_Active_Layer > CMP_N )
if( GetScreen()->m_Active_Layer > LAST_COPPER_LAYER )
{
DisplayError( this, _( "Tracks on Copper layers only " ) );
break;
@ -262,9 +262,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_PCB_COTATION_BUTT:
if( GetScreen()->m_Active_Layer <= CMP_N )
if( GetScreen()->m_Active_Layer <= LAST_COPPER_LAYER )
{
DisplayError( this, _( "Cotation not autorized on Copper layers" ) );
DisplayError( this, _( "Cotation not authorized on Copper layers" ) );
break;
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
@ -426,4 +426,3 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break;
}
}

View File

@ -16,12 +16,12 @@
/* Variables locales : */
static int s_Last_D_code;
static float Gerb_scale_plot; /*Coeff de conversion d'unites des traces */
static int scale_spot_mini; /* Ouverture mini (pour remplissages) */
static D_CODE * s_DCodeList; /* Pointeur sur la zone de stockage des D_CODES */
static float Gerb_scale_plot; // Coeff de conversion d'unites des traces
static int scale_spot_mini; // Ouverture mini (pour remplissages)
static D_CODE * s_DCodeList; // Pointeur sur la zone de stockage des D_CODES
wxString GerberFullFileName;
static double scale_x , scale_y ; /* echelles de convertion en X et Y (compte tenu
des unites relatives du PCB et des traceurs*/
static double scale_x, scale_y; // echelles de convertion en X et Y (compte tenu
// des unites relatives du PCB et des traceurs
static bool ShowDcodeError = TRUE;
/* Routines Locales */
@ -42,8 +42,9 @@ static void trace_1_pad_TRAPEZE_GERBER(wxPoint pos, wxSize size,wxSize delta,
void WinEDA_BasePcbFrame::Genere_GERBER(const wxString & FullFileName, int Layer,
bool PlotOriginIsAuxAxis)
/********************************************************************************/
/* Genere les divers fichiers de trace:
Pour chaque couche 1 fichier xxxc.PHO au format RS274X
* Pour chaque couche 1 fichier xxxc.PHO au format RS274X
*/
{
int tracevia = 1;
@ -52,25 +53,25 @@ int tracevia = 1;
GerberFullFileName = FullFileName;
g_PlotOrient = 0;
if (Plot_Set_MIROIR) g_PlotOrient |= PLOT_MIROIR;
if( Plot_Set_MIROIR )
g_PlotOrient |= PLOT_MIROIR;
/* Calcul des echelles de conversion */
Gerb_scale_plot = 1.0; /* pour unites gerber en 0,1 Mils, format 3.4 */
scale_spot_mini = (int)(spot_mini * 10 * Gerb_scale_plot);
scale_spot_mini = (int)(10 * spot_mini * Gerb_scale_plot);
scale_x = Scale_X * Gerb_scale_plot;
scale_y = Scale_Y * Gerb_scale_plot;
g_PlotOffset.x = 0;
g_PlotOffset.y = 0;
if( PlotOriginIsAuxAxis )
{
g_PlotOffset = m_Auxiliary_Axis_Position;
}
dest = wxFopen( FullFileName, wxT("wt") );
if( dest == NULL )
{
wxString msg = _("unable to create file ") + FullFileName;
DisplayError(this, msg); return ;
DisplayError(this, msg);
return;
}
setlocale(LC_NUMERIC, "C");
@ -94,7 +95,7 @@ int tracevia = 1;
switch( Layer )
{
case COPPER_LAYER_N :
case FIRST_COPPER_LAYER:
case LAYER_N_2:
case LAYER_N_3:
case LAYER_N_4:
@ -109,14 +110,16 @@ int tracevia = 1;
case LAYER_N_13:
case LAYER_N_14:
case LAYER_N_15:
case CMP_N :
case LAST_COPPER_LAYER:
Plot_Layer_GERBER(dest, layer_mask, 0, 1);
break;
case SOLDERMASK_N_CU:
case SOLDERMASK_N_CMP: /* Trace du vernis epargne */
if ( g_DrawViaOnMaskLayer ) tracevia = 1;
else tracevia = 0;
if( g_DrawViaOnMaskLayer )
tracevia = 1;
else
tracevia = 0;
Plot_Layer_GERBER(dest, layer_mask, g_DesignSettings.m_MaskMargin, tracevia);
break;
@ -139,6 +142,7 @@ int tracevia = 1;
void WinEDA_BasePcbFrame::Plot_Layer_GERBER(FILE * File,int masque_layer,
int garde, int tracevia)
/***********************************************************************/
/* Trace en format GERBER. d'une couche cuivre ou masque
*/
{
@ -150,7 +154,7 @@ TRACK * track ;
EDA_BaseStruct * PtStruct;
wxString msg;
// (Following command has been superceded by new command on lines 92 and 93.)
// (Following command has been superceded by new command on lines 93 and 94.)
// masque_layer |= EDGE_LAYER; /* Les elements de la couche EDGE sont tj traces */
/* trace des elements type Drawings Pcb : */
@ -204,7 +208,8 @@ wxString msg;
Plot_1_EdgeModule(PLOT_FORMAT_GERBER, (EDGE_MODULE*) PtStruct);
break;
default: break;
default:
break;
}
}
}
@ -224,11 +229,12 @@ wxString msg;
shape_pos = PtPad->ReturnShapePos();
pos = shape_pos;
size.x = PtPad->m_Size.x + (garde * 2) ;
size.y = PtPad->m_Size.y + (garde * 2) ;
size.x = PtPad->m_Size.x + 2 * garde;
size.y = PtPad->m_Size.y + 2 * garde;
/* Don't draw a null size item : */
if ( (size.x == 0) || (size.y == 0) ) continue;
if( size.x <= 0 || size.y <= 0 )
continue;
nb_items++;
@ -239,18 +245,20 @@ wxString msg;
break;
case OVALE:
{
// Check whether the pad really has a circular shape instead
if( size.x == size.y )
Plot_1_CIRCLE_pad_GERBER(pos, size.x);
else
trace_1_pastille_OVALE_GERBER(pos, size, PtPad->m_Orient);
break;
}
case TRAPEZE:
{
wxSize delta = PtPad->m_DeltaSize;
trace_1_pad_TRAPEZE_GERBER(pos, size,
delta, PtPad->m_Orient, FILLED);
break ;
}
break;
case RECT:
default:
@ -268,21 +276,28 @@ wxString msg;
Affiche_1_Parametre(this, 56, wxT("Vias"), wxEmptyString, RED);
for( track = m_Pcb->m_Track; track != NULL; track = (TRACK*) track->Pnext )
{
if( track->Type() != TYPEVIA ) continue;
if( track->Type() != TYPEVIA )
continue;
SEGVIA * Via = (SEGVIA *) track;
/* vias not plotted if not on selected layer, but if layer
== SOLDERMASK_LAYER_CU or SOLDERMASK_LAYER_CMP, vias are drawn ,
if they are on a external copper layer
*/
// vias not plotted if not on selected layer, but if layer
// == SOLDERMASK_LAYER_CU or SOLDERMASK_LAYER_CMP, vias are drawn,
// if they are on a external copper layer
int via_mask_layer = Via->ReturnMaskLayer();
if ( (via_mask_layer & CUIVRE_LAYER ) ) via_mask_layer |= SOLDERMASK_LAYER_CU;
if ( (via_mask_layer & CMP_LAYER ) ) via_mask_layer |= SOLDERMASK_LAYER_CMP;
if( (via_mask_layer & masque_layer) == 0 ) continue;
if( via_mask_layer & CUIVRE_LAYER )
via_mask_layer |= SOLDERMASK_LAYER_CU;
if( via_mask_layer & CMP_LAYER )
via_mask_layer |= SOLDERMASK_LAYER_CMP;
if( ( via_mask_layer & masque_layer) == 0 )
continue;
pos = Via->m_Start;
size.x = size.y = Via->m_Width + (garde * 2);
size.x = size.y = Via->m_Width + 2 * garde;
/* Don't draw a null size item : */
if( size.x <= 0 )
continue;
Plot_1_CIRCLE_pad_GERBER(pos, size.x);
nb_items++ ; msg.Printf( wxT("%d"),nb_items) ;
nb_items++;
msg.Printf( wxT("%d"), nb_items );
Affiche_1_Parametre(this, 56, wxEmptyString, msg, RED);
}
}
@ -294,34 +309,42 @@ wxString msg;
{
wxPoint end;
if ( track->Type() == TYPEVIA ) continue ;
if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 ) continue;
if( track->Type() == TYPEVIA )
continue;
if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 )
continue;
size.x = size.y = track->m_Width;
pos = track->m_Start; end = track->m_End;
pos = track->m_Start;
end = track->m_End;
PlotGERBERLine(pos, end, size.x);
nb_items++ ; msg.Printf( wxT("%d"),nb_items) ;
nb_items++;
msg.Printf( wxT("%d"), nb_items );
Affiche_1_Parametre(this, 64, wxEmptyString, msg, YELLOW);
}
/* trace des zones: */
nb_items = 0;
if ( m_Pcb->m_Zone ) Affiche_1_Parametre(this, 72, wxT("Zones "),wxEmptyString,YELLOW) ;
if( m_Pcb->m_Zone )
Affiche_1_Parametre(this, 72, wxT("Zones "), wxEmptyString, YELLOW);
for( track = m_Pcb->m_Zone; track != NULL; track = (TRACK*) track->Pnext )
{
wxPoint end;
if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 ) continue;
if( (g_TabOneLayerMask[track->GetLayer()] & masque_layer) == 0 )
continue;
size.x = size.y = track->m_Width;
pos = track->m_Start; end = track->m_End;
pos = track->m_Start;
end = track->m_End;
PlotGERBERLine(pos, end, size.x);
nb_items++ ; msg.Printf( wxT("%d"),nb_items) ;
nb_items++;
msg.Printf( wxT("%d"), nb_items );
Affiche_1_Parametre(this, 72, wxEmptyString, msg, YELLOW);
}
}
@ -330,24 +353,22 @@ wxString msg;
/**********************************************************************/
void trace_1_pastille_OVALE_GERBER(wxPoint pos, wxSize size, int orient)
/**********************************************************************/
/* Trace 1 pastille OVALE en position pos_X,Y:
dimensions dx,dy,
orientation orient
Pour une orientation verticale ou horizontale, la forme est flashee
Pour une orientation quelconque la forme est tracee comme un segment
* dimensions dx, dy,
* orientation orient
* Pour une orientation verticale ou horizontale, la forme est flashee
* Pour une orientation quelconque la forme est tracee comme un segment
*/
{
D_CODE * dcode_ptr;
int x0, y0, x1, y1, delta;
if( (orient == 900) || (orient == 2700)) /* orient tournee de 90 deg */
{
if( orient == 900 || orient == 2700 ) /* orient tournee de 90 deg */
EXCHG(size.x, size.y);
}
/* Trace de la forme flashee */
if( (orient == 0) || (orient == 900) ||
(orient == 1800) || (orient == 2700) )
if( orient == 0 || orient == 900 || orient == 1800 || orient == 2700 )
{
UserToDeviceCoordinate(pos);
UserToDeviceSize(size);
@ -367,12 +388,18 @@ int x0, y0, x1, y1, delta;
{
if( size.x > size.y )
{
EXCHG(size.x,size.y); orient += 900;
EXCHG(size.x, size.y);
if( orient < 2700 )
orient += 900;
else
orient -= 2700;
}
/* la pastille est ramenee a une pastille ovale avec dy > dx */
delta = size.y - size.x;
x0 = 0; y0 = -delta / 2;
x1 = 0; y1 = delta / 2;
x0 = 0;
y0 = -delta / 2;
x1 = 0;
y1 = delta / 2;
RotatePoint(&x0, &y0, orient);
RotatePoint(&x1, &y1, orient);
PlotGERBERLine( wxPoint(pos.x + x0, pos.y + y0),
@ -384,7 +411,8 @@ int x0, y0, x1, y1, delta;
/******************************************************************/
void Plot_1_CIRCLE_pad_GERBER(wxPoint pos,int diametre)
/******************************************************************/
/* Plot a circulat pad or via at the user position pos
/* Plot a circular pad or via at the user position pos
*/
{
D_CODE * dcode_ptr;
@ -405,15 +433,16 @@ wxSize size(diametre, diametre);
fputs(cbuf, dest);
}
/**************************************************************************/
void PlotRectangularPad_GERBER(wxPoint pos, wxSize size, int orient)
/**************************************************************************/
/*
Trace 1 pad rectangulaire d'orientation quelconque
donne par son centre, ses dimensions, et son orientation
Pour une orientation verticale ou horizontale, la forme est flashee
Pour une orientation quelconque la forme est tracee par 4 segments
de largeur 1/2 largeur pad
/* Trace 1 pad rectangulaire d'orientation quelconque
* donne par son centre, ses dimensions, et son orientation
* Pour une orientation verticale ou horizontale, la forme est flashee
* Pour une orientation quelconque la forme est tracee par 4 segments
* de largeur 1/2 largeur pad
*/
{
D_CODE * dcode_ptr;
@ -424,8 +453,10 @@ D_CODE * dcode_ptr;
case 900:
case 2700: /* la rotation de 90 ou 270 degres revient a permutter des dimensions */
EXCHG(size.x, size.y);
case 1800 :
// Pass through
case 0:
case 1800:
UserToDeviceCoordinate(pos);
UserToDeviceSize(size);
@ -451,20 +482,22 @@ D_CODE * dcode_ptr;
void trace_1_contour_GERBER(wxPoint pos, wxSize size, wxSize delta,
int penwidth, int orient)
/*****************************************************************/
/*
Trace 1 contour rectangulaire ou trapezoidal d'orientation quelconque
donne par son centre,
ses dimensions ,
ses variations ,
l'epaisseur du trait,
et son orientation orient
/* Trace 1 contour rectangulaire ou trapezoidal d'orientation quelconque
* donne par son centre,
* ses dimensions ,
* ses variations ,
* l'epaisseur du trait,
* et son orientation orient
*/
{
int ii;
wxPoint coord[4];
size.x /= 2; size.y /= 2 ;
delta.x /= 2; delta.y /= 2 ; /* demi dim dx et dy */
size.x /= 2;
size.y /= 2;
delta.x /= 2;
delta.y /= 2; /* demi dim dx et dy */
coord[0].x = pos.x - size.x - delta.y;
coord[0].y = pos.y + size.y + delta.x;
@ -483,7 +516,6 @@ wxPoint coord[4];
RotatePoint(&coord[ii].x, &coord[ii].y, pos.x, pos.y, orient);
}
PlotGERBERLine( coord[0], coord[1], penwidth );
PlotGERBERLine( coord[1], coord[2], penwidth );
PlotGERBERLine( coord[2], coord[3], penwidth );
@ -496,46 +528,45 @@ void trace_1_pad_TRAPEZE_GERBER(wxPoint pos, wxSize size,wxSize delta,
int orient,int modetrace)
/*******************************************************************/
/*
Trace 1 pad trapezoidal donne par :
son centre pos.x,pos.y
ses dimensions size.x et size.y
les variations delta.x et delta.y ( 1 des deux au moins doit etre nulle)
son orientation orient en 0.1 degres
le mode de trace (FILLED, SKETCH, FILAIRE)
Le trace n'est fait que pour un trapeze, c.a.d que delta.x ou delta.y
= 0.
les notation des sommets sont ( vis a vis de la table tracante )
" 0 ------------- 3 "
" . . "
" . O . "
" . . "
" 1 ---- 2 "
exemple de Disposition pour delta.y > 0, delta.x = 0
" 1 ---- 2 "
" . . "
" . O . "
" . . "
" 0 ------------- 3 "
exemple de Disposition pour delta.y = 0, delta.x > 0
" 0 "
" . . "
" . . "
" . 3 "
" . . "
" . O . "
" . . "
" . 2 "
" . . "
" . . "
" 1 "
/* Trace 1 pad trapezoidal donne par :
* son centre pos.x,pos.y
* ses dimensions size.x et size.y
* les variations delta.x et delta.y ( 1 des deux au moins doit etre nulle)
* son orientation orient en 0.1 degres
* le mode de trace (FILLED, SKETCH, FILAIRE)
*
* Le trace n'est fait que pour un trapeze, c.a.d que delta.x ou delta.y
* = 0.
*
* les notation des sommets sont ( vis a vis de la table tracante )
*
* " 0 ------------- 3 "
* " . . "
* " . O . "
* " . . "
* " 1 ---- 2 "
*
*
* exemple de Disposition pour delta.y > 0, delta.x = 0
* " 1 ---- 2 "
* " . . "
* " . O . "
* " . . "
* " 0 ------------- 3 "
*
*
* exemple de Disposition pour delta.y = 0, delta.x > 0
* " 0 "
* " . . "
* " . . "
* " . 3 "
* " . . "
* " . O . "
* " . . "
* " . 2 "
* " . . "
* " . . "
* " 1 "
*/
{
int ii, jj;
@ -548,13 +579,19 @@ int ddx, ddy ;
dx = size.x - abs(delta.y);
dy = size.y - abs(delta.x);
dx = size.x / 2; dy = size.y / 2 ;
ddx = delta.x / 2; ddy = delta.y / 2 ;
dx = size.x / 2;
dy = size.y / 2;
ddx = delta.x / 2;
ddy = delta.y / 2;
polygone[0].x = - dx - ddy; polygone[0].y = + dy + ddx;
polygone[1].x = - dx + ddy; polygone[1].y = - dy - ddx;
polygone[2].x = + dx - ddy; polygone[2].y = - dy + ddx;
polygone[3].x = + dx + ddy; polygone[3].y = + dy - ddx;
polygone[0].x = - dx - ddy;
polygone[0].y = + dy + ddx;
polygone[1].x = - dx + ddy;
polygone[1].y = - dy - ddx;
polygone[2].x = + dx - ddy;
polygone[2].y = - dy + ddx;
polygone[3].x = + dx + ddy;
polygone[3].y = + dy - ddx;
/* Dessin du polygone et Remplissage eventuel de l'interieur */
@ -583,6 +620,7 @@ int ddx, ddy ;
/**********************************************************/
void PlotGERBERLine(wxPoint start, wxPoint end, int large)
/**********************************************************/
/* Trace 1 segment de piste :
*/
{
@ -598,13 +636,17 @@ D_CODE * dcode_ptr;
fputs(cbuf, dest);
s_Last_D_code = dcode_ptr->m_NumDcode;
}
sprintf(cbuf,"X%5.5dY%5.5dD02*\n",start.x,start.y) ; fputs(cbuf,dest) ;
sprintf(cbuf,"X%5.5dY%5.5dD01*\n",end.x,end.y) ; fputs(cbuf,dest) ;
sprintf(cbuf, "X%5.5dY%5.5dD02*\n", start.x, start.y);
fputs(cbuf, dest);
sprintf(cbuf, "X%5.5dY%5.5dD01*\n", end.x, end.y);
fputs(cbuf, dest);
}
/********************************************************************/
void PlotCircle_GERBER( wxPoint centre, int rayon, int epaisseur )
/********************************************************************/
/* routine de trace de 1 cercle de centre centre par approximation de segments
*/
{
@ -614,20 +656,26 @@ int delta; /* increment (en 0.1 degres) angulaire pour trace de cercles */
delta = 120; /* un cercle sera trace en 3600/delta segments */
/* Correction pour petits cercles par rapport a l'epaisseur du trait */
if( rayon < (epaisseur * 10) ) delta = 225; /* 16 segm pour 360 deg */
if( rayon < (epaisseur * 5) ) delta = 300; /* 12 segm pour 360 deg */
if( rayon < (epaisseur * 2) ) delta = 600; /* 6 segm pour 360 deg */
if( rayon < (epaisseur * 10) )
delta = 225; /* 16 segm pour 360 deg */
if( rayon < (epaisseur * 5) )
delta = 300; /* 12 segm pour 360 deg */
if( rayon < (epaisseur * 2) )
delta = 600; /* 6 segm pour 360 deg */
ox = centre.x + rayon; oy = centre.y;
ox = centre.x + rayon;
oy = centre.y;
for( ii = delta; ii < 3600; ii += delta )
{
fx = centre.x + (int)(rayon * fcosinus[ii]);
fy = centre.y + (int)(rayon * fsinus[ii]);
PlotGERBERLine(wxPoint(ox, oy), wxPoint(fx, fy), epaisseur);
ox = fx; oy = fy;
ox = fx;
oy = fy;
}
fx = centre.x + rayon; fy = centre.y;
fx = centre.x + rayon;
fy = centre.y;
PlotGERBERLine(wxPoint(ox ,oy), wxPoint(fx, fy), epaisseur);
}
@ -640,14 +688,18 @@ int ii;
wxPoint pos;
fputs("G36*\n", dest);
pos.x = *coord; coord++;
pos.y = *coord; coord++;
pos.x = *coord;
coord++;
pos.y = *coord;
coord++;
UserToDeviceCoordinate(pos);
fprintf( dest, "X%5.5dY%5.5dD02*\n", pos.x, pos.y );
for( ii = 1; ii < nb_segm; ii++ )
{
pos.x = *coord; coord++;
pos.y = *coord; coord++;
pos.x = *coord;
coord++;
pos.y = *coord;
coord++;
UserToDeviceCoordinate(pos);
fprintf( dest, "X%5.5dY%5.5dD01*\n", pos.x, pos.y );
}
@ -659,9 +711,9 @@ wxPoint pos;
/*******************************************************/
D_CODE * get_D_code( int dx, int dy, int type, int drill )
/*******************************************************/
/*
Fonction Recherchant et Creant eventuellement la description
du D_CODE du type et dimensions demandees
/* Fonction Recherchant et Creant eventuellement la description
* du D_CODE du type et dimensions demandees
*/
{
D_CODE * ptr_tool, * last_dcode_ptr;
@ -691,7 +743,8 @@ int num_new_D_code = FIRST_DCODE_VALUE;
ptr_tool->m_Pback = last_dcode_ptr;
last_dcode_ptr->m_Pnext = ptr_tool;
}
else s_DCodeList = ptr_tool;
else
s_DCodeList = ptr_tool;
}
ptr_tool->m_Size.x = dx;
ptr_tool->m_Size.y = dy;
@ -728,9 +781,11 @@ char Line[1024];
/***********************************/
static void Init_ApertureList()
/***********************************/
/* Init the memory to handle the aperture list:
the member .m_Type is used by get_D_code() to handle the end of list:
.m_Type < 0 is the first free aperture descr */
* the member .m_Type is used by get_D_code() to handle the end of list:
* .m_Type < 0 is the first free aperture descr
*/
{
D_CODE * ptr_tool;
@ -743,6 +798,7 @@ D_CODE * ptr_tool;
ShowDcodeError = TRUE;
}
/*****************************************************************/
void Fin_Trace_GERBER(WinEDA_BasePcbFrame * frame, FILE * gerbfile)
/*****************************************************************/
@ -759,10 +815,10 @@ FILE * outfile;
if( gerbfile == NULL )
{
msg.Printf( _("unable to reopen file <%s>"), GerberFullFileName.GetData() );
DisplayError(frame, msg); return ;
DisplayError(frame, msg);
return;
}
// Ouverture tmpfile
TmpFileName = GerberFullFileName + wxT(".$$$");
outfile = wxFopen( TmpFileName, wxT("wt") );
@ -789,16 +845,16 @@ FILE * outfile;
fclose(gerbfile);
wxRemoveFile(GerberFullFileName);
wxRenameFile(TmpFileName, GerberFullFileName);
}
/******************************************************/
int WinEDA_BasePcbFrame::Gen_D_CODE_File(FILE * penfile)
/******************************************************/
/* Genere la liste courante des D_CODES
Retourne le nombre de D_Codes utilises
Genere une sequence RS274X
* Retourne le nombre de D_Codes utilises
* Genere une sequence RS274X
*/
{
D_CODE * ptr_tool;
@ -841,10 +897,9 @@ int nb_dcodes = 0 ;
to_point( text + 2 );
fputs(cbuf, penfile);
ptr_tool = ptr_tool->m_Pnext; nb_dcodes++ ;
ptr_tool = ptr_tool->m_Pnext;
nb_dcodes++;
}
return( nb_dcodes );
}

View File

@ -136,7 +136,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
switch( Layer )
{
case COPPER_LAYER_N:
case FIRST_COPPER_LAYER:
case LAYER_N_2:
case LAYER_N_3:
case LAYER_N_4:
@ -151,7 +151,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
case LAYER_N_13:
case LAYER_N_14:
case LAYER_N_15:
case CMP_N:
case LAST_COPPER_LAYER:
Plot_Layer_HPGL( dest, layer_mask, 0, 1, modetrace );
break;

View File

@ -178,7 +178,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer )
Plot_Layer_PS( dest, layer_mask, 0, 1, modetrace );
break;
case COPPER_LAYER_N:
case FIRST_COPPER_LAYER:
case LAYER_N_2:
case LAYER_N_3:
case LAYER_N_4:
@ -193,7 +193,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer )
case LAYER_N_13:
case LAYER_N_14:
case LAYER_N_15:
case CMP_N:
case LAST_COPPER_LAYER:
Plot_Layer_PS( dest, layer_mask, 0, 1, modetrace );
break;