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
a26e59d8
Commit
a26e59d8
authored
May 01, 2013
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pass round boards to freerouter via specctra_export
parent
d55ab920
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
122 additions
and
106 deletions
+122
-106
specctra_export.cpp
pcbnew/specctra_export.cpp
+122
-106
No files found.
pcbnew/specctra_export.cpp
View file @
a26e59d8
...
...
@@ -855,6 +855,38 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia )
}
/**
* Function makeCircle
* does a line segmented circle into aPath.
*/
static
void
makeCircle
(
PATH
*
aPath
,
DRAWSEGMENT
*
aGraphic
)
{
// do a circle segmentation
const
int
STEPS
=
2
*
36
;
wxPoint
start
;
wxPoint
center
=
aGraphic
->
GetCenter
();
int
radius
=
aGraphic
->
GetRadius
();
double
angle
=
3600.0
;
start
=
center
;
start
.
x
+=
radius
;
wxPoint
nextPt
;
for
(
int
step
=
0
;
step
<
STEPS
;
++
step
)
{
double
rotation
=
(
angle
*
step
)
/
STEPS
;
nextPt
=
start
;
RotatePoint
(
&
nextPt
.
x
,
&
nextPt
.
y
,
center
.
x
,
center
.
y
,
rotation
);
aPath
->
AppendPoint
(
mapPt
(
nextPt
)
);
}
}
void
SPECCTRA_DB
::
fillBOUNDARY
(
BOARD
*
aBoard
,
BOUNDARY
*
boundary
)
throw
(
IO_ERROR
)
{
TYPE_COLLECTOR
items
;
...
...
@@ -948,10 +980,18 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
break
;
case
S_CIRCLE
:
// Freerouter does not understand circles.
// This might be a mounting hole or something, ignore it without error
// because some of our demo boards have used the edges pcb layer to
// hold islanded circles, rather than simply using holes.
{
wxPoint
pt
=
graphic
->
GetCenter
();
// pt has minimum x point
pt
.
x
-=
graphic
->
GetRadius
();
if
(
pt
.
x
<
xmin
.
x
)
{
xmin
=
pt
;
xmini
=
i
;
}
}
break
;
default
:
...
...
@@ -974,6 +1014,17 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
// The first DRAWSEGMENT is in 'graphic', ok to remove it from 'items'
items
.
Remove
(
xmini
);
// Set maximum proximity threshold for point to point nearness metric for
// board perimeter only, not interior keepouts yet.
prox
=
Mils2iu
(
0
);
// Output the Edge.Cuts perimeter as circle or polygon.
if
(
graphic
->
GetShape
()
==
S_CIRCLE
)
{
makeCircle
(
path
,
graphic
);
}
else
{
wxPoint
startPt
=
wxPoint
(
graphic
->
GetEnd
()
);
prevPt
=
graphic
->
GetEnd
();
...
...
@@ -982,11 +1033,6 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
// Do not append the other end point yet of this 'graphic', this first
// 'graphic' might be an arc.
// Set maximum proximity threshold for point to point nearness metric for
// board perimeter only, not interior keepouts yet.
prox
=
Mils2iu
(
0
);
// Output the Edge.Cuts perimeter polygon.
for
(;;)
{
switch
(
graphic
->
GetShape
()
)
...
...
@@ -1048,15 +1094,6 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
}
break
;
case
S_CIRCLE
:
// Freerouter does not understand circles. And although we can mimic
// a circle for it by line segments, we'd have to ensure that the circle
// was the only graphic on the board's edge. @todo that.
//
// Tell user his board has a problem, this is better than silently
// ignoring the error.
// fall thru here to report the error.
default
:
{
wxString
error
=
wxString
::
Format
(
_
(
"Unsupported DRAWSEGMENT type %s"
),
...
...
@@ -1082,6 +1119,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
ThrowIOError
(
error
);
}
}
}
// Output the interior Edge.Cuts graphics as keepouts, using nearness metric
// for sloppy graphical items.
...
...
@@ -1101,29 +1139,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
if
(
graphic
->
GetShape
()
==
S_CIRCLE
)
{
// do a circle segmentation
const
int
STEPS
=
36
;
wxPoint
start
;
wxPoint
center
=
graphic
->
GetCenter
();
int
radius
=
graphic
->
GetRadius
();
double
angle
=
3600.0
;
start
=
center
;
start
.
x
+=
radius
;
wxPoint
nextPt
;
for
(
int
step
=
0
;
step
<
STEPS
;
++
step
)
{
double
rotation
=
(
angle
*
step
)
/
STEPS
;
nextPt
=
start
;
RotatePoint
(
&
nextPt
.
x
,
&
nextPt
.
y
,
center
.
x
,
center
.
y
,
rotation
);
poly_ko
->
AppendPoint
(
mapPt
(
nextPt
)
);
}
makeCircle
(
poly_ko
,
graphic
);
}
else
{
...
...
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