Commit de78cdb1 authored by dickelbeck's avatar dickelbeck

aperture macros, polygons before tracks

parent 23003001
......@@ -5,6 +5,16 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Dec-15 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++gerbview
Implemented most of the "thermal" aperture macro, at least so that it
displays as concentric circles OK. Still need to do the cross hairs.
Fixed a bug loading aperture macros from disk, could crash gerbview.
Switched TRACKs to after polygons in tracepcb.cpp, temporary solution until
I have more time.
2008-Dec-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++pcbnew
......
......@@ -2,6 +2,7 @@
/**** Routine de lecture et visu d'un fichier GERBER ****/
/********************************************************/
#include "fctsys.h"
#include "common.h"
......@@ -76,6 +77,7 @@
/* Variables locales : */
static wxPoint LastPosition;
/* Local Functions (are lower case since they are private to this source file) */
......@@ -103,8 +105,6 @@ static void fillRoundFlashTRACK( TRACK* aTrack, int Dcode_index, int aLayer,
aTrack->SetNet( Dcode_index );
aTrack->m_Shape = S_SPOT_CIRCLE;
// D(printf("%s: isDark=%s\n", __func__, isDark ? "true" : "false" );)
if( !isDark )
{
aTrack->m_Flags |= DRAW_ERASED;
......@@ -156,7 +156,6 @@ static void fillOvalOrRectFlashTRACK( TRACK* aTrack, int Dcode_index, int aLaye
aTrack->m_End.y += len;
}
// D(printf("%s: isDark=%s\n", __func__, isDark ? "true" : "false" );)
if( !isDark )
{
aTrack->m_Flags |= DRAW_ERASED;
......@@ -192,7 +191,6 @@ static void fillLineTRACK( TRACK* aTrack, int Dcode_index, int aLayer,
aTrack->SetNet( Dcode_index );
//D(printf("%s: isDark=%s\n", __func__, isDark ? "true" : "false" );)
if( !isDark )
{
aTrack->m_Flags |= DRAW_ERASED;
......@@ -314,7 +312,6 @@ static void fillArcTRACK( TRACK* aTrack, int Dcode_index, int aLayer,
if( !isDark )
{
D(printf("%s: isDark=false\n", __func__ );)
aTrack->m_Flags |= DRAW_ERASED;
}
}
......@@ -625,6 +622,7 @@ int GERBER::ReturnDCodeNumber( char*& Text )
if( Text == NULL )
return 0;
Text++;
text = line;
while( IsNumber( *Text ) )
......@@ -865,6 +863,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
}
}
else
{
switch( D_commande )
{
case 1: // code D01 Draw line, exposure ON
......@@ -1039,11 +1038,33 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
}
break;
case AMP_THERMAL:
{
int outerDiam = scale( p->params[2].GetValue(tool), m_GerbMetric );
int innerDiam = scale( p->params[3].GetValue(tool), m_GerbMetric );
curPos += mapPt( p->params[0].GetValue( tool ), p->params[1].GetValue( tool ), m_GerbMetric );
track = new TRACK( frame->m_Pcb );
frame->m_Pcb->m_Track.Append( track );
fillRoundFlashTRACK( track, dcode, activeLayer, curPos,
outerDiam, !(m_LayerNegative ^ m_ImageNegative) );
track = new TRACK( frame->m_Pcb );
frame->m_Pcb->m_Track.Append( track );
fillRoundFlashTRACK( track, dcode, activeLayer, curPos,
innerDiam, (m_LayerNegative ^ m_ImageNegative) );
// @todo: draw the cross hairs, see page 23 of rs274 spec.
// this might be done with two lines, thickness from params[4], and drawing
// darkness "(m_LayerNegative ^ m_ImageNegative)"
}
break;
case AMP_EOF:
case AMP_OUTLINE:
case AMP_POLYGON:
case AMP_MOIRE:
case AMP_THERMAL:
default:
// not yet supported, waiting for you.
break;
......@@ -1062,6 +1083,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
default:
return false;
}
}
return true;
}
......
......@@ -177,6 +177,8 @@ bool GERBER::ExecuteRS274XCommand( int command, char buff[GERBER_BUFZ], char*& t
double fcoord;
double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT / 25.4 : PCB_INTERNAL_UNIT;
//D(printf( "%s: Command <%c%c>\n", __func__, (command >> 8) & 0xFF, command & 0xFF );)
switch( command )
{
case FORMAT_STATEMENT:
......@@ -567,9 +569,7 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerbe
for(;;)
{
am.primitives.push_back( AM_PRIMITIVE() );
AM_PRIMITIVE& prim = am.primitives.back();
AM_PRIMITIVE prim;
if( *text == '*' )
++text;
......@@ -625,7 +625,8 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerbe
return false;
}
for( int i=0; i<paramCount && *text && *text!='*'; ++i )
int i;
for( i=0; i<paramCount && *text && *text!='*'; ++i )
{
prim.params.push_back( DCODE_PARAM() );
......@@ -640,6 +641,9 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerbe
param.SetValue( ReadDouble( text ) );
}
if( i<paramCount ) // maybe some day we can throw an exception and track a line number
printf("i=%d, insufficient parameters\n", i);
// there are more parameters to read if this is an AMP_OUTLINE
if( prim.primitive_id == AMP_OUTLINE )
{
......@@ -665,6 +669,8 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerbe
}
}
am.primitives.push_back( prim );
}
m_aperture_macros.insert( am );
......
......@@ -113,9 +113,6 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
if( !m_Pcb )
return;
// Draw tracks and flashes
Draw_Track_Buffer( DrawPanel, DC, m_Pcb, draw_mode, printmasklayer );
// Draw filled polygons
#define NBMAX 20000
int nbpoints = 0;
......@@ -125,7 +122,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
{
if( printmasklayer != -1 && !(track->ReturnMaskLayer() & printmasklayer) )
if( !(track->ReturnMaskLayer() & printmasklayer) )
continue;
if( track->GetNet() == 0 ) // StartPoint
......@@ -174,6 +171,9 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
free( coord );
// Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues
Draw_Track_Buffer( DrawPanel, DC, m_Pcb, draw_mode, printmasklayer );
if( DisplayOpt.DisplayPadNum )
Affiche_DCodes_Pistes( DrawPanel, DC, m_Pcb, GR_COPY );
......
......@@ -237,8 +237,8 @@ void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int d
for( ; track != NULL; track = track->Next() )
{
if( (track->m_Shape == S_ARC)
|| (track->m_Shape == S_CIRCLE)
|| (track->m_Shape == S_ARC_RECT) )
|| (track->m_Shape == S_CIRCLE)
|| (track->m_Shape == S_ARC_RECT) )
{
pos.x = track->m_Start.x;
pos.y = track->m_Start.y;
......@@ -248,7 +248,9 @@ void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int d
pos.x = (track->m_Start.x + track->m_End.x) / 2;
pos.y = (track->m_Start.y + track->m_End.y) / 2;
}
Line.Printf( wxT( "D%d" ), track->GetNet() );
width = track->m_Width;
orient = TEXT_ORIENT_HORIZ;
if( track->m_Shape >= S_SPOT_CIRCLE ) // forme flash
......
......@@ -31,7 +31,7 @@ asked by: Dick Hollenbeck
1) Gerbview needs to work at least as well as gerv, that means adding named layers,
and a list control to sort the layer stack on the fly. There seems to be a polygon bug
of some kind, don't know how long that's been in there. (Dick)
2) Add net class suppport to PCBNEW, so the round tripping to freerouter
2) Add net class support to PCBNEW, so the round tripping to freerouter
is a dream (Dick)
3) Document the specctra round tripper, and fix up the english translation
of help. (Dick, native english speaker)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment