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
c3ecce2e
Commit
c3ecce2e
authored
Sep 18, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eescheam: plot HPGL: add comments and minor fix.
parent
5590e1eb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
252 additions
and
72 deletions
+252
-72
common_plotHPGL_functions.cpp
common/common_plotHPGL_functions.cpp
+250
-70
dialog_plot_schematic.cpp
eeschema/dialogs/dialog_plot_schematic.cpp
+1
-1
plot_schematic_HPGL.cpp
eeschema/plot_schematic_HPGL.cpp
+1
-1
No files found.
common/common_plotHPGL_functions.cpp
View file @
c3ecce2e
...
...
@@ -7,6 +7,164 @@
* strokes to fill the shape
*/
/* Some HPGL commands:
* Note: the HPGL unit is 25 micrometers
* All commands MUST be terminated by a semi-colon or a linefeed.
* Spaces can NOT be substituted for required commas in the syntax of a command.
*
*
* AA (Arc Absolute): Angle is a floating point # (requires non integer value)
* Draws an arc with the center at (X,Y).
* A positive angle creates a counter-clockwise arc.
* If the chord angle is specified,
* this will be the number of degrees used for stepping around the arc.
* If no value is given then a default value of five degrees is used.
* AA x, y, a {,b};
*
* AR (Arc Relative):
* AR Dx, Dy, a {, b};
*
* CA (Alternate Character Set):
* CA {n};
*
* CI (Circle):
* CI r {,b};
*
* CP (Character Plot):
* CP {h, v};
* h [-127.9999 .. 127.9999] Anzahl der Zeichen horizontal
* v [-127.9999 .. 127.9999] Anzahl der Zeichen vertikal
*
* CS (Standard Character Set):
* CS {n};
*
* DR (Relative Direction for Label Text):
* DR s, a;
*
* DI (Absolute Direction for Label Text):
* DI {s, a};
*
* DT (Define Terminator - this character becomes unavailable except to terminate a label string.
* Default is ^C control-C):
* DT t;
*
* EA (rEctangle Absolute - Unfilled, from current position to diagonal x,y):
* EA x, y;
*
* ER (rEctangle Relative - Unfilled, from current position to diagonal x,y):
* ER x,y;
*
* FT (Fill Type):
* FT {s {,l {a}}};
*
* IM (Input Mask):
* IM {f};
*
* IN (Initialize): This command instructs the controller to begin processing the HPGL plot file.
* Without this, the commands in the file are received but never executed.
* If multiple IN s are found during execution of the file,
* the controller performs a Pause/Cancel operation.
* All motion from the previous job, yet to be executed, is lost,
* and the new information is executed.
* IN;
*
* IP Input P1 and P2:
* IP {P1x, P1y {, P2x, P2y}};
*
* IW (Input Window):
* IW {XUL, YUL, XOR, YOR};
*
* LB (Label):
* LB c1 .. cn t;
*
* PA (Plot Absolute): Moves to an absolute HPGL position and sets absolute mode for
* future PU and PD commands. If no arguments follow the command,
* only absolute mode is set.
* PA {x1, y1 {{PU|PD|,} ..., ..., xn, yn}};
* P1x, P1y, P2x, P2y [Integer in ASCII]
*
* PD (Pen Down): Executes <current pen> pen then moves to the requested position
* if one is specified. This position is dependent on whether absolute
* or relative mode is set. This command performs no motion in 3-D mode,
* but the outputs and feedrates are affected.
* PD {x, y};
*
* PR (Plot Relative): Moves to the relative position specified and sets relative mode
* for future PU and PD commands.
* If no arguments follow the command, only relative mode is set.
* PR {Dx1, Dy1 {{PU|PD|,} ..., ..., Dxn, Dyn}};
*
* PS (Paper Size):
* PS {n};
*
* PT (Pen Thickness):
* PT {l};
*
* PU (Pen Up): Executes <current pen> pen then moves to the requested position
* if one is specified. This position is dependent on whether absolute
* or relative mode is set.
* This command performs no motion in 3-D mode, but the outputs
* and feedrates are affected.
* PU {x, y};
*
* RA (Rectangle Absolute - Filled, from current position to diagonal x,y):
* RA x, y;
*
* RO (Rotate Coordinate System):
* RO;
*
* RR (Rectangle Relative - Filled, from current position to diagonal x,y):
* RR x, y;
*
* SA (Select Alternate Set):
* SA;
*
* SC (Scale):
* SC {Xmin, Xmax, Ymin, Ymax};
*
* SI (Absolute Character Size):
* SI b, h;
* b [-127.9999 .. 127.9999, keine 0]
* h [-127.9999 .. 127.9999, keine 0]
*
* SL (Character Slant):
* SL {a};
* a [-3.5 .. -0.5, 0.5 .. 3.5]
*
* SP (Select Pen): Selects a new pen or tool for use.
* If no pen number or a value of zero is given,
* the controller performs an EOF (end of file command).
* Once an EOF is performed, no motion is executed,
* until a new IN command is received.
* SP n;
*
* SR (Relative Character Size):
* SR {b, h};
* b [-127.9999 .. 127.9999, keine 0]
* h [-127.9999 .. 127.9999, keine 0]
*
* SS (Select Standard Set):
* SS;
*
* TL (Tick Length):
* TL {tp {, tm}};
*
* UC (User Defined Character):
* UC {i,} x1, y1, {i,} x2, y2, ... {i,} xn, yn;
*
* VS (Velocity Select):
* VS {v {, n}};
* v [1 .. 40]
* n [1 .. 8, je nach Ausstattung]
*
* XT (X Tick):
* XT;
*
* YT (Y Tick):
* YT;
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <trigo.h>
...
...
@@ -16,7 +174,7 @@
#include <macros.h>
#include <kicad_string.h>
// HPGL scale factor (1 PLU = 1/40mm
IIRC
)
// HPGL scale factor (1 PLU = 1/40mm
= 25 micrometers
)
static
const
double
PLUsPERDECIMIL
=
0.102041
;
...
...
@@ -36,6 +194,7 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
plotMirror
=
aMirror
;
}
/**
* At the start of the HPGL plot pen speed and number are requested
*/
...
...
@@ -47,6 +206,7 @@ bool HPGL_PLOTTER::StartPlot( FILE* fout )
return
true
;
}
/**
* HPGL end of plot: pen return and release
*/
...
...
@@ -59,6 +219,7 @@ bool HPGL_PLOTTER::EndPlot()
return
true
;
}
/**
* HPGL rectangle: fill not supported
*/
...
...
@@ -93,13 +254,14 @@ void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill,
/**
* HPGL polygon: fill not supported (but closed, at least)
*/
void
HPGL_PLOTTER
::
PlotPoly
(
const
std
::
vector
<
wxPoint
>&
aCornerList
,
FILL_T
aFill
,
int
aWidth
)
void
HPGL_PLOTTER
::
PlotPoly
(
const
std
::
vector
<
wxPoint
>&
aCornerList
,
FILL_T
aFill
,
int
aWidth
)
{
if
(
aCornerList
.
size
()
<=
1
)
return
;
MoveTo
(
aCornerList
[
0
]
);
for
(
unsigned
ii
=
1
;
ii
<
aCornerList
.
size
();
ii
++
)
LineTo
(
aCornerList
[
ii
]
);
...
...
@@ -107,9 +269,11 @@ void HPGL_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
if
(
aFill
)
{
int
ii
=
aCornerList
.
size
()
-
1
;
if
(
aCornerList
[
ii
]
!=
aCornerList
[
0
]
)
LineTo
(
aCornerList
[
0
]
);
}
PenFinish
();
}
...
...
@@ -120,22 +284,27 @@ void HPGL_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
void
HPGL_PLOTTER
::
penControl
(
char
plume
)
{
wxASSERT
(
outputFile
);
switch
(
plume
)
{
case
'U'
:
if
(
penState
!=
'U'
)
{
fputs
(
"PU;"
,
outputFile
);
penState
=
'U'
;
}
break
;
case
'D'
:
if
(
penState
!=
'D'
)
{
fputs
(
"PD;"
,
outputFile
);
penState
=
'D'
;
}
break
;
case
'Z'
:
...
...
@@ -174,6 +343,7 @@ void HPGL_PLOTTER::PenTo( const wxPoint& pos, char plume )
void
HPGL_PLOTTER
::
SetDash
(
bool
dashed
)
{
wxASSERT
(
outputFile
);
if
(
dashed
)
fputs
(
"LI 2;
\n
"
,
outputFile
);
else
...
...
@@ -256,9 +426,11 @@ void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int or
if
(
size
.
x
>
size
.
y
)
{
EXCHG
(
size
.
x
,
size
.
y
);
orient
+=
900
;
if
(
orient
>=
3600
)
orient
-=
3600
;
}
deltaxy
=
size
.
y
-
size
.
x
;
// distance between centers of the oval
if
(
trace_mode
==
FILLED
)
...
...
@@ -317,6 +489,7 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
}
}
}
PenFinish
();
}
...
...
@@ -340,6 +513,7 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
if
(
size
.
x
<
0
)
size
.
x
=
0
;
if
(
size
.
y
<
0
)
size
.
y
=
0
;
...
...
@@ -356,6 +530,7 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
FinishTo
(
wxPoint
(
fx
,
fy
)
);
return
;
}
if
(
size
.
y
==
0
)
{
ox
=
pos
.
x
-
size
.
x
;
...
...
@@ -404,6 +579,7 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
if
(
size
.
x
<
0
)
size
.
x
=
0
;
if
(
size
.
y
<
0
)
size
.
y
=
0
;
...
...
@@ -430,11 +606,12 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
FinishTo
(
wxPoint
(
ox
,
oy
)
);
}
}
}
void
HPGL_PLOTTER
::
FlashPadTrapez
(
const
wxPoint
&
aPadPos
,
const
wxPoint
*
aCorners
,
void
HPGL_PLOTTER
::
FlashPadTrapez
(
const
wxPoint
&
aPadPos
,
const
wxPoint
*
aCorners
,
int
aPadOrient
,
EDA_DRAW_MODE_T
aTrace_Mode
)
{
wxASSERT
(
outputFile
);
...
...
@@ -459,6 +636,7 @@ void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorne
RotatePoint
(
&
coord
[
ii
],
aPadOrient
);
coord
[
ii
]
+=
aPadPos
;
}
MoveTo
(
coord
[
0
]
);
LineTo
(
coord
[
1
]
);
LineTo
(
coord
[
2
]
);
...
...
@@ -500,22 +678,25 @@ void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorne
// Test for crossed vertexes.
if
(
polygone
[
0
].
x
>
polygone
[
3
].
x
)
/* X axis intersection on
*
vertexes 0 and 3 */
*
vertexes 0 and 3 */
{
polygone
[
0
].
x
=
polygone
[
3
].
x
=
0
;
}
if
(
polygone
[
1
].
x
>
polygone
[
2
].
x
)
/* X axis intersection on
*
vertexes 1 and 2 */
*
vertexes 1 and 2 */
{
polygone
[
1
].
x
=
polygone
[
2
].
x
=
0
;
}
if
(
polygone
[
1
].
y
>
polygone
[
0
].
y
)
/* Y axis intersection on
*
vertexes 0 and 1 */
*
vertexes 0 and 1 */
{
polygone
[
0
].
y
=
polygone
[
1
].
y
=
0
;
}
if
(
polygone
[
2
].
y
>
polygone
[
3
].
y
)
/* Y axis intersection on
*
vertexes 2 and 3 */
*
vertexes 2 and 3 */
{
polygone
[
2
].
y
=
polygone
[
3
].
y
=
0
;
}
...
...
@@ -535,4 +716,3 @@ void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorne
}
}
}
eeschema/dialogs/dialog_plot_schematic.cpp
View file @
c3ecce2e
...
...
@@ -88,7 +88,7 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
// Set plot or not frame reference option
m_config
->
Read
(
PLOT_FRAME_REFERENCE_KEY
,
&
tmp
,
true
);
setPlotFrameRef
(
t
rue
);
setPlotFrameRef
(
t
mp
);
// Set HPGL plot origin to center of paper of left bottom corner
m_config
->
Read
(
PLOT_HPGL_ORIGIN_KEY
,
&
tmp
,
false
);
...
...
eeschema/plot_schematic_HPGL.cpp
View file @
c3ecce2e
...
...
@@ -170,7 +170,7 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll )
if
(
GetPlotOriginCenter
()
)
{
plotOffset
.
x
=
-
plotPage
.
GetWidthIU
()
/
2
;
plotOffset
.
x
=
plotPage
.
GetWidthIU
()
/
2
;
plotOffset
.
y
=
-
plotPage
.
GetHeightIU
()
/
2
;
}
...
...
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