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.
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.
07-06-2020 09:24 AM
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!
Solved! Go to Solution.
07-06-2020 09:35 AM - edited 07-06-2020 09:36 AM
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!
07-06-2020 09:41 AM
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.
07-06-2020 10:02 AM
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.
07-06-2020 10:08 AM
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)!
07-06-2020 11:38 AM
07-06-2020 11:41 AM - edited 07-06-2020 11:41 AM
Here is 2017
07-06-2020 11:50 AM - edited 07-06-2020 12:01 PM
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:
The other subVI:
07-06-2020 12:32 PM
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?
07-06-2020 01:11 PM - edited 07-06-2020 01:12 PM
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…