LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding 3D Axes to a Scene Object

Solved!
Go to solution

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!

 

Download All
0 Kudos
Message 1 of 5
(4,558 Views)

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?

0 Kudos
Message 2 of 5
(4,548 Views)
Solution
Accepted by topic author SoheylV

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.

Message 3 of 5
(4,536 Views)

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.

0 Kudos
Message 4 of 5
(4,521 Views)

Well to top things off, wire the mesh out of your loop and close it when the loop exits.

 

Then you should be OK.

0 Kudos
Message 5 of 5
(4,511 Views)