LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the circle to draw a rectangle rather than a line?

I am trying to get the little circle to draw the whole rectangle rather than just drawing the line, I dont know what I am doing wrong on LabView. Any suggestion would be much Appreciated.

Nick.

 

Download All
0 Kudos
Message 1 of 32
(3,475 Views)

-

0 Kudos
Message 2 of 32
(3,437 Views)

Hello Nick,

 

A few observations:

 

The VI you provided doesn't do anything when run "as is"  be sure to set and save default values (right-click>>Data Operations>>Make Current Value Default) that approximate what you're attempting to use so that others on the forum can easily see what you're trying to achieve.

 

It looks like you are attempting to "trace" a rectangle on an XY graph by plotting (and overwriting) one point at a time-is that correct?  Do you intend for this plot to persist?

 

If that is what you are trying to do, you seem to have completed (more or less- what happens when X-X2 isn't divisible by 0.08?) one side of the rectangle.  If you want to traverse the entire shape, you'll need to add similar logic to generate points for the left, right, and (top or bottom) bounds, in order.  If you want the points to persist, you'll need to store them in a shift register or similar and build an array of the points you wish to plot.

 

Regards,

Tom L.
0 Kudos
Message 3 of 32
(3,424 Views)

@Nick20 wrote:

I am trying to get the little circle to draw the whole rectangle rather than just drawing the line, I dont know what I am doing wrong on LabView. Any suggestion would be much Appreciated.


There is no way to figure out what you actually mean. What little circle? What line? What rectangle?

At least populate your controls with typical default values (edit..make current values default), save, and attach again.

 

I don't understand your use of local varaibles. Does not seem to be necessary. I also don't understand your code. It seems to draw a single point that slowly moves across.

0 Kudos
Message 4 of 32
(3,421 Views)

See if this gives you some ideas.... (probably needs a few tweaks). Typically, it is easiest to work with complex data.

 

 

Message 5 of 32
(3,412 Views)

Hi guys

Sorry  I saved the default values now, it shows the little red circle's movement, and I'm trying to it make trace a rectangle shape. Tom thanks for the suggestion, Ive tried to add more sides but it hasnt worked but ill tweak my code to add a shift register.

(Altenbach), thanks for the code I'll try and use it as a guideline and understand the use of complex numbers since I'm a beginner with labview and havent used complex numbers before.

Regards,

Tom

0 Kudos
Message 6 of 32
(3,361 Views)

Personally, I would avoid complex numbers. It only complicates the issue for those who don't already know the concept.

0 Kudos
Message 7 of 32
(3,343 Views)

@ToeCutter wrote:

Personally, I would avoid complex numbers. It only complicates the issue for those who don't already know the concept.


There's really nothing to learn, except for the fact that each point in the plane can be represented by a single complex value. RE=x, IM=y, and that the xy graph accepts complex arrays, graphing IM vs. RE. Without complex numbers, you need to learn about building clusters (array of xy point clusters or a cluster of x and y arrays, etc.). Clusters are more complicated data structures and more difficult to use. Use of complex can be learned in 1 minute. 😄 (see also). 

0 Kudos
Message 8 of 32
(3,330 Views)

@Nick20 wrote:

Hi guys

Sorry  I saved the default values now,


No, you did not. All controls are still zero. You need to:

 

  1. enter the correct values into all controls
  2. select all controls
  3. menu...edit...make selected values default
  4. save the VI
  5. attach it here.

There is nothing complex about complex numbers as used for xy graphs, see above. Did you try my example?

0 Kudos
Message 9 of 32
(3,326 Views)

for the drawing rectangle program, is there anyway in taking out the line thats created when the circle creates the outline of the rectangle? if so what would be taken out to do that?

0 Kudos
Message 10 of 32
(3,249 Views)