From e2972c5fff466705a24ab55050361962b8cb37bd Mon Sep 17 00:00:00 2001 From: Simon Wells Date: Mon, 7 Sep 2015 18:05:23 +1200 Subject: [PATCH 1/2] Fixed gerber generation with J5_ATTR defined --- pcbnew/pcbplot.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 4b8f89e1f6..cc7f900890 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -215,7 +215,7 @@ void AddGerberX2Attribute( PLOTTER * aPlotter, #ifdef USE_J5_ATTR // Creates the TF,.GenerationSoftware. Format is: // %TF,.GenerationSoftware,,[,]*% - text.Printf( wxT( "%TF.GenerationSoftware,KiCad,Pcbnew,%s*%%" ), GetBuildVersion() ); + text.Printf( wxT( "%%TF.GenerationSoftware,KiCad,Pcbnew,%s*%%" ), GetBuildVersion() ); aPlotter->AddLineToHeader( text ); // creates the TF.CreationDate ext: @@ -230,7 +230,7 @@ void AddGerberX2Attribute( PLOTTER * aPlotter, // we want +(or -) hh:mm if( msg.Len() > 3 ) msg.insert( 3, ":", 1 ), - text.Printf( wxT( "%TF.CreationDate,%s%s*%%" ), GetChars( date.FormatISOCombined() ), GetChars( msg ) ); + text.Printf( wxT( "%%TF.CreationDate,%s%s*%%" ), GetChars( date.FormatISOCombined() ), GetChars( msg ) ); aPlotter->AddLineToHeader( text ); // Creates the TF,.JobID. Format is (from Gerber file format doc): @@ -276,7 +276,7 @@ void AddGerberX2Attribute( PLOTTER * aPlotter, if( rev.IsEmpty() ) rev = wxT( "rev?" ); - text.Printf( wxT( "%TF.JobID,%s,%s,%s*%%" ), msg.ToAscii(), GetChars( guid ), rev.ToAscii() ); + text.Printf( wxT( "%%TF.JobID,%s,%s,%s*%%" ), msg.ToAscii(), GetChars( guid ), rev.ToAscii() ); aPlotter->AddLineToHeader( text ); #endif From f88140c95d06f3ee04868022af25247f96d29a9f Mon Sep 17 00:00:00 2001 From: Simon Wells Date: Wed, 9 Sep 2015 00:21:31 +1200 Subject: [PATCH 2/2] Fixed RS274X image rotation parsing. If the image was being rotated by a valid amount but not 270 degrees due to the if statements it would already report that there was an invalid value. Also due to the strnicmp only checking the first 2 characters which was valid for 0* but not the rest of the numbers, some values would be able to work that shouldn't --- gerbview/rs274x.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index 1555477c11..6371404937 100644 --- a/gerbview/rs274x.cpp +++ b/gerbview/rs274x.cpp @@ -434,11 +434,11 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command, case IMAGE_ROTATION: // command IR0* or IR90* or IR180* or IR270* if( strnicmp( text, "0*", 2 ) == 0 ) m_ImageRotation = 0; - if( strnicmp( text, "90*", 2 ) == 0 ) + else if( strnicmp( text, "90*", 3 ) == 0 ) m_ImageRotation = 90; - if( strnicmp( text, "180*", 2 ) == 0 ) + else if( strnicmp( text, "180*", 4 ) == 0 ) m_ImageRotation = 180; - if( strnicmp( text, "270*", 2 ) == 0 ) + else if( strnicmp( text, "270*", 4 ) == 0 ) m_ImageRotation = 270; else ReportMessage( _( "RS274X: Command \"IR\" rotation value not allowed" ) );