← Back to team overview

kicad-developers team mailing list archive

Re: HPGL

 

If you can, apply this patch and test it.

As a minimum, comment on it.

"The angle" should be better described using an actual variable name or expression, if the
clamping is still and issue.




On 02/01/2013 02:52 PM, Andreas Beutling wrote:
> Hello,
>
> some errors in common_plotHPGL_functions.cpp:
>
> Line 481-481 in FlashPadCircle:
>
>      fprintf( outputFile, "PA %.0f,%.0fd;CI %.0f;\n",
>               pos_dev.x, pos_dev.y, rsize );
>
> The "d" is wrong, generates a HPGL syntax error for circles.
>
> Line 402-402 in Arc:
>
>      cmap.x  = (int) ( centre.x + ( radius * cos( RAD2DEG( StAngle / 
> 10.0 ) ) ) );
>      cmap.y  = (int) ( centre.y - ( radius * sin( RAD2DEG( StAngle / 
> 10.0 ) ) ) );
>
> RAD2DEG is wrong, it must be DEG2RAD. The angle should be restricted to 
> -180/+179 degrees.
>
> Regards, Andreas
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>

=== modified file 'common/common_plotHPGL_functions.cpp'
--- common/common_plotHPGL_functions.cpp	2012-10-13 18:54:33 +0000
+++ common/common_plotHPGL_functions.cpp	2013-02-01 21:13:44 +0000
@@ -399,8 +399,8 @@
 
     // Calculate start point,
     wxPoint cmap;
-    cmap.x  = (int) ( centre.x + ( radius * cos( RAD2DEG( StAngle / 10.0 ) ) ) );
-    cmap.y  = (int) ( centre.y - ( radius * sin( RAD2DEG( StAngle / 10.0 ) ) ) );
+    cmap.x  = (int) ( centre.x + ( radius * cos( DEG2RAD( StAngle / 10.0 ) ) ) );
+    cmap.y  = (int) ( centre.y - ( radius * sin( DEG2RAD( StAngle / 10.0 ) ) ) );
     DPOINT  cmap_dev = userToDeviceCoordinates( cmap );
 
     fprintf( outputFile,
@@ -478,7 +478,7 @@
 
     double rsize = userToDeviceSize( radius );
 
-    fprintf( outputFile, "PA %.0f,%.0fd;CI %.0f;\n",
+    fprintf( outputFile, "PA %.0f,%.0f;CI %.0f;\n",
              pos_dev.x, pos_dev.y, rsize );
 
     if( trace_mode == FILLED )        // Plot in filled mode.


Follow ups

References