10-21-2013 06:57 PM
I'm trying to use the "Create 3D Axes VI" (http://zone.ni.com/reference/en-XX/help/371361K-01/lvpict/create_3d_axis/) to add a set of axes to my mesh scene object. The mesh object changes with time (in reality coming from measurements) and therefore needs to be in a loop. Putting the 3D axes VI in the loop works, but creates a horrible memory leak, as the VI creates new objects in each run. Not putting it in the loop, creates "Error 1055 occurred at Invoke Node; Possible reason(s): LabVIEW: Object reference is invalid." error. Can anyone please suggest a way around this?
Also, I don't need the Create Sphere in the VI. It is there only because I could not add the axes without wiring something to the Drawable input of the invoke node.
Thanks!
Solved! Go to Solution.
10-21-2013 09:33 PM
What if you store the object wire in a shift register and delete the object from the picture in the next iteration before creating and adding the new object?
10-22-2013 12:06 AM
Add the objects outside of the loop. Take the output of the "Set Drawable", cast it to a mesh reference and wire it into the loop. Then, within the loop, simply modify the data required for the primitive in each loop and call the "Redraw" method of the 3D picture control. The 3D picture is reference based meaning that the reference to the drawable object points to the ACTUAL object in memory which is being drawn.
In addition, when you're not using the output of any "Set Drawable" or "Add Object", you NEED to attach a "Close Reference" node on there.
Shane.
10-22-2013 11:36 AM
Thank you Shane. I am a bit confused about the type casting of "Set Drawable", but it seems to be working with no memory leak. Attached is the updated wiring for the future reference.
10-22-2013 11:59 AM
Well to top things off, wire the mesh out of your loop and close it when the loop exits.
Then you should be OK.