Loading 3d-viewer/3d_draw.cpp +317 −259 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -67,10 +68,12 @@ void Pcb3D_GLCanvas::Redraw( bool finish ) } glFlush(); if (finish) glFinish(); if( finish ) glFinish(); SwapBuffers(); } /**********************************************/ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() /**********************************************/ Loading Loading @@ -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; Loading @@ -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; Loading Loading @@ -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 */ Loading @@ -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); } Loading @@ -197,6 +209,7 @@ MODULE * Module = (MODULE*) pcb->m_Modules; return gllist; } /************************************************/ void Pcb3D_GLCanvas::Draw3D_Track(TRACK * track) /************************************************/ Loading @@ -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]; Loading @@ -223,6 +237,7 @@ double w; Draw3D_FilledSegment(ox, -oy, fx, -fy, w, zpos); } /********************************************/ void Pcb3D_GLCanvas::Draw3D_Via(SEGVIA * via) /*********************************************/ Loading @@ -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); Loading @@ -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; Loading @@ -298,7 +316,6 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()]; } /*********************************************/ void MODULE::Draw3D(Pcb3D_GLCanvas * glcanvas) /*********************************************/ Loading @@ -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 Loading Loading @@ -367,12 +386,14 @@ bool As3dShape = FALSE; ((EDGE_MODULE *) Struct)->Draw3D(glcanvas); break; default: break; default: break; } } } } /***************************************************/ void EDGE_MODULE::Draw3D(Pcb3D_GLCanvas * glcanvas) /***************************************************/ Loading @@ -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 ); Loading Loading @@ -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 ++) { 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; 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 > 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]; Loading @@ -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; } Loading @@ -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 ++) { 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; 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 > 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); Loading Loading @@ -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; Loading @@ -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); Loading @@ -595,6 +638,7 @@ int color; glVertex3f( fcoord[0][0], -fcoord[0][1], zpos ); glEnd(); } } break; default: Loading @@ -602,7 +646,6 @@ int color; } } } /*************************/ void SetGLColor(int color) Loading @@ -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) Loading @@ -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) Loading @@ -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; Loading @@ -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) Loading @@ -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 coordonnes du segment suppos horizontal, puis tourner les cordonnes de l'angle voulu */ // on va calculer les coordonnes 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; Loading @@ -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); Loading @@ -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 ); } Loading @@ -719,6 +771,7 @@ int ii, angle; glEnd(); } /*****************************************************************/ static void Draw3D_FilledSegmentWithHole(double startx, double starty, double endx, double endy, double width, Loading @@ -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 coordonnes 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 coordonnes 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; Loading @@ -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); Loading @@ -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); Loading @@ -786,4 +845,3 @@ int ii, angle, theta; glVertex3f( firstx, firsty, zpos ); glEnd(); } change_log.txt +10 −2 Original line number Diff line number Diff line Loading @@ -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: Loading Loading @@ -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. Loading gerbview/export_to_pcbnew.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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 ); Loading gerbview/select_layers_to_pcb.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -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++; Loading @@ -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 ); } include/pcbstruct.h +3 −1 Original line number Diff line number Diff line Loading @@ -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 */ Loading @@ -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 Loading Loading
3d-viewer/3d_draw.cpp +317 −259 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -67,10 +68,12 @@ void Pcb3D_GLCanvas::Redraw( bool finish ) } glFlush(); if (finish) glFinish(); if( finish ) glFinish(); SwapBuffers(); } /**********************************************/ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() /**********************************************/ Loading Loading @@ -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; Loading @@ -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; Loading Loading @@ -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 */ Loading @@ -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); } Loading @@ -197,6 +209,7 @@ MODULE * Module = (MODULE*) pcb->m_Modules; return gllist; } /************************************************/ void Pcb3D_GLCanvas::Draw3D_Track(TRACK * track) /************************************************/ Loading @@ -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]; Loading @@ -223,6 +237,7 @@ double w; Draw3D_FilledSegment(ox, -oy, fx, -fy, w, zpos); } /********************************************/ void Pcb3D_GLCanvas::Draw3D_Via(SEGVIA * via) /*********************************************/ Loading @@ -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); Loading @@ -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; Loading @@ -298,7 +316,6 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()]; } /*********************************************/ void MODULE::Draw3D(Pcb3D_GLCanvas * glcanvas) /*********************************************/ Loading @@ -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 Loading Loading @@ -367,12 +386,14 @@ bool As3dShape = FALSE; ((EDGE_MODULE *) Struct)->Draw3D(glcanvas); break; default: break; default: break; } } } } /***************************************************/ void EDGE_MODULE::Draw3D(Pcb3D_GLCanvas * glcanvas) /***************************************************/ Loading @@ -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 ); Loading Loading @@ -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 ++) { 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; 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 > 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]; Loading @@ -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; } Loading @@ -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 ++) { 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; 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 > 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); Loading Loading @@ -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; Loading @@ -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); Loading @@ -595,6 +638,7 @@ int color; glVertex3f( fcoord[0][0], -fcoord[0][1], zpos ); glEnd(); } } break; default: Loading @@ -602,7 +646,6 @@ int color; } } } /*************************/ void SetGLColor(int color) Loading @@ -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) Loading @@ -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) Loading @@ -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; Loading @@ -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) Loading @@ -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 coordonnes du segment suppos horizontal, puis tourner les cordonnes de l'angle voulu */ // on va calculer les coordonnes 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; Loading @@ -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); Loading @@ -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 ); } Loading @@ -719,6 +771,7 @@ int ii, angle; glEnd(); } /*****************************************************************/ static void Draw3D_FilledSegmentWithHole(double startx, double starty, double endx, double endy, double width, Loading @@ -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 coordonnes 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 coordonnes 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; Loading @@ -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); Loading @@ -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); Loading @@ -786,4 +845,3 @@ int ii, angle, theta; glVertex3f( firstx, firsty, zpos ); glEnd(); }
change_log.txt +10 −2 Original line number Diff line number Diff line Loading @@ -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: Loading Loading @@ -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. Loading
gerbview/export_to_pcbnew.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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 ); Loading
gerbview/select_layers_to_pcb.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -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++; Loading @@ -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 ); }
include/pcbstruct.h +3 −1 Original line number Diff line number Diff line Loading @@ -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 */ Loading @@ -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 Loading