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
41e044c0
Commit
41e044c0
authored
Dec 19, 2014
by
Nick Østergaard
Committed by
Wayne Stambaugh
Dec 19, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle arcs in board outline in Eagle pluging.
parent
bb7a74f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
17 deletions
+42
-17
eagle_plugin.cpp
pcbnew/eagle_plugin.cpp
+42
-17
No files found.
pcbnew/eagle_plugin.cpp
View file @
41e044c0
...
...
@@ -49,7 +49,6 @@ our error message.
Load() TODO's
*) verify zone fill clearances are correct
*) there is a problem with ARC line segments
*/
...
...
@@ -1058,6 +1057,26 @@ static inline unsigned long timeStamp( CPTREE& aTree )
}
/// Convert an Eagle curve end to a KiCad center for S_ARC
wxPoint
kicad_arc_center
(
wxPoint
start
,
wxPoint
end
,
double
angle
)
{
// Eagle give us start and end.
// S_ARC wants start to give the center, and end to give the start.
double
dx
=
end
.
x
-
start
.
x
,
dy
=
end
.
y
-
start
.
y
;
wxPoint
mid
=
(
start
+
end
)
/
2
;
double
dlen
=
sqrt
(
dx
*
dx
+
dy
*
dy
);
double
dist
=
dlen
/
(
2
*
tan
(
DEG2RAD
(
angle
)
/
2
)
);
wxPoint
center
(
mid
.
x
+
dist
*
(
dy
/
dlen
),
mid
.
y
-
dist
*
(
dx
/
dlen
)
);
return
center
;
}
EAGLE_PLUGIN
::
EAGLE_PLUGIN
()
:
m_rules
(
new
ERULES
()
),
m_xpath
(
new
XPATH
()
),
...
...
@@ -1349,16 +1368,33 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
EWIRE
w
(
gr
->
second
);
LAYER_ID
layer
=
kicad_layer
(
w
.
layer
);
wxPoint
start
(
kicad_x
(
w
.
x1
),
kicad_y
(
w
.
y1
)
);
wxPoint
end
(
kicad_x
(
w
.
x2
),
kicad_y
(
w
.
y2
)
);
int
width
=
kicad
(
w
.
width
);
if
(
layer
!=
UNDEFINED_LAYER
)
{
DRAWSEGMENT
*
dseg
=
new
DRAWSEGMENT
(
m_board
);
m_board
->
Add
(
dseg
,
ADD_APPEND
);
if
(
!
w
.
curve
)
{
dseg
->
SetStart
(
start
);
dseg
->
SetEnd
(
end
);
}
else
{
wxPoint
center
=
kicad_arc_center
(
start
,
end
,
*
w
.
curve
);
dseg
->
SetShape
(
S_ARC
);
dseg
->
SetStart
(
center
);
dseg
->
SetEnd
(
start
);
dseg
->
SetAngle
(
*
w
.
curve
*
-
10.0
);
// KiCad rotates the other way
}
dseg
->
SetTimeStamp
(
timeStamp
(
gr
->
second
)
);
dseg
->
SetLayer
(
layer
);
dseg
->
SetStart
(
wxPoint
(
kicad_x
(
w
.
x1
),
kicad_y
(
w
.
y1
)
)
);
dseg
->
SetEnd
(
wxPoint
(
kicad_x
(
w
.
x2
),
kicad_y
(
w
.
y2
)
)
);
dseg
->
SetWidth
(
kicad
(
w
.
width
)
);
dseg
->
SetWidth
(
width
);
}
m_xpath
->
pop
();
}
...
...
@@ -1949,20 +1985,9 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const
else
{
dwg
=
new
EDGE_MODULE
(
aModule
,
S_ARC
);
// Eagle give us start and end.
// S_ARC wants start to give the centre, and end to give the start
double
dx
=
end
.
x
-
start
.
x
,
dy
=
end
.
y
-
start
.
y
;
wxPoint
mid
=
(
start
+
end
)
/
2
;
double
dlen
=
sqrt
(
dx
*
dx
+
dy
*
dy
);
double
dist
=
dlen
/
(
2
*
tan
(
DEG2RAD
(
*
w
.
curve
)
/
2
)
);
wxPoint
centre
(
mid
.
x
+
dist
*
(
dy
/
dlen
),
mid
.
y
-
dist
*
(
dx
/
dlen
)
);
wxPoint
center
=
kicad_arc_center
(
start
,
end
,
*
w
.
curve
);
dwg
->
SetStart0
(
cent
re
);
dwg
->
SetStart0
(
cent
er
);
dwg
->
SetEnd0
(
start
);
dwg
->
SetAngle
(
*
w
.
curve
*
-
10.0
);
// KiCad rotates the other way
}
...
...
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