From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Error 1055 when trying to change attributes of a 3D picture

Solved!
Go to solution

Here's a simplified version of my problem:

 

Say I want this VI to change the color of the box with every iteration. If I put the Create Box.vi and Create Object.vi inside the while loop, it accomplishes what I want but continues to create new boxes and objects until it crashes. If I put them outside of the while loop, it executes properly for 1 iteration and then generates error 1055 (reference invalid) at both the property node and the invoke node. I assume this means the references are automatically closed when the object is output to a 3D picture indicator.

 

inside.pngoutside.png

How do I change the color of an existing object without creating new ones?

0 Kudos
Message 1 of 7
(2,800 Views)

OK, so the second image looks a lot better because you're not imfinitely creating new objects....

 

Do you see the "Drawable" connector for the "Set Drawable" method? It is both an input AND an OUTPUT.  The reference for the box changes when it becomes a child of the Scene Object.  You need to take this reference and keep it in a shift register, and most definitely do NOT add is to the scene in each iteration.

 

Do the "Set Drawable" once outside the loop, take the reference from the output into a shift register and then change the colour each iteration.  Then it should work.

Message 2 of 7
(2,761 Views)

Ok, if I understood your suggestions correctly I am having a couple of issues with them:

 

1) When I do the drawable outside of the loop and then try to change the color (rather than changing the color of the box reference before setting the drawable in each iteration), it changes the reference from a box reference to a drawable reference. The property node does not work on a drawable reference.

 

DrawableProperties.png

 

2) You said most definitely do not add it to the scene in each iteration. What is the alternative here? If I only add the reference to the scene once (ie after the while loop is complete), then won't I only be able to see 1 still picture? I want to be able to see the color changes as they are happening.

 

Please let me know if I misunderstood.

 

Thanks!

0 Kudos
Message 3 of 7
(2,747 Views)
Solution
Accepted by topic author AmandaBacala

OK, sorry, some clarifications.  I meant not to add it to the SceneObject (Set Drawable) every iteration, that would result in millions of cubes being instantiated. Writing to the Scene indicator is fine.

 

I think you need to cast the output reference back to a Cube reference (Use the "To more specific" cast) in order to get its methods back.

 

Shane

Message 4 of 7
(2,743 Views)

This works perfectly!

solution.png

As long as you don't see anything here that shouldn't be in the loop and would eventually cause it to crash, I think this is the solution I was looking for. Does this look good to you?

0 Kudos
Message 5 of 7
(2,738 Views)

I would place the "To more Specific" outside the loop, but that's not going to be a big problem.  If you want, you can also write to the Scent indicator a single time outside the loop and call the "Refresh" or "Redraw" (I can't remember the name) property of the control to update.  This gives you the ability to disconnect the loop rate from the update rate (for cases where your code for updating might involve several stages with a single update at the end).  But the end result is the same I think.

 

But most importantly, before I can say it looks good, you gotta straighten up those wires...... Smiley LOL

And of course add a stop button to allow you to eventually stop that loop.  That way, the final piece of the puzzle is closing all of the references after execution to prevent memory leaks (it's a few Bytes but every bit counts).

Message 6 of 7
(2,735 Views)

Got it. You are awesome, thank you so much for all of your help!

 

Take care,

 

Amanda

0 Kudos
Message 7 of 7
(2,728 Views)