LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

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
(853 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
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 12 of 29
(849 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
(847 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
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 14 of 29
(841 Views)

now I'm starting to feel ignorant or stupid Smiley Very Happy

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
(839 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
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 16 of 29
(841 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
(838 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
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 18 of 29
(835 Views)

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

0 Kudos
Message 19 of 29
(830 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
(824 Views)