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
f64c5401
Commit
f64c5401
authored
Oct 07, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More about copper zones filled without grid (by polygons) - work still in progress
parent
6167f5fc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
71 deletions
+61
-71
tracepcb.cpp
pcbnew/tracepcb.cpp
+14
-14
zones_convert_brd_items_to_polygons.cpp
pcbnew/zones_convert_brd_items_to_polygons.cpp
+47
-57
No files found.
pcbnew/tracepcb.cpp
View file @
f64c5401
...
@@ -111,6 +111,20 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -111,6 +111,20 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
/********************************************************************/
/********************************************************************/
/* Redraw the BOARD items but not cursors, axis or grid */
/* Redraw the BOARD items but not cursors, axis or grid */
{
{
/* Draw areas (i.e. zones) */
for
(
int
ii
=
0
;
ii
<
GetAreaCount
();
ii
++
)
{
ZONE_CONTAINER
*
zone
=
GetArea
(
ii
);
// Areas must be drawn here only if not moved or dragged,
// because these areas are drawn by ManageCursor() in a specific manner
if
(
(
zone
->
m_Flags
&
(
IN_EDIT
|
IS_DRAGGED
|
IS_MOVED
))
==
0
)
{
zone
->
Draw
(
aPanel
,
DC
,
aDrawMode
);
zone
->
DrawFilledArea
(
aPanel
,
DC
,
aDrawMode
);
}
}
for
(
MODULE
*
module
=
m_Modules
;
module
;
module
=
module
->
Next
()
)
for
(
MODULE
*
module
=
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
{
bool
display
=
true
;
bool
display
=
true
;
...
@@ -175,20 +189,6 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
...
@@ -175,20 +189,6 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
}
}
/* Draw areas (i.e. zones) */
for
(
int
ii
=
0
;
ii
<
GetAreaCount
();
ii
++
)
{
ZONE_CONTAINER
*
zone
=
GetArea
(
ii
);
// Areas must be drawn here only if not moved or dragged,
// because these areas are drawn by ManageCursor() in a specific manner
if
(
(
zone
->
m_Flags
&
(
IN_EDIT
|
IS_DRAGGED
|
IS_MOVED
))
==
0
)
{
zone
->
Draw
(
aPanel
,
DC
,
aDrawMode
);
zone
->
DrawFilledArea
(
aPanel
,
DC
,
aDrawMode
);
}
}
// draw the BOARD's markers.
// draw the BOARD's markers.
for
(
unsigned
i
=
0
;
i
<
m_markers
.
size
();
++
i
)
for
(
unsigned
i
=
0
;
i
<
m_markers
.
size
();
++
i
)
{
{
...
...
pcbnew/zones_convert_brd_items_to_polygons.cpp
View file @
f64c5401
...
@@ -30,7 +30,7 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng,
...
@@ -30,7 +30,7 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng,
// Local Variables:
// Local Variables:
/* how many segments are used to create a polygon from a circle: */
/* how many segments are used to create a polygon from a circle: */
static
int
s_CircleToSegmentsCount
=
16
;
static
int
s_CircleToSegmentsCount
=
32
;
/** function AddClearanceAreasPolygonsToPolysList
/** function AddClearanceAreasPolygonsToPolysList
* Add non copper areas polygons (pads and tracks with clearence)
* Add non copper areas polygons (pads and tracks with clearence)
...
@@ -253,7 +253,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
...
@@ -253,7 +253,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
int
aThermalGap
,
int
aThermalGap
,
int
aCopperTickness
)
int
aCopperTickness
)
{
{
wxPoint
corner
,
corner_
start
,
corner_
end
;
wxPoint
corner
,
corner_end
;
wxPoint
PadShapePos
=
aPad
.
ReturnShapePos
();
/* Note: for pad having a shape offset,
wxPoint
PadShapePos
=
aPad
.
ReturnShapePos
();
/* Note: for pad having a shape offset,
* the pad position is NOT the shape position */
* the pad position is NOT the shape position */
int
angle
=
0
;
int
angle
=
0
;
...
@@ -270,39 +270,29 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
...
@@ -270,39 +270,29 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
{
{
case
PAD_CIRCLE
:
// Add 4 similar holes
case
PAD_CIRCLE
:
// Add 4 similar holes
{
{
/* we create 4 copper holes and put them in position 1, 2, 3 and 4
* here is the area of the rectangular pad + its thermal gap
* the 4 copper holes remove the copper in order to create the thermal gap
* 4 ------ 1
* | |
* | |
* | |
* | |
* 3 ------ 2
* holes 2, 3, 4 are the same as hole 1, rotated 90, 180, 270 deg
*/
// Build the hole pattern, for the hole in the X >0, Y > 0 plane:
// Build the hole pattern, for the hole in the X >0, Y > 0 plane:
std
::
vector
<
int
>
corners_buffer
;
std
::
vector
<
int
>
corners_buffer
;
// calculate the starting point of the inner arc
corner
.
y
=
copper_tickness
.
x
/
2
;
// note dx is the pad radius, so copper_tickness.x is the value to use
double
dtmp
=
(
(
double
)
dx
*
dx
)
-
(
(
double
)
corner
.
y
*
corner
.
y
);
corner
.
x
=
(
int
)
sqrt
(
dtmp
);
corner_start
=
corner
;
// calculate the ending point of the inner arc
corner_end
.
x
=
corner
.
y
;
corner_end
.
y
=
corner
.
x
;
// calculate intermediate points (y coordinate from corner.y to corner_end.y)
while
(
(
corner
.
y
<
corner_end
.
y
)
&&
(
corner
.
x
>
corner_end
.
x
)
)
{
corners_buffer
.
push_back
(
corner
.
x
);
corners_buffer
.
push_back
(
corner
.
y
);
RotatePoint
(
&
corner
,
-
delta
);
}
corners_buffer
.
push_back
(
corner_end
.
x
);
corners_buffer
.
push_back
(
corner_end
.
y
);
// calculate the starting point of the outter arc
// calculate the starting point of the outter arc
dx
+=
aThermalGap
;
// The radius of the outter arc is dx = pad radius + aThermalGap
dx
+=
aThermalGap
;
// The radius of the outter arc is dx = pad radius + aThermalGap
corner
.
x
=
corner_end
.
x
;
corner
.
x
=
aThermalGap
/
2
;
dtmp
=
(
(
double
)
dx
*
dx
)
-
(
(
double
)
corner
.
x
*
corner
.
x
);
d
ouble
d
tmp
=
(
(
double
)
dx
*
dx
)
-
(
(
double
)
corner
.
x
*
corner
.
x
);
corner
.
y
=
(
int
)
sqrt
(
dtmp
);
corner
.
y
=
(
int
)
sqrt
(
dtmp
);
// calculate the ending point of the outter arc
// calculate the ending point of the outter arc
corner_end
.
x
=
corner
.
y
;
corner_end
.
x
=
corner
.
y
;
corner_end
.
y
=
corner_start
.
y
;
corner_end
.
y
=
aThermalGap
/
2
;
// calculate intermediate points (y coordinate from corner.y to corner_end.y
// calculate intermediate points (y coordinate from corner.y to corner_end.y
while
(
(
corner
.
y
>
corner_end
.
y
)
&&
(
corner
.
x
<
corner_end
.
x
))
while
(
(
corner
.
y
>
corner_end
.
y
)
&&
(
corner
.
x
<
corner_end
.
x
))
...
@@ -311,10 +301,15 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
...
@@ -311,10 +301,15 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
corners_buffer
.
push_back
(
corner
.
y
);
corners_buffer
.
push_back
(
corner
.
y
);
RotatePoint
(
&
corner
,
delta
);
RotatePoint
(
&
corner
,
delta
);
}
}
corners_buffer
.
push_back
(
corner_end
.
x
);
corners_buffer
.
push_back
(
corner_end
.
x
);
corners_buffer
.
push_back
(
corner_end
.
y
);
corners_buffer
.
push_back
(
corner_end
.
y
);
/* add the radius lines */
corner
.
x
=
corner
.
y
=
aThermalGap
/
2
;
corners_buffer
.
push_back
(
corner
.
x
);
corners_buffer
.
push_back
(
corner
.
y
);
// Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg
// Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg
angle
=
0
;
angle
=
0
;
for
(
unsigned
ihole
=
0
;
ihole
<
4
;
ihole
++
)
for
(
unsigned
ihole
=
0
;
ihole
<
4
;
ihole
++
)
...
@@ -340,38 +335,41 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
...
@@ -340,38 +335,41 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
case
PAD_OVAL
:
case
PAD_OVAL
:
case
PAD_RECT
:
// draw 4 Holes
case
PAD_RECT
:
// draw 4 Holes
{
{
// First, create an hole like:
/* we create 4 copper holes and put them in position 1, 2, 3 and 4
// 1 ------- 2
* here is the area of the rectangular pad + its thermal gap
// 0 ----- |
* the 4 copper holes remove the copper in order to create the thermal gap
// 5 | |
* 4 ------ 1
* | |
* | |
* | |
* | |
* 3 ------ 2
* hole 3 is the same as hole 1, rotated 180 deg
* hole 4 is the same as hole 2, rotated 180 deg and is the same as hole 1, mirrored
*/
// First, create a rectangular hole for position 1 :
// 2 ------- 3
// | |
// | |
// | |
// 4 | | 3
// | |
wxPoint
corners_hole
[
6
];
// buffer for 6 corners
// 1 ------- 4
wxPoint
corners_hole
[
4
];
// buffer for 6 corners
// Create 1 hole, for a pad centered at0,0, orient 0
// Create 1 hole, for a pad centered at0,0, orient 0
// Calculate coordinates for corner
0 to corner 5
:
// Calculate coordinates for corner
1 to corner 4
:
corners_hole
[
0
]
=
wxPoint
(
(
copper_tickness
.
x
/
2
),
-
dy
);
corners_hole
[
0
]
=
wxPoint
(
copper_tickness
.
x
/
2
,
-
copper_tickness
.
x
/
2
);
corners_hole
[
1
]
=
wxPoint
(
(
copper_tickness
.
x
/
2
),
-
dy
-
aThermalGap
);
corners_hole
[
1
]
=
wxPoint
(
(
copper_tickness
.
x
/
2
),
-
dy
-
aThermalGap
);
corners_hole
[
2
]
=
wxPoint
(
dx
+
aThermalGap
,
-
dy
-
aThermalGap
);
corners_hole
[
2
]
=
wxPoint
(
dx
+
aThermalGap
,
-
dy
-
aThermalGap
);
corners_hole
[
3
]
=
wxPoint
(
dx
+
aThermalGap
,
-
(
copper_tickness
.
y
/
2
)
);
corners_hole
[
3
]
=
wxPoint
(
dx
+
aThermalGap
,
-
(
copper_tickness
.
y
/
2
)
);
corners_hole
[
4
]
=
wxPoint
(
dx
,
-
(
copper_tickness
.
y
/
2
)
);
corners_hole
[
5
]
=
wxPoint
(
dx
,
-
dy
);
/* Create 2 holes, rotated by pad rotation.
/* Create 2 holes, rotated by pad rotation.
* corners_hole[6] is the hole 1
* hole 3 is the same as hole 1, rotated 180 deg
* 4 ------ 1
* | |
* | |
* | |
* | |
* 3 ------ 2
*/
*/
angle
=
aPad
.
m_Orient
;
angle
=
aPad
.
m_Orient
;
for
(
int
irect
=
0
;
irect
<
2
;
irect
++
)
for
(
int
irect
=
0
;
irect
<
2
;
irect
++
)
{
{
if
(
aBooleng
->
StartPolygonAdd
(
GROUP_B
)
)
if
(
aBooleng
->
StartPolygonAdd
(
GROUP_B
)
)
{
{
for
(
int
ic
=
0
;
ic
<
6
;
ic
++
)
for
(
int
ic
=
0
;
ic
<
4
;
ic
++
)
{
{
wxPoint
cpos
=
corners_hole
[
ic
];
wxPoint
cpos
=
corners_hole
[
ic
];
RotatePoint
(
&
cpos
,
angle
);
RotatePoint
(
&
cpos
,
angle
);
...
@@ -386,19 +384,11 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
...
@@ -386,19 +384,11 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
}
}
}
}
// Create a holes, like:
// Create a holes, that is the mirrored of the previous hole
// -------
// | -----
// | |
// | |
// | |
// this is the mirrored of the previous hole
corners_hole
[
0
].
x
=
-
corners_hole
[
0
].
x
;
corners_hole
[
0
].
x
=
-
corners_hole
[
0
].
x
;
corners_hole
[
1
].
x
=
-
corners_hole
[
1
].
x
;
corners_hole
[
1
].
x
=
-
corners_hole
[
1
].
x
;
corners_hole
[
2
].
x
=
-
corners_hole
[
2
].
x
;
corners_hole
[
2
].
x
=
-
corners_hole
[
2
].
x
;
corners_hole
[
3
].
x
=
-
corners_hole
[
3
].
x
;
corners_hole
[
3
].
x
=
-
corners_hole
[
3
].
x
;
corners_hole
[
4
].
x
=
-
corners_hole
[
4
].
x
;
corners_hole
[
5
].
x
=
-
corners_hole
[
5
].
x
;
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
angle
=
aPad
.
m_Orient
;
angle
=
aPad
.
m_Orient
;
...
@@ -406,7 +396,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
...
@@ -406,7 +396,7 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
{
{
if
(
aBooleng
->
StartPolygonAdd
(
GROUP_B
)
)
if
(
aBooleng
->
StartPolygonAdd
(
GROUP_B
)
)
{
{
for
(
int
ic
=
0
;
ic
<
6
;
ic
++
)
for
(
int
ic
=
0
;
ic
<
4
;
ic
++
)
{
{
wxPoint
cpos
=
corners_hole
[
ic
];
wxPoint
cpos
=
corners_hole
[
ic
];
RotatePoint
(
&
cpos
,
angle
);
RotatePoint
(
&
cpos
,
angle
);
...
...
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