Minot fixes in GERBER_JOBFILE_WRITER, due to recent changes in .gbrjob file format.

This commit is contained in:
jean-pierre charras 2019-09-20 13:13:19 +02:00
parent 4d8949371f
commit badd0bfa54
2 changed files with 16 additions and 5 deletions

View File

@ -61,7 +61,8 @@ static wxString CopperFinishType[] =
// A list of available colors for solder mask and silkscreen
// These names are used in .gbrjob file, so they are not fully free.
// Use only what is allowed in .gbrjob files.
// for other colors (user defined), the defined value is the html color syntax.
// for other colors (user defined), the defined value is the html color syntax
// and R<integer>G<integer>B<integer> In gbrjob file.
static FAB_LAYER_COLOR solderMaskColors[] =
{
{ _HKI( NOT_SPECIFIED ), wxColor( 80, 80, 80 ) }, // Not specified, not in .gbrjob file
@ -71,7 +72,6 @@ static FAB_LAYER_COLOR solderMaskColors[] =
{ _HKI( "Black" ), wxColor( 20, 20, 20 ) }, // used in .gbrjob file
{ _HKI( "White" ), wxColor( 200, 200, 200 ) }, // used in .gbrjob file
{ _HKI( "Yellow" ), wxColor( 128, 128, 0 ) }, // used in .gbrjob file
{ _HKI( "Purple" ), wxColor( 100, 0, 100 ) }, // used in .gbrjob file
{ _HKI( USER_DEFINED ), wxColor( 128, 128, 128 ) }, //free. the name is a dummy name here
{ "", wxColor( 0, 0, 0 ) } // Sentinel
};

View File

@ -657,7 +657,18 @@ void GERBER_JOBFILE_WRITER::addJSONMaterialStackup()
if( item->IsColorEditable() && uptodate )
{
if( !item->m_Color.IsEmpty() && item->m_Color != NOT_SPECIFIED )
addJSONObject( wxString::Format( "\"Color\": \"%s\",\n", item->m_Color ) );
{
wxString colorName = item->m_Color;
if( colorName.StartsWith( "#" ) ) // This is a user defined color.
{
// In job file a color can be given by its RGB values (0...255)
wxColor color( colorName );
colorName.Printf( "R%dG%dB%d", color.Red(), color.Green(), color.Blue() );
}
addJSONObject( wxString::Format( "\"Color\": \"%s\",\n", colorName ) );
}
}
if( item->IsThicknessEditable() && uptodate )
@ -672,8 +683,8 @@ void GERBER_JOBFILE_WRITER::addJSONMaterialStackup()
// Do not add constrains that create more expensive boards.
if( brd_stackup.m_HasDielectricConstrains )
{
addJSONObject( wxString::Format( "\"DielectricConstant\": %.1f,\n", item->m_EpsilonR ) );
addJSONObject( wxString::Format( "\"LossTangent\": %f,\n", item->m_LossTangent ) );
addJSONObject( wxString::Format( "\"DielectricConstant\": %s,\n", item->FormatEpsilonR() ) );
addJSONObject( wxString::Format( "\"LossTangent\": %s,\n", item->FormatLossTangent() ) );
}
PCB_LAYER_ID next_copper_layer = (PCB_LAYER_ID) (last_copper_layer+1);