hpgl-viewer v1.0.0
HPGLViewer
Javascript HPGL viewer using HTML5 Canvas.
Warning: This is an early release, only a handful of HPGL code is handled. If you would like to contribute, please do !
The code (as well as the doc) is really simple and straightforward for now, the idea is to see if there are people interested in a library to use in their own project, or just in an online viewer, or no one is interested because HPGL is sooo old.
Demo
https://drskullster.github.io/HPGLViewer/demo
Usage
Create a HTML Canvas element in your HTML page :
<canvas id="hpgl-viewer"></canvas>Download HPGLViewer.js file in src/ folder
then initialize with :
var hpglViewer = new HPGLViewer({
container: "hpgl-viewer", // ID of the HTML Canvas element
canvasWidth: 900, // in px
machineTravelWidth: 416, // in mm
machineTravelHeight: 259 // in mm
});Feed HPGL content to viewer :
hpglViewer.draw("PU0,0;PD4000,4000;")Development
Library is packaged into a UMD module with webpack.
You can run a development server that will watch changes
and reload the demo page with npm run dev.
HPGL Commands
Done
PUPen Up (simply move on canvas)PDPen DownPAPlot with absolute coordinatesAAArcSPPen Select
Ignored
INInitializeVSspeed select
Todo
CPand other Text related commandsCICirclesPRPosition relative to next point ?IPandSCmachine scale ?
Reference
See here for a list of HPGL commands :
7 years ago