LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW: (Hex 0x41F) Object reference is invalid – Issue with Moving Created Objects

Hi everyone,

I’m currently learning LabVIEW, so I might not fully understand everything yet. I have two cube objects that I create using my SubVI with the CreateMesh.vi function. Later, I want to rotate and translate the different cubes within the three pictures using keyboard input. My goal is to animate the rotation using a For Loop, but for now, I’m just testing it with a normal loop.

I noticed that when I add more than two cubes, the program starts to slow down significantly, as it always creates new objects with every loop. To improve performance, I tried creating the objects outside of the loop and then only applying the corresponding transformations inside the loop. However, when I do this, I always get the error:

LabVIEW: (Hex 0x41F) Object reference is invalid.

Does this approach simply not work the way I expect, or am I missing something? I have already checked forum posts about this error but haven't found a simple solution yet.

Any help or explanations would be greatly appreciated!

Thanks in advance!

Download All
0 Kudos
Message 1 of 7
(407 Views)

In your second image you are using local variables to send the reference into the loop.

 

The problem is that you have not used dataflow to control when everything executes.  The position on screen has nothing to do with when things, run, so when your VI starts, it tries to run your While loop immediately, which then reads from the local variables immediately, which are empty because the calls to "Cube Object subVI" have not run yet.

 

Just delete the local variables and run the wires from both "Cube Object subVI" calls into the edge of the While loop, which will delay its start until both calls to the subVI have finished, then send the output of both of those wires to the "Set translation" calls directly, no local variables on the inside either.

0 Kudos
Message 2 of 7
(362 Views)

Thank you for your response!

I really appreciate your explanation. The thing is, I have already tried implementing it without using local variables, just as you described, but I’m still getting the same error:

LabVIEW: (Hex 0x41F) Object reference is invalid.

To debug the issue, I enabled Highlight Execution to see exactly what’s happening. The loop correctly waits until all objects have been created before executing. Then, the Add Object.vi calls are executed one after another, and everything properly flows into the 3D Picture Control.

However, when the second loop runs, I get the same Hex 0x41F error at the Set Translation.vi at the bottom.

I also tried using Shift Registers instead of using tunnels, but the error still occurs in the exact same place.

Do you have any idea what might be causing this? I’d really appreciate any further insights!

Thanks again!

0 Kudos
Message 3 of 7
(349 Views)

Can you post the actual VI file instead of a screenshot?  Back-saved to 2021 if you're using a version later than that.  We can't debug images easily.

 

I would warn against using "Highlight Execution" to determine execution order.  Running with that on and watching it is no guarantee of execution order during the running of the program.  It is possible to create a VI that runs "correctly" 999 times out of 1000, but that 1000th time the execution order is different and it fails.  If the program was made with proper dataflow setup, it will succeed every time.

0 Kudos
Message 4 of 7
(340 Views)

Sorry for being away for so long. Here is the VI file attached.

0 Kudos
Message 5 of 7
(178 Views)

Tried to check these, but they're saved in 2024.  I use 2021, other people use older versions often as well.  If you can save them back to 2021 or maybe 2019 so more people can see them, we are more likely to take a look.

 

Also, you've just posted on the end of the day on Friday;  I and many other forum-goers don't often post/read on weekends, so posting the new backsaved VIs Monday next week might be your best bet.

0 Kudos
Message 6 of 7
(165 Views)

I think that should be the right 2019 Labview Version.

0 Kudos
Message 7 of 7
(153 Views)