From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you plot arcs in XYGraph using LabVIEW 14.0?

I have to read information (radius of the cirlce, angle of the beginning and end of the arc) from a text file, the generate a random curved line from all of the circle arcs. Any ideas?

0 Kudos
Message 1 of 6
(3,524 Views)

Hi daiana,

 

I would use DrawArc from the picture functions palette to draw your arcs in a 2DPictureIndicator…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,513 Views)

Yes.  Start coding in LabVIEW, making sure that you have Controls for all of the Inputs your problem requires and Indicators for all of its Outputs.  In your case, this may include a Path Control (to specify the Text File) and an XY Graph (for the plot).

 

You know something about how the data are organized (it sounds like possibly a comma-delimited text file with three "columns" and multiple "rows", and you know what the data represent.  Break this down into steps:

 

  1. Open and read the file.
  2. Get the data in some "logical" structure (what sounds good to you?)
  3. For each Radius, Angle1, Angle2 "row", add points to the plot.
  4. When all the plots are done, exit.

Now write code for each of these steps, and think about how you would "sequence" the steps.

 

If you have any questions along the way, post your code (attach your VI or VIs) and explain where you are stuck.

 

Bob Schor

0 Kudos
Message 3 of 6
(3,494 Views)

I don't understand what you actually want to do, but here are a couple of extra options which can help you with the actual arcs:

 

  1. Use Gerd's suggestion, but use the graph's plot images property to draw the arcs in front of the rest of the graph.
  2. Use the Polar to Complex function to convert polar coordinates to Cartesian coordinates. Then, just select as many points as you like to set the smoothness of the curve and adjust the theta value accordingly for each point. The shipping function called Ramp can generate the list of theta values for you.

___________________
Try to take over the world!
0 Kudos
Message 4 of 6
(3,467 Views)

Do you have problems reading the text file or with creating the arc.

 

An arc is most easily created using complex numbers (a ramp in radians for the arc and a scalar radius)

 

 

 

(Set the number of points in the ramp to a reasonable value, the default 128 is way too big)

 

If you have a list of arcs, use a FOR loop, autoindexing over the changing values containd in an array. Use a bundle before the output tunnel to create a complex cluster array that the xy graph understands as multiple plots. If all should be part of the same plot, use a concatenating output tunnel and  insert a NaN value between the arcs to create a gap.

0 Kudos
Message 5 of 6
(3,448 Views)

You need to tell us how the text file is structured, but chances are that you can read using "read from spreadsheet file" (older LabVIEW) or "read delimited spreadsheet" (LV2015), creating a plain 2D array.


@iam_daiana wrote:

... generate a random curved line from all of the circle arcs.


Of course the curve will NOT be "random" but exactly follow the data given in the file, right? If you want random data, why would you need a file?

 

Here's how you could process a list of arcs. Most likely, each row will have one set of parameters, so you would autoindex on the 2D array, then index out the three paramteres inside the loop.

 

 

 

 

If the data is structured to form a continuous sequece of connected arcs, just remove the bundle and make the output tunnel concatenating. Modify as needed.

0 Kudos
Message 6 of 6
(3,430 Views)