From d4562043a2e9e4823f3d42691a5e6fc3afd426b3 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Sun, 3 Feb 2008 21:46:12 +0000 Subject: [PATCH] more amazing free software --- change_log.txt | 25 ++++++++--------------- pcbnew/specctra.h | 41 ++++++++++++++++++++++++++++++++++---- pcbnew/specctra_export.cpp | 32 +++++++++++++++++++++++------ 3 files changed, 71 insertions(+), 27 deletions(-) diff --git a/change_log.txt b/change_log.txt index 26c672f177..075b36877d 100644 --- a/change_log.txt +++ b/change_log.txt @@ -8,25 +8,16 @@ email address. 2008-Feb-3 UPDATE Dick Hollenbeck ================================================================================ +pcbnew - specctra_export.cpp was not exporting the nets correctly. beautification - of a few modules. + * specctra_export.cpp was not exporting the nets correctly, now fixed. + * Had a problem with an isolated pad modification on a single module instance + in the context of several unmodified instances of same module, now fixed. + * Fixed oval pads to make freerouting.net happy. + See: http://www.freerouting.net/usren/viewtopic.php?f=3&t=317#p408 + Done with specctra export for now, will think about adding controls (by dialog) + on the export later. + * Beautification of a few modules. -2008-Feb-1 UPDATE Dick Hollenbeck -================================================================================ -+pcbnew: - SPECCTRA export now exports pads with offset OK, exports oval pads OK, - and tries to do less with pcb edges that are not a connected set of lines, - putting the burden back on the PCBNEW user to have clean perimeter lines. - Discovered that freerouter does not support oval pads yet, asked - for enhancement. Discovered a small problem if you modify a PAD in - the MODULE editor but do not replicate that change throughout all module - instances in the board. Is on my @todo list. Otherwise it is getting pretty - good now. Most boards load into freerouter, except mine, which if exported - with part numbers, hangs the freerouter! I may be away for a few days doing - billable work, after which I will begin the 2 imports, *.dsn and *.ses. - - 2008-Jan-31 UPDATE Jean-Pierre Charras ================================================================================ +pcbnew: diff --git a/pcbnew/specctra.h b/pcbnew/specctra.h index 8c5fb06f1c..d74fb8518e 100644 --- a/pcbnew/specctra.h +++ b/pcbnew/specctra.h @@ -1943,10 +1943,11 @@ public: } }; - +class LIBRARY; class IMAGE : public ELEM_HOLDER { friend class SPECCTRA_DB; + friend class LIBRARY; std::string hash; ///< a hash string used by Compare(), not Format()ed/exported. @@ -1967,6 +1968,8 @@ class IMAGE : public ELEM_HOLDER KEEPOUTS keepouts; + int duplicated; ///< no. times this image_id is duplicated + public: IMAGE( ELEM* aParent ) : @@ -1976,6 +1979,7 @@ public: unit = 0; rules = 0; place_rules = 0; + duplicated = 0; } ~IMAGE() { @@ -1990,12 +1994,30 @@ public: */ static int Compare( IMAGE* lhs, IMAGE* rhs ); + std::string GetImageId() + { + if( duplicated ) + { + char buf[32]; + + std::string ret = image_id; + ret += "::"; + sprintf( buf, "%d", duplicated ); + ret += buf; + return ret; + } + + return image_id; + } + void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ) { - const char* quote = out->GetQuoteChar( image_id.c_str() ); + std::string imageId = GetImageId(); + + const char* quote = out->GetQuoteChar( imageId.c_str() ); out->Print( nestLevel, "(%s %s%s%s", LEXER::GetTokenText( Type() ), - quote, image_id.c_str(), quote ); + quote, imageId.c_str(), quote ); FormatContents( out, nestLevel+1 ); @@ -2205,11 +2227,22 @@ public: */ int FindIMAGE( IMAGE* aImage ) { - for( unsigned i=0; iimage_id.compare( images[i].image_id ) ) + aImage->duplicated = dups++; + } + return -1; } diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index 978ee6ac12..dabafc6bb3 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -230,7 +230,7 @@ static void swapEnds( POINT_PAIRS& aList ) } } -#if 1 && defined(DEBUG) +#if 0 && defined(DEBUG) printf( "swapEnds():\n" ); for( unsigned i=0; iSetLayerId( aLayerName.c_str() ); return qarc; } +*/ IMAGE* SPECCTRA_DB::makeIMAGE( MODULE* aModule ) @@ -582,10 +584,10 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) { if( doLayer[layer] ) { - // each oval is 2 lines and 4 (quarter circle) qarcs - SHAPE* shape; PATH* path; +#if 0 + // each oval is 2 lines and 4 (quarter circle) qarcs QARC* qarc; shape = new SHAPE( padstack ); @@ -639,6 +641,14 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) 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; } @@ -654,10 +664,10 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) { if( doLayer[layer] ) { - // each oval is 2 lines and 2 qarcs - SHAPE* shape; PATH* path; +#if 0 + // each oval is 2 lines and 2 qarcs QARC* qarc; shape = new SHAPE( padstack ); @@ -711,6 +721,14 @@ void SPECCTRA_DB::makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads ) 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; } @@ -1061,7 +1079,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) // and made it different from what is in the PCBNEW library. Need to test // each image for uniqueness, not just based on name as is done here: - COMPONENT* comp = pcb->placement->LookupCOMPONENT( registered->image_id ); + COMPONENT* comp = pcb->placement->LookupCOMPONENT( registered->GetImageId() ); PLACE* place = new PLACE( comp ); comp->places.push_back( place ); @@ -1130,6 +1148,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) } } +#if 1 // do existing wires and vias //---------------------------------------- { @@ -1236,6 +1255,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) } } +#endif // do existing wires and vias //------------------------------------------------------ {