From 57c1927121760bdf30e40efc72fc1a41071a98de Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Tue, 5 Feb 2008 02:13:16 +0000 Subject: [PATCH] more amazing free software --- change_log.txt | 8 ++ pcbnew/basepcbframe.cpp | 6 +- pcbnew/class_module.cpp | 148 ---------------------- pcbnew/specctra.cpp | 1 - pcbnew/specctra_export.cpp | 248 ++++++++++--------------------------- 5 files changed, 79 insertions(+), 332 deletions(-) diff --git a/change_log.txt b/change_log.txt index 075b36877d..4029f488c0 100644 --- a/change_log.txt +++ b/change_log.txt @@ -5,6 +5,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2008-Feb-4 UPDATE Dick Hollenbeck +================================================================================ ++pcbnew + specctra_export.cpp now supports blind/buried/microvias. Changed (fixed?) how + modules are displayed on back of board. Needs testing with various angles + of rotation. + + 2008-Feb-3 UPDATE Dick Hollenbeck ================================================================================ +pcbnew diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 939cd7a3ed..8c8545276f 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -263,7 +263,7 @@ void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event ) BOARD_ITEM* item = (*m_Collector)[itemNdx]; DrawPanel->m_AbortRequest = false; -#if defined (DEBUG) && 0 +#if 0 && defined (DEBUG) item->Show( 0, std::cout ); #endif @@ -282,7 +282,7 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem ) { aItem->Display_Infos( this ); -#if defined(DEBUG) +#if 0 && defined(DEBUG) aItem->Show( 0, std::cout ); #endif @@ -294,7 +294,7 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem ) //MsgPanel->EraseMsgBox(); m_Pcb->Display_Infos( this ); // show the BOARD stuff -#if defined(DEBUG) +#if 0 && defined(DEBUG) std::cout << "SetCurItem(NULL)\n"; #endif diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 548baf2695..94f0b7ffab 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -345,154 +345,6 @@ void MODULE::DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC, } -#if 0 -/*************************************/ -int MODULE::WriteDescr( FILE* File ) -/*************************************/ - -/* Sauvegarde de la description d'un MODULE - */ -{ - char StringStat[20]; - TEXTE_MODULE* PtText; - EDGE_MODULE* PtEdge; - D_PAD* ptpad; - EDA_BaseStruct* PtStruct; - int ii, NbLigne = 0; - wxString msg; - - if( GetState( DELETED ) ) - return NbLigne; - - /* Generation du fichier module: */ - fprintf( File, "$MODULE %s\n", CONV_TO_UTF8( m_LibRef ) ); - NbLigne++; - - /* Generation des coord et caracteristiques */ - memset( StringStat, 0, sizeof(StringStat) ); - if( IsLocked() ) - StringStat[0] = 'F'; - else - StringStat[0] = '~'; - - if( m_ModuleStatus & MODULE_is_PLACED ) - StringStat[1] = 'P'; - else - StringStat[1] = '~'; - - fprintf( File, "Po %d %d %d %d %8.8lX %8.8lX %s\n", - m_Pos.x, m_Pos.y, - m_Orient, m_Layer, m_LastEdit_Time, - m_TimeStamp, StringStat ); - NbLigne++; - - fprintf( File, "Li %s\n", CONV_TO_UTF8( m_LibRef ) ); - NbLigne++; - - if( !m_Doc.IsEmpty() ) - { - fprintf( File, "Cd %s\n", CONV_TO_UTF8( m_Doc ) ); - NbLigne++; - } - - if( !m_KeyWord.IsEmpty() ) - { - fprintf( File, "Kw %s\n", CONV_TO_UTF8( m_KeyWord ) ); - NbLigne++; - } - - fprintf( File, "Sc %8.8lX\n", m_TimeStamp ); - NbLigne++; - - fprintf( File, "Op %X %X 0\n", m_CntRot90, m_CntRot180 ); - NbLigne++; - - /* Attributs du module */ - if( m_Attributs != MOD_DEFAULT ) - { - fprintf( File, "At " ); - if( m_Attributs & MOD_CMS ) - fprintf( File, "SMD " ); - if( m_Attributs & MOD_VIRTUAL ) - fprintf( File, "VIRTUAL " ); - fprintf( File, "\n" ); - } - - /* Texte Reference du module */ - fprintf( File, "T%d %d %d %d %d %d %d %c %c %d \"%.16s\"\n", - m_Reference->m_Type, - m_Reference->m_Pos0.x, m_Reference->m_Pos0.y, - m_Reference->m_Size.y, m_Reference->m_Size.x, - m_Reference->m_Orient + m_Orient, m_Reference->m_Width, - m_Reference->m_Miroir ? 'N' : 'M', m_Reference->m_NoShow ? 'I' : 'V', - m_Reference->GetLayer(), - CONV_TO_UTF8( m_Reference->m_Text ) ); - NbLigne++; - - /* Texte Value du module */ - fprintf( File, "T%d %d %d %d %d %d %d %c %c %d \"%.16s\"\n", - m_Value->m_Type, - m_Value->m_Pos0.x, m_Value->m_Pos0.y, - m_Value->m_Size.y, m_Value->m_Size.x, - m_Value->m_Orient + m_Orient, m_Value->m_Width, - m_Value->m_Miroir ? 'N' : 'M', m_Value->m_NoShow ? 'I' : 'V', - m_Value->GetLayer(), - CONV_TO_UTF8( m_Value->m_Text ) ); - NbLigne++; - - /* Generation des elements Drawing modules */ - PtStruct = m_Drawings; - for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) - { - switch( PtStruct->Type() ) - { - case TYPETEXTEMODULE: - PtText = ( (TEXTE_MODULE*) PtStruct ); - fprintf( File, "T%d %d %d %d %d %d %d %c %c %d \"%s\"\n", - PtText->m_Type, - PtText->m_Pos0.x, PtText->m_Pos0.y, - PtText->m_Size.y, PtText->m_Size.x, - PtText->m_Orient + m_Orient, PtText->m_Width, - PtText->m_Miroir ? 'N' : 'M', - PtText->m_NoShow ? 'I' : 'V', - PtText->GetLayer(), CONV_TO_UTF8( PtText->m_Text ) ); - NbLigne++; - break; - - case TYPEEDGEMODULE: - PtEdge = (EDGE_MODULE*) PtStruct; - PtEdge->WriteDescr( File ); - break; - - default: - msg.Printf( wxT( "Type (%d) Draw Module inconnu" ), - PtStruct->Type() ); - DisplayError( NULL, msg ); - break; - } - - /* Fin switch gestion des Items draw */ - } - - /* Generation de la liste des pads */ - ptpad = m_Pads; - for( ; ptpad != NULL; ptpad = (D_PAD*) ptpad->Pnext ) - { - ii = ptpad->WriteDescr( File ); - NbLigne += ii; - } - - /* Generation des informations de trac�3D */ - Write_3D_Descr( File ); - - /* Fin de description: */ - fprintf( File, "$EndMODULE %s\n", CONV_TO_UTF8( m_LibRef ) ); - NbLigne++; - return NbLigne; -} -#endif - - bool MODULE::Save( FILE* aFile ) const { char statusTxt[8]; diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index 24afd7c96a..d1f8009023 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -3480,7 +3480,6 @@ PCB* SPECCTRA_DB::MakePCB() pcb->structure->rules = new RULE( pcb->structure, T_rule ); pcb->placement = new PLACEMENT( pcb ); - //pcb->placement->flip_style = T_mirror_first; pcb->library = new LIBRARY( pcb ); diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index dabafc6bb3..87399b056f 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -282,26 +282,6 @@ static int Pad_list_Sort_by_Shapes( const void* refptr, const void* objptr ) } - -/* -static int Track_list_Sort_by_Netcode( const void* o1, const void* o2 ) -{ - TRACK* t1 = *(TRACK**) o1; - TRACK* t2 = *(TRACK**) o2; - int diff; - - if( (diff = t1->GetNet() - t2->GetNet()) ) - return diff; - if( (diff = t1->m_Width - t2->m_Width) ) - return diff; - if( (diff = t1->GetLayer() - t2->GetLayer()) ) - return diff; - - return diff; // zero here -} -*/ - - /** * Function makePath * creates a PATH element with a single straight line, a pair of vertices. @@ -317,21 +297,6 @@ static PATH* makePath( const POINT& aStart, const POINT& aEnd, const std::string } -/* -static QARC* makeArc( const POINT& aStart, const POINT& aEnd, - const POINT& aCenter, const std::string& aLayerName ) -{ - QARC* qarc = new QARC(0); - - qarc->SetStart( aStart ); - qarc->SetEnd( aEnd ); - qarc->SetCenter( aCenter ); - qarc->SetLayerId( aLayerName.c_str() ); - return qarc; -} -*/ - - IMAGE* SPECCTRA_DB::makeIMAGE( MODULE* aModule ) { PADSTACKS& padstacks = pcb->library->padstacks; @@ -391,25 +356,61 @@ IMAGE* SPECCTRA_DB::makeIMAGE( MODULE* aModule ) PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia ) { + CIRCLE* circle; + SHAPE* shape; + double dsnDiameter; char name[48]; + PADSTACK* padstack = new PADSTACK( pcb->library ); - SHAPE* shape = new SHAPE( padstack ); - padstack->Append( shape ); + switch( aVia->Shape() ) + { + case VIA_THROUGH: + shape = new SHAPE( padstack ); + padstack->Append( shape ); - // @todo: handle the aVia->Shape() differently for each type of via: MICROVIA, etc. + circle = new CIRCLE( shape ); + shape->SetShape( circle ); - CIRCLE* circle = new CIRCLE( shape ); - shape->SetShape( circle ); - - double dsnDiameter = scale( aVia->m_Width ); - circle->SetDiameter( dsnDiameter ); - - circle->SetLayerId( "signal" ); + dsnDiameter = scale( aVia->m_Width ); + circle->SetDiameter( dsnDiameter ); - snprintf( name, sizeof(name), "Via_%.6g_mil", dsnDiameter ); - name[ sizeof(name)-1 ] = 0; - padstack->SetPadstackId( name ); + circle->SetLayerId( "signal" ); + + snprintf( name, sizeof(name), "Via_%.6g_mil", dsnDiameter ); + name[ sizeof(name)-1 ] = 0; + padstack->SetPadstackId( name ); + break; + + case VIA_BLIND_BURIED: + case VIA_MICROVIA: + int topLayer; + int botLayer; + aVia->ReturnLayerPair( &topLayer, &botLayer ); + topLayer = kicadLayer2pcb[topLayer]; + botLayer = kicadLayer2pcb[botLayer]; + if( topLayer > botLayer ) + EXCHG( topLayer, botLayer ); + + dsnDiameter = scale( aVia->m_Width ); + + for( int layer=topLayer; layer<=botLayer; ++layer ) + { + shape = new SHAPE( padstack ); + padstack->Append( shape ); + + circle = new CIRCLE( shape ); + shape->SetShape( circle ); + + circle->SetDiameter( dsnDiameter ); + circle->SetLayerId( layerIds[layer].c_str() ); + } + + snprintf( name, sizeof(name), "Via[%d-%d]_%.6g_mil", topLayer, botLayer, dsnDiameter ); + name[ sizeof(name)-1 ] = 0; + padstack->SetPadstackId( name ); + break; + } return padstack; } @@ -586,70 +587,12 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) { SHAPE* shape; PATH* path; -#if 0 - // each oval is 2 lines and 4 (quarter circle) qarcs - QARC* qarc; - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - path = makePath( - POINT( -dr, -radius ), // aStart - POINT( dr, -radius ), // aEnd - layerName ); - shape->SetShape( path ); - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - qarc = makeArc( - POINT( dr, -radius), // aStart - POINT( dr, 0.0 ), // aEnd - POINT( dr, 0.0 ), // aCenter - layerName ); - shape->SetShape( qarc ); - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - qarc = makeArc( - POINT( dr, 0.0), // aStart - POINT( dr, radius), // aEnd - POINT( dr, 0.0 ), // aCenter - layerName ); - shape->SetShape( qarc ); - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - path = makePath( - POINT( dr, radius ), // aStart - POINT( -dr, radius ), // aEnd - layerName ); - shape->SetShape( path ); - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - qarc = makeArc( - POINT( -dr, radius), // aStart - POINT( -dr, 0.0), // aEnd - POINT( -dr, 0.0 ), // aCenter - layerName ); - shape->SetShape( qarc ); - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - qarc = makeArc( - POINT( -dr, 0.0), // aStart - POINT( -dr, -radius), // aEnd - POINT( -dr, 0.0 ), // aCenter - layerName ); - shape->SetShape( qarc ); -#else // see http://www.freerouting.net/usren/viewtopic.php?f=3&t=317#p408 shape = new SHAPE( padstack ); padstack->Append( shape ); path = makePath( POINT(-dr, 0.0), POINT(dr, 0.0), layerName ); shape->SetShape( path ); path->aperture_width = 2.0 * radius; -#endif - ++coppers; } } @@ -666,70 +609,12 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) { SHAPE* shape; PATH* path; -#if 0 - // each oval is 2 lines and 2 qarcs - QARC* qarc; - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - path = makePath( - POINT( -radius, -dr ), // aStart - POINT( -radius, dr ), // aEnd - layerName ); - shape->SetShape( path ); - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - qarc = makeArc( - POINT( -radius, dr ), // aStart - POINT( 0.0, dy ), // aEnd - POINT( 0.0, dr ), // aCenter - layerName ); - shape->SetShape( qarc ); - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - qarc = makeArc( - POINT( 0.0, dy ), // aStart - POINT( radius, dr), // aEnd - POINT( 0.0, dr ), // aCenter - layerName ); - shape->SetShape( qarc ); - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - path = makePath( - POINT( radius, dr ), // aStart - POINT( radius, -dr ), // aEnd - layerName ); - shape->SetShape( path ); - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - qarc = makeArc( - POINT( radius, -dr ), // aStart - POINT( 0.0, -dy ), // aEnd - POINT( 0.0, -dr ), // aCenter - layerName ); - shape->SetShape( qarc ); - - shape = new SHAPE( padstack ); - padstack->Append( shape ); - qarc = makeArc( - POINT( 0.0, -dy ), // aStart - POINT( -radius, -dr ), // aEnd - POINT( 0.0, -dr ), // aCenter - layerName ); - shape->SetShape( qarc ); -#else // see http://www.freerouting.net/usren/viewtopic.php?f=3&t=317#p408 shape = new SHAPE( padstack ); padstack->Append( shape ); path = makePath( POINT(0.0, -dr), POINT(0.0, dr), layerName ); shape->SetShape( path ); path->aperture_width = 2.0 * radius; -#endif - ++coppers; } } @@ -811,6 +696,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) } } + //pcb->placement->flip_style = T_rotate_first; // Since none of these statements cause any immediate output, the order // of them is somewhat flexible. The outputting to disk is done at the @@ -844,6 +730,13 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) layer->name = layerIds.back(); + layer->properties.push_back( PROPERTY() ); + PROPERTY* property = &layer->properties.back(); + property->name = "index"; + char temp[32]; + sprintf( temp, "%d", pcbNdx ); + property->value = temp; + // layer->type = @todo need this, the export would be better. } } @@ -914,7 +807,6 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) } else { -#if 1 PATH* path = new PATH( boundary ); boundary->paths.push_back( path ); @@ -925,17 +817,6 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) // otherwise it will. path->points.push_back( ppairs[i].start ); } -#else - for( unsigned i=0; ipaths.push_back( path ); - - path->layer_id = "pcb"; - path->points.push_back( ppairs[i].start ); - path->points.push_back( ppairs[i].end ); - } -#endif } pcb->structure->SetBOUNDARY( boundary ); @@ -1090,8 +971,16 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) place->part_number = CONV_TO_UTF8( module->GetValue() ); // module is flipped from bottom side, set side to T_back - if( module->flag ) + if( module->flag ) + { + int angle = 1800 - module->m_Orient; + + NORMALIZE_ANGLE_POS(angle); + + place->SetRotation( angle/10.0 ); + place->side = T_back; + } } } @@ -1200,7 +1089,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) wiring->wires.push_back( wire ); wire->net_id = netname; - wire->wire_type = T_protect; // @todo, this should be configurable + wire->wire_type = T_normal; // @todo, this should be configurable int kiLayer = track->GetLayer(); int pcbLayer = kicadLayer2pcb[kiLayer]; @@ -1251,7 +1140,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) dsnVia->net_id = CONV_TO_UTF8( equipot->m_Netname ); - dsnVia->via_type = T_protect; // @todo, this should be configurable + dsnVia->via_type = T_normal; // @todo, this should be configurable } } @@ -1291,4 +1180,3 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) } // namespace DSN -