HPGL formatting? Errors? - Page 1
Forum section: electronics / general

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 14, 2020, 09:50:57 am
content: Does this parse or decode for you? What did you use?Code:CS;PU;SP1;SR1.042,1.563;PU;PA50,41;PD;PA551,41,551,418,50,418,50,41;PU;PA100,41;PD;PA100,418;PU;PA150,418;PD;PA150,41;PU;PA200,41;PD;PA200,418;PU;PA250,418;PD;PA250,41;PU;PA301,41;PD;PA301,418;PU;PA351,418;PD;PA351,41;PU;PA401,41;PD;PA401,418;PU;PA451,418;PD;PA451,41;PU;PA501,41;PD;PA501,418;PU;PA50,88;PD;PA551,88;PU;PA551,136;PD;PA50,136;PU;PA50,183;PD;PA551,183;PU;PA551,230;PD;PA50,230;PU;PA50,277;PD;PA551,277;PU;PA551,324;PD;PA50,324;PU;PA50,371;PD;PA551,371;PU;PA0,452;PD;PA9,465;PU;PA5,459;PD;PA10,459,5,452;PU;PA5,448;PD;PA13,459,18,459,13,452,8,452;PU;PA50,0;LBRES BW 1 MHzPU;PA261,0;LBVBW 3CS3;LB[CS;;LBCS3;LB[CS;;LB kHzPU;PA446,0;LBSWP 2CS3;LB[CS;;LB msecPU;PA150,427;LBATTEN 1CS3;LB[CS;;LB dBPU;PA0,427;LBREF .CS3;LB[CS;;LB dBmPU;PA0,380;LBLOGPU;PA0,380;LB1CS3;LB[CS;;LBPU;PA0,361;LBdB/PU;PA0,19;LBSTART 1CS3;LB[CS;;LBCS3;LB[CS;;LB.CS3;LB[CS;;LB MHzPU;PA411,19;LBSTOP 8CS3;LB[CS;;LBCS3;LB[CS;;LB.CS3;LB[CS;;LB MHzPU;PA431,427;LB -11.44 dBmPU;PA421,446;LBMKR 233.CS3;LB[CS;;LB MHzPU;PA0,403;LBPEAK PU;PA0,154;LBWA SBPU;PA0,154;LBFCPU;PA0,117;LBCORRPU;PA145,364;PD;PA140,372,145,379,150,372,145,364;PU;SP2;PU;PA50,91;PD;PA51,87,53,91,54,91,55,91,56,90,58,89,59,95,60,90,61,88,63,96,64,86,65,90,66,89,68,96,69,91,70,84,71,84,73,82,74,93,75,85,76,86,78,89,79,83,80,91,81,89,83,87,84,83,85,92,86,88,88,95,89,82,90,89,91,85,93,91,94,82,95,90,96,87,98,87,99,87,100,89,101,92,103,97,104,92,105,88,106,89,108,92,109,85,110,83,111,87,113,81,114,95,115,83,116,80,118,90,119,90,120,83,121,95,123,92,124,82,125,78,126,83,128,82,129,95,130,82,132,84,133,84,134,81,135,87,137,88,138,83,139,87,140,87,142,105,143,213,144,345,145,364,147,304,148,206,149,130,150,88,152,89,153,93,154,88,155,83,157,86,158,87,159,88,160,93,162,90,163,82,164,98,165,84,167,94,168,91,169,94,170,101,172,88,173,96,174,83,175,85,177,90,178,88,179,88,180,95,182,95,183,88,184,84,185,89,187,85,188,95,189,79,190,93,192,84,193,87,194,82,195,90,197,80,198,80,199,83,200,90,202,85,203,89,204,84,205,83,207,84,208,91,209,84,210,85,212,79,213,92,214,89,215,79,217,87,218,85,219,79,220,88,222,85,223,93,224,86,225,87,227,86,228,83,229,83,230,91,232,91,233,89,234,85,235,93,237,81,238,89,239,81,240,88,242,93,243,86,244,94,245,89,247,85,248,85,249,87,250,88,252,81,253,90,254,82,255,85,257,90,258,90,259,91,261,90,262,82,263,94,264,83,266,90,267,83,268,90,269,95,271,87,272,86,273,87,274,84,276,88,277,91,278,91,279,95,281,91,282,88,283,84,284,99,286,97,287,92,288,90,289,94,291,92,292,94,293,88,294,82,296,95,297,88,298,92,299,90,301,84,302,86,303,88,304,92,306,204,307,275,308,262,309,153,311,94,312,88,313,90,314,91,316,87,317,92,318,92,319,92,321,98,322,91,323,97,324,87,326,89,327,87,328,94,329,87,331,87,332,96,333,89,334,104,336,92,337,90,338,86,339,84,341,95,342,88,343,90,344,85,346,100,347,89,348,90,349,85,351,92,352,96,353,98,354,92,356,88,357,90,358,92,359,93,361,90,362,91,363,89,364,90,366,88,367,95,368,91,369,91,371,91,372,89,373,100,374,92,376,93,377,96,378,92,379,89,381,88,382,95,383,88,385,88,386,86,387,89,388,86,390,91,391,86,392,98,393,85,395,83,396,92,397,97,398,86,400,88,401,92,402,92,403,85,405,86,406,86,407,86,408,89,410,97,411,98,412,84,413,88,415,85,416,92,417,83,418,91,420,94,421,84,422,90,423,95,425,90,426,95,427,88,428,91,430,86,431,92,432,88,433,83,435,91,436,88,437,84,438,97,440,84,441,88,442,90,443,84,445,92,446,90,447,97,448,91,450,84,451,87,452,91,453,87,455,102,456,83,457,91,458,97,460,89,461,87,462,89,463,83,465,86,466,92,467,98,468,172,470,161,471,91,472,92,473,84,475,98,476,89,477,89,478,95,480,90,481,94,482,89,483,94,485,98,486,92,487,85,488,94,490,90,491,91,492,95,493,94,495,93,496,95,497,101,498,97,500,93,501,98,502,96,503,87,505,91,506,90,507,93,508,92,510,93,511,93,512,95,514,91,515,94,516,94,517,94,519,97,520,93,521,101,522,95,524,95,525,101,526,92,527,101,529,90,530,97,531,92,532,95,534,98,535,102,536,100,537,97,539,94,540,89,541,96,542,92,544,93,545,97,546,95,547,100,549,90,550,96,551,97;PU;SP;In case the encoding is off, the "" is #03.Opening it in Paint Shop Pro 7 I get nonsense; if I change the commands "SR1.042,1.563;" to 20x smaller it starts to look right, but the text still doesn't line up right.Really curious what all those '[' are supposed to be (drawn with "CS3", what's that look like?).Ed: cheers cruff:Tim

author: cruff
author_rank: Regular Contributor
timestamp: June 14, 2020, 12:29:53 pm
content: I seem to be unable to grab that code and fully paste it into a file on my Mac. Can you turn it into an attachment?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 14, 2020, 01:07:20 pm
content: Duh, good idea. added ^Ed: also, that file is the edited version, so the text should be roughly normal size, but yeah it's not the as-given size.

author: nali
author_rank: Frequent Contributor
timestamp: June 14, 2020, 01:18:47 pm
content: SR sets the text size relative to the user space (which is undefined) so you're setting characters to 1.042x1.563 of the default userspace which seems a bit odd?Changing it to SI0.01,0.01 gives some senseshorturl.at/qGRX2No idea about the "[", they seem to be in place of a digit?

author: cruff
author_rank: Regular Contributor
timestamp: June 14, 2020, 04:52:05 pm
content: Ran it through two HPGL viewers. The first was the old CERN hpglview program. The '[' characters appear to correspond to slashed zeros. The second is hp2xx, which produced the attached PNG image, in which the text, while huge, looks correct.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 15, 2020, 03:18:21 am
content: Related question -- what DPI or scale or dimension does classic HP equipment expect? The above output was produced from the command "PLOT 0 0 640 480;" to a HP 8590A. Nice round numbers if it were pixels, but none of the manuals seem to suggest any kind of unit for the actual numbers. (Which as a lot of the numbers are integral, also suggests a ton of rounding error at this scale?)PSP7 initially suggests 61 pixels width for the figure, which I'd guess is at 72 DPI, so "640" is a bit less than an inch. Tenths of a pt? 0.35mm? Neither sounds very likely...At "PLOT 0 0 2000 2000;", PSP7 recommends 312 pixels. At 8000, 705 pixels. It's not even linear, what is this?In any case, it doesn't have the charset so it's not usable...So hp2xx 3.4.4, first of all it's OLD, 17 years old. All I get is "opening temporary file: Invalid argument". Setting env doesn't make any difference.I could maybe fix it myself, but I don't see any listing as to what to change. I'd sooner just photograph my damn spectrum analyzer. Not many repos; maybe this one works?https://github.com/dgtlrift/hp2xxTim

author: KE5FX
author_rank: Super Contributor
timestamp: June 15, 2020, 03:35:37 am
content: Quote from: T3sl4co1l on June 15, 2020, 03:18:21 am7470.EXE renders it OK, but the scaling is tiny:The normal device coordinate range for a plotter would be more like 0,0,10250,7700. You wouldn't normally request a plot scaled to VGA screen coordinates.If you run 7470.EXE on an 8590A and use Acquire->Request plot, it should Just Work(tm). Did you try that? With the 8560/8590 portables, 7470.EXE uses the command PLOT 550,279,9750,7479.

author: cruff
author_rank: Regular Contributor
timestamp: June 15, 2020, 04:03:29 am
content: According to the HP-GL Programmer's Reference Manual, a plotter unit is 0.025 mm (0.001 in).

author: T3sl4co1l
author_rank: Super Contributor
timestamp: June 15, 2020, 04:27:49 am
content: Suppose it's about time I give your toolkit a look...My GPIB adapter doesn't seem to be quite compatible; and 7470 seems to be rather... fragile? It seems to wait for timeouts synchronously ("x is not responding"), and kills itself after any single error.I'm not sure if it's a side effect of my non-compliant interface, or a quirk of the machine, but it can't simply take a screenshot in place: it seems that whenever the bus is asserted, the 8590A resets to initial settings, then accepts remote commands exclusively (of course ++loc can return local control). So I can't Just Do It(TM) unless I happen to like the default settings.It also only receives five bytes when I do a device initiated plot; that's something between the device and adapter, no idea.It does view captured HPGL properly though! Not quite pixel perfect I think, which, to be close enough to wonder about, is pretty dang slick.Say, could you add PNG output? (GIF is fine already; just a quality of life thing.)Tim

author: MarkL
author_rank: Unknown
timestamp: June 15, 2020, 04:34:52 pm
content: I found that "PLOT 0,0,60000,40000;" creates output that hp2xx can use to produce readable output. Below is en example from "hp2xx -m png -f test.png test.hgl". The source HPGL is from an 8595E, but I would suspect the 8590A behaves similarly. hp2xx is 3.4.4.I've written a bit of a shell hack around hp2xx to further enhance the output, like setting pen colors and such. After pre/post-processing and massaging by "convert", the results don't look too bad. I can share if anyone is interested, but 1) It *is* a hack, and 2) Linux only.But it sounds like you're on the KE5FX path, probably for the better...

author: KE5FX
author_rank: Super Contributor
timestamp: June 16, 2020, 01:33:29 am
content: Quote from: T3sl4co1l on June 15, 2020, 04:27:49 amOh, it's death-defyingly fragile.It's more like a dialog box than an application. No error handling at all, because it wasn't written for anyone else but your humble narrator. All of the toolkit apps work (or ratherdon'twork) that way.The apps were all written for NI hardware, mostly using PCI-GPIB or GPIB-USB-HS adapters. Prologix support was added later, and works quite well for the most part except for some timing weirdnesses with HP VNAs. The idea is to get useful work done with GPIB hardware rather than to tinker with GPIB adapters, so off-brand models and homebrew versions are supported strictly via UTSL.QuoteThe only thing harder to get right than GPIB is HPGL.The 7470 renderer (courtesy Mark Sims) is better at handling plots from test equipment than any others I've seen... usually far better.QuoteIt's been on the list for a while. 7470.EXE was written 20 years ago with a graphics library that was already almost 10 years old at the time, so back-porting newer formats and features has been challenging. TimeLab does save .PNGs, but it uses GDI+ rather than some recycled game graphics code from the DOS era.Interestingly, because the toolkit applications use 8-bit palettized color, .GIF usually ends up a bit smaller than .PNG anyway.

author: Tomorokoshi
author_rank: Super Contributor
timestamp: June 17, 2020, 07:53:35 pm
content: I also ran it through hpglview by CERN and HP7470A. Here are my results.Similar results with HP7470A.hpglview with default pen thickness.hpglview with pen thickness reduced to 1/10 the original size.