HPGL plot dialog: remove no more in use Pen Overlap parameter. Fix incorrect polygon fill by setting the hpgl pen thickness in hpgl file. Add filled circle (previously, a circle was never filled)
This commit is contained in:
@@ -126,7 +126,7 @@
|
||||
* PS (Paper Size):
|
||||
* PS {n};
|
||||
*
|
||||
* PT (Pen Thickness):
|
||||
* PT (Pen Thickness): in mm
|
||||
* PT {l};
|
||||
*
|
||||
* PU (Pen Up): Executes <current pen> pen then moves to the requested position
|
||||
@@ -183,7 +183,7 @@
|
||||
*
|
||||
* VS (Velocity Select):
|
||||
* VS {v {, n}};
|
||||
* v [1 .. 40]
|
||||
* v [1 .. 40] in cm/s
|
||||
* n [1 .. 8]
|
||||
*
|
||||
* XT (X Tick):
|
||||
@@ -204,6 +204,12 @@
|
||||
#include <kicad_string.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
|
||||
// The hpgl command to close a polygon def, fill it and plot outline:
|
||||
// PM 2; ends the polygon definition and closes it if not closed
|
||||
// FP; fills the polygon
|
||||
// EP; draws the polygon outline. It usually gives a better look to the filled polygon
|
||||
static const char hpgl_end_polygon_cmd[] = "PM 2; FP; EP;\n";
|
||||
|
||||
// HPGL scale factor (1 PLU = 1/40mm = 25 micrometers)
|
||||
static const double PLUsPERDECIMIL = 0.102041;
|
||||
|
||||
@@ -212,7 +218,6 @@ HPGL_PLOTTER::HPGL_PLOTTER()
|
||||
SetPenSpeed( 40 ); // Default pen speed = 40 cm/s; Pen speed is *always* in cm
|
||||
SetPenNumber( 1 ); // Default pen num = 1
|
||||
SetPenDiameter( 0.0 );
|
||||
SetPenOverlap( 0.0 );
|
||||
}
|
||||
|
||||
void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||
@@ -239,6 +244,11 @@ bool HPGL_PLOTTER::StartPlot()
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
fprintf( outputFile, "IN;VS%d;PU;PA;SP%d;\n", penSpeed, penNumber );
|
||||
|
||||
// Set HPGL Pen Thickness (in mm) (usefull in polygon fill command)
|
||||
double penThicknessMM = userToDeviceSize( penDiameter )/40;
|
||||
fprintf( outputFile, "PT %.1f;\n", penThicknessMM );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -256,6 +266,11 @@ bool HPGL_PLOTTER::EndPlot()
|
||||
}
|
||||
|
||||
|
||||
void HPGL_PLOTTER::SetPenDiameter( double diameter )
|
||||
{
|
||||
penDiameter = diameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* HPGL rectangle: fill not supported
|
||||
*/
|
||||
@@ -269,14 +284,22 @@ void HPGL_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* HPGL circle: fill not supported
|
||||
*/
|
||||
// HPGL circle
|
||||
void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill,
|
||||
int width )
|
||||
{
|
||||
wxASSERT( outputFile );
|
||||
double radius = userToDeviceSize( diameter / 2 );
|
||||
SetCurrentLineWidth( width );
|
||||
|
||||
if( fill == FILLED_SHAPE )
|
||||
{
|
||||
// Draw the filled area
|
||||
MoveTo( centre );
|
||||
fprintf( outputFile, "PM 0; CI %g;\n", radius );
|
||||
fprintf( outputFile, hpgl_end_polygon_cmd ); // Close, fill polygon and draw outlines
|
||||
PenFinish();
|
||||
}
|
||||
|
||||
if( radius > 0 )
|
||||
{
|
||||
@@ -314,7 +337,7 @@ void HPGL_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
|
||||
if( aCornerList[ii] != aCornerList[0] )
|
||||
LineTo( aCornerList[0] );
|
||||
|
||||
fprintf( outputFile, "PM 2; FP; EP;\n" ); // Close, fill polygon and draw outlines
|
||||
fprintf( outputFile, hpgl_end_polygon_cmd ); // Close, fill polygon and draw outlines
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -536,8 +559,8 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
|
||||
// Gives a correct current starting point for the circle
|
||||
MoveTo( wxPoint( pos.x+radius, pos.y ) );
|
||||
// Plot filled area and its outline
|
||||
fprintf( outputFile, "PM 0; PA %.0f,%.0f;CI %.0f; PM 2; FP; EP;\n",
|
||||
pos_dev.x, pos_dev.y, rsize );
|
||||
fprintf( outputFile, "PM 0; PA %.0f,%.0f;CI %.0f;%s",
|
||||
pos_dev.x, pos_dev.y, rsize, hpgl_end_polygon_cmd );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user