Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
8d4a9b51
Commit
8d4a9b51
authored
Dec 29, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gerbview polygon erasures added, comment tweaks
parent
0d790e57
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
159 additions
and
171 deletions
+159
-171
CHANGELOG.txt
CHANGELOG.txt
+4
-2
TODO.txt
TODO.txt
+4
-0
base_screen.cpp
common/base_screen.cpp
+1
-2
gerbview.h
gerbview/gerbview.h
+6
-5
rs274d.cpp
gerbview/rs274d.cpp
+30
-39
rs274x.cpp
gerbview/rs274x.cpp
+8
-22
tracepcb.cpp
gerbview/tracepcb.cpp
+105
-100
gr_basic.h
include/gr_basic.h
+1
-1
No files found.
CHANGELOG.txt
View file @
8d4a9b51
...
@@ -13,8 +13,10 @@ email address.
...
@@ -13,8 +13,10 @@ email address.
polygon code to use wxPoints since that is what the underlying wxWidgets
polygon code to use wxPoints since that is what the underlying wxWidgets
API uses.
API uses.
++gerbview
++gerbview
More work on drawing polygons, erasure still work in progress. Will
* More work on drawing polygons, erasure of polygons completed.
probably switch to ZONEs from SEG_ZONEs for polygons.
* Added full support for aperture macro 6, MOIRE.
* Example 2 in RS274xrevd_e.pdf almost draws properly now. Need ARC support
in polygons, and need polygon aperture type support to complete.
2008-Dec-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
2008-Dec-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
...
...
TODO.txt
View file @
8d4a9b51
...
@@ -38,6 +38,10 @@ asked by: Dick Hollenbeck
...
@@ -38,6 +38,10 @@ asked by: Dick Hollenbeck
4) Expose layer name editing in pcbnew (anyone), should dove tail with net
4) Expose layer name editing in pcbnew (anyone), should dove tail with net
class editor from a UI perspective.
class editor from a UI perspective.
** Should probably switch gerbview to use ZONE instead of SEGZONE for polygons.
** Need to add ARC support to gerber polygons.
** Need to add polygon aperture type. Then example 2 in RS274xrevd_e.pdf will draw properly.
2008-Feb-8 Assigned To: dick
2008-Feb-8 Assigned To: dick
asked by: dick
asked by: dick
...
...
common/base_screen.cpp
View file @
8d4a9b51
...
@@ -311,8 +311,7 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
...
@@ -311,8 +311,7 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
}
}
}
}
wxLogDebug
(
wxT
(
"Adding grid ID %d size( %d, %d ) to grid list."
),
// wxLogDebug( wxT( "Adding grid ID %d size( %d, %d ) to grid list." ), grid.m_Id, grid.m_Size.x, grid.m_Size.y );
grid
.
m_Id
,
grid
.
m_Size
.
x
,
grid
.
m_Size
.
y
);
m_GridList
.
Add
(
grid
);
m_GridList
.
Add
(
grid
);
}
}
...
...
gerbview/gerbview.h
View file @
8d4a9b51
...
@@ -108,8 +108,9 @@ class D_CODE;
...
@@ -108,8 +108,9 @@ class D_CODE;
/**
/**
* Class DCODE_PARAM
* Class DCODE_PARAM
* holds a parameter for a DCODE or an "aperture macro" as defined within standard RS274X.
* holds a parameter for a DCODE or an "aperture macro" as defined within standard RS274X.
* The \a value field can be either a constant or a place holder for a DCODE
* The \a value field can be a constant, i.e. "immediate" parameter or it may not be used
* parameter.
* if this param is going to defer to the referencing aperture macro. In that case, the
* \a index field is an index into the aperture macro's paramters.
*/
*/
class
DCODE_PARAM
class
DCODE_PARAM
{
{
...
@@ -145,7 +146,7 @@ public:
...
@@ -145,7 +146,7 @@ public:
private
:
private
:
int
index
;
///< if -1, then \a value field is an immediate value, else this is an index into parent's D_CODE.m_am_params.
int
index
;
///< if -1, then \a value field is an immediate value, else this is an index into parent's D_CODE.m_am_params.
double
value
;
///< if IsImmediate()==true then the value, else not used.
double
value
;
///< if IsImmediate()==true then
use
the value, else not used.
};
};
...
@@ -378,8 +379,8 @@ public:
...
@@ -378,8 +379,8 @@ public:
char
*&
text
,
int
D_commande
);
char
*&
text
,
int
D_commande
);
/**
/**
* size of single line of a text
line
from a gerber file.
* size of single line of a text from a gerber file.
* warning: some files can have very long lines, so the buffer must be large
* warning: some files can have very long lines, so the buffer must be large
.
*/
*/
#define GERBER_BUFZ 4000
#define GERBER_BUFZ 4000
...
...
gerbview/rs274d.cpp
View file @
8d4a9b51
...
@@ -238,43 +238,31 @@ static void fillLineTRACK( TRACK* aTrack, int Dcode_index, int aLayer,
...
@@ -238,43 +238,31 @@ static void fillLineTRACK( TRACK* aTrack, int Dcode_index, int aLayer,
}
}
#if 0 // @todo get it into the doxygen function comment for fillArcTRACK below
/**
/*****************************************************************/
* Function fillArcTRACK
static void Append_1_SEG_ARC_GERBER( int Dcode_index,
* initializes a given TRACK so that it can draw an arc G code.
WinEDA_GerberFrame* frame, wxDC* DC,
* <p>
const wxPoint& startpoint, const wxPoint& endpoint,
const wxPoint& rel_center, int largeur,
bool trigo_sens, bool multiquadrant, bool isDark )
/*****************************************************************/
/*
* Creates an arc:
* if multiquadrant == true : arc can be 0 to 360 degres
* if multiquadrant == true : arc can be 0 to 360 degres
* and
rel_center is the center coordiante relative to startpoint.
* and \a
rel_center is the center coordiante relative to startpoint.
*
*
<p>
* if multiquadrant == false arc can be only 0 to 90 deg,
* if multiquadrant == false arc can be only 0 to 90 deg,
* and only in the same quadrant :
* and only in the same quadrant :
* absolute angle 0 to 90 (quadrant 1) or
* <ul>
* absolute angle 90 to 180 (quadrant 2) or
* <li> absolute angle 0 to 90 (quadrant 1) or
* absolute angle 180 to 270 (quadrant 3) or
* <li> absolute angle 90 to 180 (quadrant 2) or
* absolute angle 270 to 0 (quadrant 4)
* <li> absolute angle 180 to 270 (quadrant 3) or
* rel_center is the center coordiante relative to startpoint,
* <li> absolute angle 270 to 0 (quadrant 4)
* </ul><p>
* @param aTrack is the TRACK to fill in.
* @param Dcode_index is the DCODE value, like D14
* @param aLayer is the layer index to set into the TRACK
* @param aStart is the starting point
* @param aEnd is the ending point
* @param rel_center is the center coordiante relative to startpoint,
* given in ABSOLUE VALUE and the signe of values x et y de rel_center
* given in ABSOLUE VALUE and the signe of values x et y de rel_center
* must be calculated from the previously given constraint: arc only in the same quadrant
* must be calculated from the previously given constraint: arc only in the same quadrant.
*/
#endif
/**
* Function fillArcTRACK
* initializes a given TRACK so that it can draw an arc G code.
*
* @param aTrack The TRACK to fill in.
* @param Dcode_index The DCODE value, like D14
* @param aLayer The layer index to set into the TRACK
* @param aPos The center point of the flash
* @param aDiameter The diameter of the round flash
* @param aDiameter The diameter of the round flash
* @param aWidth is the pen width.
* @param isDark True if flash is positive and should use a drawing
* @param isDark True if flash is positive and should use a drawing
* color other than the background color, else use the background color
* color other than the background color, else use the background color
* when drawing so that an erasure happens.
* when drawing so that an erasure happens.
...
@@ -682,8 +670,9 @@ int GERBER::ReturnDCodeNumber( char*& Text )
...
@@ -682,8 +670,9 @@ int GERBER::ReturnDCodeNumber( char*& Text )
/******************************************************************/
/******************************************************************/
bool
GERBER
::
Execute_G_Command
(
char
*&
text
,
int
G_commande
)
bool
GERBER
::
Execute_G_Command
(
char
*&
text
,
int
G_commande
)
/******************************************************************/
/******************************************************************/
{
{
D
(
printf
(
"%22s: G_CODE<%d>
\n
"
,
__func__
,
G_commande
);)
switch
(
G_commande
)
switch
(
G_commande
)
{
{
case
GC_PHOTO_MODE
:
// can starts a D03 flash command: redundant, can be safely ignored
case
GC_PHOTO_MODE
:
// can starts a D03 flash command: redundant, can be safely ignored
...
@@ -858,6 +847,8 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
...
@@ -858,6 +847,8 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
D_CODE
*
tool
=
NULL
;
D_CODE
*
tool
=
NULL
;
wxString
msg
;
wxString
msg
;
D
(
printf
(
"%22s: D_CODE<%d>
\n
"
,
__func__
,
D_commande
);)
if
(
D_commande
>=
FIRST_DCODE
)
// This is a "Set tool" command
if
(
D_commande
>=
FIRST_DCODE
)
// This is a "Set tool" command
{
{
if
(
D_commande
>
(
MAX_TOOLS
-
1
)
)
if
(
D_commande
>
(
MAX_TOOLS
-
1
)
)
...
...
gerbview/rs274x.cpp
View file @
8d4a9b51
...
@@ -47,7 +47,7 @@ enum RS274X_PARAMETERS
...
@@ -47,7 +47,7 @@ enum RS274X_PARAMETERS
/**
/**
* Function ReadXCommand
* Function ReadXCommand
* reads in
t
two bytes of data and assembles them into an int with the first
* reads in two bytes of data and assembles them into an int with the first
* byte in the sequence put into the most significant part of a 16 bit value
* byte in the sequence put into the most significant part of a 16 bit value
* and the second byte put into the least significant part of the 16 bit value.
* and the second byte put into the least significant part of the 16 bit value.
* @param text A reference to a pointer to read bytes from and to advance as they are read.
* @param text A reference to a pointer to read bytes from and to advance as they are read.
...
@@ -177,7 +177,7 @@ bool GERBER::ExecuteRS274XCommand( int command, char buff[GERBER_BUFZ], char*& t
...
@@ -177,7 +177,7 @@ bool GERBER::ExecuteRS274XCommand( int command, char buff[GERBER_BUFZ], char*& t
double
fcoord
;
double
fcoord
;
double
conv_scale
=
m_GerbMetric
?
PCB_INTERNAL_UNIT
/
25.4
:
PCB_INTERNAL_UNIT
;
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 );)
D
(
printf
(
"%22
s: Command <%c%c>
\n
"
,
__func__
,
(
command
>>
8
)
&
0xFF
,
command
&
0xFF
);)
switch
(
command
)
switch
(
command
)
{
{
...
@@ -311,28 +311,18 @@ bool GERBER::ExecuteRS274XCommand( int command, char buff[GERBER_BUFZ], char*& t
...
@@ -311,28 +311,18 @@ bool GERBER::ExecuteRS274XCommand( int command, char buff[GERBER_BUFZ], char*& t
case
IMAGE_POLARITY
:
case
IMAGE_POLARITY
:
if
(
strnicmp
(
text
,
"NEG"
,
3
)
==
0
)
if
(
strnicmp
(
text
,
"NEG"
,
3
)
==
0
)
{
m_ImageNegative
=
true
;
D
(
printf
(
"%s: m_ImageNegative=true
\n
"
,
__func__
);)
m_ImageNegative
=
TRUE
;
}
else
else
{
m_ImageNegative
=
false
;
D
(
printf
(
"%s: m_ImageNegative=false
\n
"
,
__func__
);)
D
(
printf
(
"%22s: IMAGE_POLARITY m_ImageNegative=%s
\n
"
,
__func__
,
m_ImageNegative
?
"true"
:
"false"
);)
m_ImageNegative
=
FALSE
;
}
break
;
break
;
case
LAYER_POLARITY
:
case
LAYER_POLARITY
:
if
(
*
text
==
'C'
)
if
(
*
text
==
'C'
)
{
m_LayerNegative
=
true
;
D
(
printf
(
"%s: m_LayerNegative=true
\n
"
,
__func__
);)
m_LayerNegative
=
TRUE
;
}
else
else
{
m_LayerNegative
=
false
;
D
(
printf
(
"%s: m_LayerNegative=false
\n
"
,
__func__
);)
D
(
printf
(
"%22s: LAYER_POLARITY m_LayerNegative=%s
\n
"
,
__func__
,
m_LayerNegative
?
"true"
:
"false"
);)
m_LayerNegative
=
FALSE
;
}
break
;
break
;
case
INCLUDE_FILE
:
case
INCLUDE_FILE
:
...
@@ -366,7 +356,6 @@ bool GERBER::ExecuteRS274XCommand( int command, char buff[GERBER_BUFZ], char*& t
...
@@ -366,7 +356,6 @@ bool GERBER::ExecuteRS274XCommand( int command, char buff[GERBER_BUFZ], char*& t
break
;
break
;
case
AP_DEFINITION
:
case
AP_DEFINITION
:
// input example: %ADD30R,0.081800X0.101500*%
// input example: %ADD30R,0.081800X0.101500*%
// at this point, text points to 2nd 'D'
// at this point, text points to 2nd 'D'
...
@@ -501,9 +490,6 @@ bool GERBER::ExecuteRS274XCommand( int command, char buff[GERBER_BUFZ], char*& t
...
@@ -501,9 +490,6 @@ bool GERBER::ExecuteRS274XCommand( int command, char buff[GERBER_BUFZ], char*& t
}
}
dcode
->
m_Shape
=
APT_MACRO
;
dcode
->
m_Shape
=
APT_MACRO
;
D
(
printf
(
"pam has %d parameters
\n
"
,
pam
->
primitives
.
size
()
);)
dcode
->
SetMacro
(
(
APERTURE_MACRO
*
)
pam
);
dcode
->
SetMacro
(
(
APERTURE_MACRO
*
)
pam
);
}
}
break
;
break
;
...
...
gerbview/tracepcb.cpp
View file @
8d4a9b51
...
@@ -114,12 +114,14 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
...
@@ -114,12 +114,14 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
return
;
return
;
bool
erase
;
bool
erase
;
int
Color
;
bool
filled
;
// Draw filled polygons
// Draw filled polygons
std
::
vector
<
wxPoint
>
coord
s
;
std
::
vector
<
wxPoint
>
point
s
;
// minimize reallocations of the vector's internal array by starting with a good sized one.
// minimize reallocations of the vector's internal array by starting with a good sized one.
coords
.
reserve
(
2
0000
);
points
.
reserve
(
1
0000
);
for
(
TRACK
*
track
=
m_Pcb
->
m_Zone
;
track
;
track
=
track
->
Next
()
)
for
(
TRACK
*
track
=
m_Pcb
->
m_Zone
;
track
;
track
=
track
->
Next
()
)
{
{
...
@@ -128,45 +130,48 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
...
@@ -128,45 +130,48 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
if
(
track
->
GetNet
()
==
0
)
// StartPoint
if
(
track
->
GetNet
()
==
0
)
// StartPoint
{
{
if
(
coord
s
.
size
()
)
// we have found a new polygon: Draw the old polygon
if
(
point
s
.
size
()
)
// we have found a new polygon: Draw the old polygon
{
{
int
Color
;
int
filled
;
if
(
erase
)
if
(
erase
)
{
{
D
(
printf
(
"erase
\n
"
);)
Color
=
g_DrawBgColor
;
Color
=
g_DrawBgColor
;
filled
=
true
;
filled
=
true
;
}
}
else
else
{
{
D
(
printf
(
"NO erase
\n
"
);)
Color
=
g_DesignSettings
.
m_LayerColor
[
track
->
GetLayer
()];
Color
=
g_DesignSettings
.
m_LayerColor
[
track
->
GetLayer
()];
filled
=
(
g_DisplayPolygonsModeSketch
==
0
)
?
1
:
0
;
filled
=
(
g_DisplayPolygonsModeSketch
==
0
);
}
}
GRClosedPoly
(
&
DrawPanel
->
m_ClipBox
,
DC
,
coords
.
size
(),
&
coord
s
[
0
],
GRClosedPoly
(
&
DrawPanel
->
m_ClipBox
,
DC
,
points
.
size
(),
&
point
s
[
0
],
filled
,
Color
,
Color
);
filled
,
Color
,
Color
);
}
}
erase
=
(
track
->
m_Flags
&
DRAW_ERASED
)
?
true
:
false
;
erase
=
(
track
->
m_Flags
&
DRAW_ERASED
);
coord
s
.
clear
();
point
s
.
clear
();
coord
s
.
push_back
(
track
->
m_Start
);
point
s
.
push_back
(
track
->
m_Start
);
coord
s
.
push_back
(
track
->
m_End
);
point
s
.
push_back
(
track
->
m_End
);
}
}
else
else
{
{
coord
s
.
push_back
(
track
->
m_End
);
point
s
.
push_back
(
track
->
m_End
);
}
}
if
(
track
->
Next
()
==
NULL
)
// Last point
if
(
track
->
Next
()
==
NULL
)
// Last point
{
{
int
Color
=
g_DesignSettings
.
m_LayerColor
[
track
->
GetLayer
()];
if
(
erase
)
int
filled
=
(
g_DisplayPolygonsModeSketch
==
0
)
?
1
:
0
;
{
Color
=
g_DrawBgColor
;
filled
=
true
;
}
else
{
Color
=
g_DesignSettings
.
m_LayerColor
[
track
->
GetLayer
()];
filled
=
(
g_DisplayPolygonsModeSketch
==
0
);
}
GRClosedPoly
(
&
DrawPanel
->
m_ClipBox
,
DC
,
coords
.
size
(),
&
coord
s
[
0
],
GRClosedPoly
(
&
DrawPanel
->
m_ClipBox
,
DC
,
points
.
size
(),
&
point
s
[
0
],
filled
,
Color
,
Color
);
filled
,
Color
,
Color
);
}
}
}
}
...
...
include/gr_basic.h
View file @
8d4a9b51
...
@@ -140,7 +140,7 @@ void GRClosedPoly(EDA_Rect * ClipBox, wxDC* aDC, int aPointCount, wxPoint aPoint
...
@@ -140,7 +140,7 @@ void GRClosedPoly(EDA_Rect * ClipBox, wxDC* aDC, int aPointCount, wxPoint aPoint
* @param aDC the device context into which drawing should occur.
* @param aDC the device context into which drawing should occur.
* @param x The x coordinate in user space of the center of the circle.
* @param x The x coordinate in user space of the center of the circle.
* @param x The y coordinate in user space of the center of the circle.
* @param x The y coordinate in user space of the center of the circle.
* @param aRadius is the radis of the circle.
* @param aRadius is the radi
u
s of the circle.
* @param aColor is an index into our color table of RGB colors.
* @param aColor is an index into our color table of RGB colors.
* @see EDA_Colors and colors.h
* @see EDA_Colors and colors.h
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment