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: 

3D Graph Has Extra Lines to 0,0,0 When Plotting Lines

Solved!
Go to solution

Hello,

I am plotting cartesian coordinates to the 3D graph as lines using the attached method and as you can see it's drawing an additional line from every point back to 0,0,0.  How can I remove this / where am I going wrong?

 

Thank you for the help!

Download All
0 Kudos
Message 1 of 10
(2,456 Views)

Hi JFWM,

 


@JFWM wrote:

How can I remove this / where am I going wrong?


Well, let's start with using too much variables, add some terminals missing their labels, having a loop running forever, apparently no error handling…

(In a different thread you claimed to be a "fairly experienced LabVIEW user".)

 

When you don't need those [0,0,0] points then you should not add them to your arrays: did you check those global variables for their content?

When you need more detailed help you should attach real code, not just images of (parts of) code!

Best regards,
GerdW


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

Ok, that's a rough starter reply... but I should explain as it's my fault.

This is just a quick snippet of code I'm testing, yes the loop runs forever, no it won't be that way forever it's going to be a slave loop that is called to run only while there are comms going to and fro the VISA device then will shutdown.  I'm just currently playing with the 3D graph function.

Yes, there are lots of global vars, again it's just a quick way to play with the graph function and yes all of the global are instantiated anew every time the code is run, so are the line vectors for the plot line function.

 

So... I will fully incorporate and flesh out the 3D graph function (using it for a CNC controller code for a TinyG controller) then if I still have issues will come back to the community.

0 Kudos
Message 3 of 10
(2,431 Views)

If ol' Obi-won was a computer programmer, he would say, "This isn't the code you were looking for".  I have no idea how it relates to the actual plotting.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 10
(2,424 Views)

Ok, so here is the current monolithic ugliness that I'm working on.  Since it's been over 5 years since I developed code in LV I know there are a billion things wrong with the code (ie - be gentle please, I recognize it's ugly).  I figure I'll completely rebuild it as I go along and learn / remember things I should know.

 

Thanks for the help figuring out the 0,0,0 problem, (as well as anything else you might see)!

0 Kudos
Message 5 of 10
(2,421 Views)

Do you mind to attach a downconverted version of your VIs?

(I still prefer LV2017.)

Best regards,
GerdW


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

Here is 2017

0 Kudos
Message 7 of 10
(2,392 Views)

Hi JFWM,

 

wow, what a mess…

 

As I wrote before: missing error handling. And even more terminals missing their labels…

 

See this:

You always output data from this subVI, even when the received string contains garbage. In 2 of 3 cases you output default data, which is "zero" for DBL values.

Did you complain about all those "zero" points in your 3DGraph?

Implement better error handling. Don't build your arrays when you don't receive valid data!

 

You really should cleanup those VIs! Start with:

  • Buttons belong into their event cases.
  • You don't need to create an event when you update the error cluster indicator.
  • Don't use MouseUp events for no good reason. Use ValueChange events!
  • And you really should use less global variables… (Use more shift registers!)

The other subVI:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Download All
0 Kudos
Message 8 of 10
(2,388 Views)

Hi GerdW,

I appreciate the reply.  I understand how the 0 dbls can be created if junk is read instead of JSON, so to error handle junk out of the way are you suggesting something like shown below with a filter to follow, or rather, how would you error handle garbage out of the way so as not to deliver zeros?

0 Kudos
Message 9 of 10
(2,370 Views)
Solution
Accepted by topic author JFWM

Hi JFWM,

 


@JFWM wrote:

Hi GerdW,

I understand how the 0 dbls can be created if junk is read instead of JSON, so to error handle junk out of the way are you suggesting something like shown below with a filter to follow, or rather, how would you error handle garbage out of the way so as not to deliver zeros?


This might work, even if it doesn't look too nice.

In the MainVI you need another case structure to implement this simple code:

 

IF no error THEN
  add new data to arrays
ENDIF

Again I recommend to refactor your code base. Using proper data structures and overall program design such things become much easier…

 

Best regards,
GerdW


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