LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot file (HPGL PLT file) conversion to image

Yes I got that! I understood that everything that comes after SP are plot coordinates and in my case i have five SP matches so I am creating a parser for the strings between SP. Once again, my issue is how to convert from plot position to "pixels" for my image.. I am using the parser here as inspiration, but once i have the array with the plot positions i don't know what to do.... thanks again for your help!

0 Kudos
Message 11 of 29
(1,909 Views)

Hi cassaniti,

 

read your own Wikipedia link and the descriptions of those HPGL commands.

 

One command of interest could be "SC" - it's one of the first commands in your PLT file…

The other interesting command is "IP"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 29
(1,905 Views)

Thanks, i got that.. as i wrote i parsed 5 strings separated by SP where i have the points where plotter is supposed to draw. For example

SP2;;PU;PA0,0;PA244 ,136 ;PD;PA244 ,136 ;PA244 ,136 ;PA260 ,136 ;PA276 ,136 ;PA292 ,206 ;PA308 ,264 ;PA324 ,318 ;PA340 ,242 ;PA356 ,136 ;PA372 ,254

 

PA(Plot Absolute)
 Pen is moved to position of absolute coordinate (x, y).
   PA x,y(,x,y...);

 

what i don't get is how to convert those "coordinates" to pixels....

0 Kudos
Message 13 of 29
(1,903 Views)

what i don't get is how to convert those "coordinates" to pixels....

That's why you need commands IP and SC.

With those commands you can scale to any sheet of paper you like to!

It's similar to PDF format: you scale to an arbitrary position. This position is then converted to real pixels depending on your desired output format. (A greater sheet of paper might use more pixels than a smaller sheet!)

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 29
(1,897 Views)

now I'm starting to feel ignorant or stupid 😄

IP250,279,10250,7479;

SC0 ,4388 ,0 ,4212

 

that's what I parsed.. then I have the array of coordinates.. which VI should I use to convert this to pixels? do you know something that i can use as an example to do this?!

0 Kudos
Message 15 of 29
(1,895 Views)

Hi cassaniti,

 

you make your own "sheet of paper" using your own coordinates.

 

For this you scale the coordinates of your HPGL file to your pixel coordinations.

When you define your image as 1000×1000 pixels you need to scale the range [250, 279, 10250, 7479] (given by IP command) to your pixels [0, 0, 999, 999]…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 29
(1,897 Views)

should i use this function http://zone.ni.com/reference/en-XX/help/371361H-01/lvpict/draw_point/ in a shift register with my x-y scaled coordinates? Or is it a stupid idea?!

0 Kudos
Message 17 of 29
(1,894 Views)

Hi cassaniti,

 

this is one of the picture drawing function which I suggested to use…

 

You can draw single points, you can draw lines, arcs, rectangles - just like HPGL commands…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 29
(1,891 Views)

interesting i'm starting to understand 😉 i will post my results (and hopefully a VI that the other people can eventually "recycle" Smiley Wink )

0 Kudos
Message 19 of 29
(1,886 Views)

as you can see from the attached screenshot, i've made some steps forward, but i'm having a weird issue: the origin of the labview image is on the top-left, while the coordinates i get are originated on the bottom left.. is there a way to change the origin of the image coordinates on labview? thanks

0 Kudos
Message 20 of 29
(1,880 Views)