LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saving a circle in a picture

Hi,

I would like to draw circles along a line. In order to do that I need to save the previous circles. I used the draw circle by radius.vi and added a for loop to it. 

Thanks in advance,

Gaby 

0 Kudos
Message 1 of 7
(3,053 Views)

Hi Gaby,

do you want to create a picture in each iteration? You can use the "Picture to Pixmap" function and the "Write ... File" functions to store an image.

 

Hope it helps.
Mike

0 Kudos
Message 2 of 7
(3,043 Views)

Dear Mike,

I have probably expalined myself poorly. I would like to see (live) the advancement of the circle and also all of the circles drawn before that. I think I nedd to use some kind of buffer, but I don't how.

Gaby

0 Kudos
Message 3 of 7
(3,041 Views)

Hi Gaby,

you can use a shift register to build an image with the old values or you create an array of all single images.

See the attached example.

 

Hope it helps.

Mike

0 Kudos
Message 4 of 7
(3,039 Views)

The shift register should be for the picture directly, and you do not need to use Concatenate Strings to build a composite picture.

 

 

Other notes:

  • Do not use local variable unnecessarily. Use wires.
  • Unless you intend to change the values of the controls while you're looping (unlikely), the controls should be outside the loop. It is pointless to read the value each time if it doesn't change.
  • Don't mix datatypes unnecessarily. You have a lot of coercion dots due to mixing orange (floating point) wires with blue (integer) wires. Set the controls to the proper datatypes.
  • Use datatype conversion functions appropriately. Your "radius" control is already I16, so it's pointless to convert it to I16.
Message Edited by smercurio_fc on 09-04-2008 11:54 AM
0 Kudos
Message 5 of 7
(3,021 Views)

Heelo,

Thank you for all of the replies. I've tried doing the same thing with an XYgraph but without a lot of success. I do manage to draw the circle and it does move, but it does not save the previous ones. I'm attaching my VI (Iuse labview 8.0)

Thank yuo,

Gaby

0 Kudos
Message 6 of 7
(3,004 Views)

You seemed to have ignored each of my comments, and even had me add another one to boot:

 

  • In general wires should be straight and flow left-to-right and top-to-bottom. Avoid wires in which the flow goes "backwards". Examples of this are your wiring of the constants to the property nodes.

 

So which way do you want it? Picture or XY graph? For the XY graph you need to build an array of waveforms, so that each circle is an element. Have you looked at the shipping examples? There is are numeours examples that cover the various graphs, including one that shows you how to draw multiple plots onto an XY chart.

 

Your VI, cleaned up is attached with some additional comments:

  • Why do you have the shift register expanded? You're not looking at the previous-previous value.
  • Do not write the same value to the property node each time through the loop if it never changes. Each write to a property node swaps out to the user interface thread, slowing down your code.
  • What is the purpose of the "Plot.FillTo"? Are you trying to draw filled circles?
  • There's an easier way to create a circle. Think polar.  

 

P.S. You may want to peruse the LabVIEW Style Guide. Smiley Wink 

Message Edited by smercurio_fc on 09-04-2008 04:07 PM
0 Kudos
Message 7 of 7
(2,999 Views)