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
5a6c088b
Commit
5a6c088b
authored
Jul 15, 2012
by
Marco Mattila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use circular interpolation for circles and arcs in pcbnew gerber plots.
parent
f20bf0d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
17 deletions
+27
-17
common_plotGERBER_functions.cpp
common/common_plotGERBER_functions.cpp
+25
-17
plot_common.h
include/plot_common.h
+2
-0
No files found.
common/common_plotGERBER_functions.cpp
View file @
5a6c088b
...
@@ -274,27 +274,35 @@ void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
...
@@ -274,27 +274,35 @@ void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
}
}
void
GERBER_PLOTTER
::
Circle
(
const
wxPoint
&
aCent
re
,
int
aDiameter
,
FILL_T
aFill
,
void
GERBER_PLOTTER
::
Circle
(
const
wxPoint
&
aCent
er
,
int
aDiameter
,
FILL_T
aFill
,
int
aWidth
)
int
aWidth
)
{
{
wxASSERT
(
outputFile
);
Arc
(
aCenter
,
0
,
3600
,
aDiameter
/
2
,
aFill
,
aWidth
);
wxPoint
start
,
end
;
}
double
radius
=
aDiameter
/
2
;
const
int
delta
=
3600
/
32
;
/* increment (in 0.1 degrees) to draw circles */
start
.
x
=
aCentre
.
x
+
KiROUND
(
radius
);
void
GERBER_PLOTTER
::
Arc
(
const
wxPoint
&
aCenter
,
int
aStAngle
,
int
aEndAngle
,
start
.
y
=
aCentre
.
y
;
int
aRadius
,
FILL_T
aFill
,
int
aWidth
)
{
wxASSERT
(
outputFile
);
wxPoint
start
,
end
;
start
.
x
=
aCenter
.
x
+
KiROUND
(
aRadius
*
cos
(
DEG2RAD
(
aStAngle
/
10.0
)
)
);
start
.
y
=
aCenter
.
y
-
KiROUND
(
aRadius
*
sin
(
DEG2RAD
(
aStAngle
/
10.0
)
)
);
SetCurrentLineWidth
(
aWidth
);
SetCurrentLineWidth
(
aWidth
);
MoveTo
(
start
);
MoveTo
(
start
);
end
.
x
=
aCenter
.
x
+
KiROUND
(
aRadius
*
cos
(
DEG2RAD
(
aEndAngle
/
10.0
)
)
);
for
(
int
ii
=
delta
;
ii
<
3600
;
ii
+=
delta
)
end
.
y
=
aCenter
.
y
-
KiROUND
(
aRadius
*
sin
(
DEG2RAD
(
aEndAngle
/
10.0
)
)
);
{
DPOINT
devEnd
=
userToDeviceCoordinates
(
end
);
end
.
x
=
aCentre
.
x
+
(
int
)
(
radius
*
cos
(
DEG2RAD
(
ii
/
10.0
)
)
);
DPOINT
devCenter
=
userToDeviceCoordinates
(
aCenter
-
start
);
end
.
y
=
aCentre
.
y
+
(
int
)
(
radius
*
sin
(
DEG2RAD
(
ii
/
10.0
)
)
);
fprintf
(
outputFile
,
"G75*
\n
"
);
// Multiquadrant mode
LineTo
(
end
);
}
if
(
aStAngle
<
aEndAngle
)
fprintf
(
outputFile
,
"G03"
);
FinishTo
(
start
);
else
fprintf
(
outputFile
,
"G02"
);
fprintf
(
outputFile
,
"X%dY%dI%dJ%dD01*
\n
"
,
int
(
devEnd
.
x
),
int
(
devEnd
.
y
),
int
(
devCenter
.
x
),
int
(
devCenter
.
y
)
);
fprintf
(
outputFile
,
"G74*
\n
G01*
\n
"
);
// Back to single quadrant and linear interp.
}
}
...
...
include/plot_common.h
View file @
5a6c088b
...
@@ -679,6 +679,8 @@ public:
...
@@ -679,6 +679,8 @@ public:
int
width
=
-
1
);
int
width
=
-
1
);
virtual
void
Circle
(
const
wxPoint
&
pos
,
int
diametre
,
FILL_T
fill
,
virtual
void
Circle
(
const
wxPoint
&
pos
,
int
diametre
,
FILL_T
fill
,
int
width
=
-
1
);
int
width
=
-
1
);
virtual
void
Arc
(
const
wxPoint
&
aCenter
,
int
aStAngle
,
int
aEndAngle
,
int
aRadius
,
FILL_T
aFill
,
int
aWidth
=
-
1
);
virtual
void
PlotPoly
(
const
std
::
vector
<
wxPoint
>&
aCornerList
,
virtual
void
PlotPoly
(
const
std
::
vector
<
wxPoint
>&
aCornerList
,
FILL_T
aFill
,
int
aWidth
=
-
1
);
FILL_T
aFill
,
int
aWidth
=
-
1
);
...
...
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