Jump to content

multiple objects in 3D picture


Recommended Posts

Hello all,

I am new using the labview software.I am working on a project, and my task is to make a 3D enviroment for an experiment.While trying to do the job, I find myself in some trouble.I need to draw multiple objects in my programm, but I dont want them to be related to its other.The only way(that i have discovered) to put in my 3D picture more than 1 objects is by using the invoke method: add object.This invoke method although creates

a parent-child relationship between my objects and thats is something that i dont want.With this relationship every transformation i make to the parent object happens also to the child object.But in my project i need to transform all me objects(during the experiment) separately. For example lets say i have 8 blue spheres.I want every time one of them to change color to green, then another become green and all the others blue etc...

In they way i have drawn my objects if I change colour to the parent sphere all others change colour the same way.

So my answer is: Is there a way for me to draw multiple objects without a parent-child relationship? Or if that is not possible is there a way after drawing them that way that these objects can be trasformed without the transformation of any of them influence the other objects?

Thank you.

Link to post
Share on other sites

A lot of folks are on vacation at the moment... you may get a better answer if you repost after New Years.

You should be able to start with a top level object like a Canvas or somesuch and add multiple objects to it. So although visual objects always have a tree with a single root object, that visual tree is a tree, with arbitrary branching, not just a linear list of parent->child->grandchild.

  • Like 1
Link to post
Share on other sites

Like AQ said - children of the same parent are independent. You shouldn't think about SceneObjects as about real objects. they are rather nodes. Not all of them must have visual representation (Drawable). There is one node which is a "root" ant it may not be transformed at all, neither be tighten to any visual object. All other objects are its children (not necessarily directly). If you want to make group of objects move together, or share some properties, just create a common parent for them.

You should also differentiate transformations from changing properties. Transformation is only geometrical movement (translation, rotation and scale). Changing color to blue is only changing the color property. Transformation of parent object always transforms children as well (however all transformations are relative, so it is only a kind of visual impression).

Most properties of nodes along with their actual possible values have one called "Inherited" and usually it is a default value for new nodes. It means that actual value of certain property will always be the same as for its parent. This is why you observed changing colors for all the spheres.

  • Like 1
Link to post
Share on other sites

First of all I would like to thank you both for your answers.By reading them I can understand that the problem I have has a solution and this cheered me up.

You both talk about the parent-child object tree.And vugue analyses it a little bit more.But the difficulty i am facing is that i haven't understood very much the nodes to make this tree.The

only source of theory on how to make this tree of objects is the NI examples that are pretty simple and that all of them contain objects with inheritted translations.

But from the things you said to me I can assume that i can create a level on this tree that has more than one object.

How do I do this? The "addobject" node has 2 inputs.So every time i thought that this is the start of another level on me object tree. As I said on my first post I used the knowledge of this, with the exception that i couldn't find the node thath says geometry and i used the node Drawable.

Edited by sakis11
Link to post
Share on other sites
  • 3 months later...

Here we have 2 brothers and one sister:

Ok. Lets say now, that I want to move one of these objects with my mouse and change the objects colour in some cases that I want, in a dynamic way.I have managed to do this by putting all the property nodes for the 3D objects inside a while loop.The thing is that when I do this after running the VI for a long period of time(about 1-2 minutes) I get a full memory error.

I suppose that this happens because these property nodes are inside the while loop and my pc "drows" the objects repeatedly, so that my memory fills up.I tried to get the property nodes out of the while loop but this creates 2 "feedback nodes" on my object wires that causes error when I run the VI.

I suppose that there is a way to have my objects drawn outside the while loop and changing the colours and translation in a dynamic way without having this memory error, but how??

Can anyone help??

thanks!

Link to post
Share on other sites

Ok. Lets say now, that I want to move one of these objects with my mouse and change the objects colour in some cases that I want, in a dynamic way.I have managed to do this by putting all the property nodes for the 3D objects inside a while loop.The thing is that when I do this after running the VI for a long period of time(about 1-2 minutes) I get a full memory error.

I suppose that this happens because these property nodes are inside the while loop and my pc "drows" the objects repeatedly, so that my memory fills up.I tried to get the property nodes out of the while loop but this creates 2 "feedback nodes" on my object wires that causes error when I run the VI.

I suppose that there is a way to have my objects drawn outside the while loop and changing the colours and translation in a dynamic way without having this memory error, but how??

Can anyone help??

thanks!

I attach a picture of how my VI is in general.The Vi of the pic does not work and I know it but I posted it to show you the general idea of my situation.In the code if I transfer the property nodes inside the while loop my Vi works, but my memory gets full in a while after running it.If I drag them outside the while loop as seen in the photo I get the 1055 error.But I think that these nodes should be out of the while loop to prevent the memory from filling up.Right?

post-18664-0-19824700-1301851758_thumb.j

Link to post
Share on other sites

Ok. Lets say now, that I want to move one of these objects with my mouse and change the objects colour in some cases that I want, in a dynamic way.I have managed to do this by putting all the property nodes for the 3D objects inside a while loop.The thing is that when I do this after running the VI for a long period of time(about 1-2 minutes) I get a full memory error.

I suppose that this happens because these property nodes are inside the while loop and my pc "drows" the objects repeatedly, so that my memory fills up.I tried to get the property nodes out of the while loop but this creates 2 "feedback nodes" on my object wires that causes error when I run the VI.

I suppose that there is a way to have my objects drawn outside the while loop and changing the colours and translation in a dynamic way without having this memory error, but how??

Can anyone help??

The memory is getting full, because you CREATE geometry each iteration instead of modifying it. Previously created geometries are not deleted and remain in memory. Putting feedback node outside a loop doesn't make much sense in your case (such a construct is rather for passing data between VI runs). You should create objects and geometries and assign them once and in the loop only modify object properties: scale to change a size and use material property to change a color. If you want to replace whole geometry of an object you may create and assign it, but just after that you have to free reference of previous one.

Here is an example how to drag objects with a mouse.

Link to post
Share on other sites

The memory is getting full, because you CREATE geometry each iteration instead of modifying it. Previously created geometries are not deleted and remain in memory. Putting feedback node outside a loop doesn't make much sense in your case (such a construct is rather for passing data between VI runs). You should create objects and geometries and assign them once and in the loop only modify object properties: scale to change a size and use material property to change a color. If you want to replace whole geometry of an object you may create and assign it, but just after that you have to free reference of previous one.

Here is an example how to drag objects with a mouse.

thanks for your answer.I found a way of moving my object(sphere) whith the mouse and changing its colour without getting my memory full.

Now I have a problem with the radius of the sphere.The property node that changes the radius of the sphere must be between the "create sphere" vi and the property node "drawable".If I try to drag the radius property node inside the while loop I get error.How can I change the radius of my sphere in a dynamic way using this radius property node?

I mean like the exampe you said above, I know managed to move and change colour of my sphere while running my vi, now how can i do the same to change the radius of my sphere, lets say for example when I click the mouse ? I suppose I have to use the sphere's property node with the radius but I dont know how to use the sphere's nodes.I know how to use only the objects' nodes

Edited by sakis11
Link to post
Share on other sites

thanks for your answer.I found a way of moving my object(sphere) whith the mouse and changing its colour without getting my memory full.

Now I have a problem with the radius of the sphere.The property node that changes the radius of the sphere must be between the "create sphere" vi and the property node "drawable".If I try to drag the radius property node inside the while loop I get error.How can I change the radius of my sphere in a dynamic way using this radius property node?

I mean like the exampe you said above, I know managed to move and change colour of my sphere while running my vi, now how can i do the same to change the radius of my sphere, lets say for example when I click the mouse ?

You have to use drawable reference which goes out from Set Drawable node. The old one is not not valid any more. Because it is more general reference, you also have to cast it down to sphere class:

post-7450-0-77390400-1301916008_thumb.pn

Alternatively, instead of changing the radius of sphere as drawable, you may to scale whole object with Set Scale.vi

Link to post
Share on other sites

You have to use drawable reference which goes out from Set Drawable node. The old one is not not valid any more. Because it is more general reference, you also have to cast it down to sphere class:

post-7450-0-77390400-1301916008_thumb.pn

Alternatively, instead of changing the radius of sphere as drawable, you may to scale whole object with Set Scale.vi

many many many thanks! That was the last piece of my puzzle I think! Thank you for your great knowledge vugie and the time you spent to help me.

Edited by sakis11
Link to post
Share on other sites
  • 9 years later...
On 12/29/2010 at 7:53 AM, vugie said:

Here we have 2 brothers and one sister:

post-7450-0-39108200-1293630776_thumb.pn

3dex.viUnavailable

I got an error running your VI, but why? I want to modify the color and position of the 3 objects but when i use the node in the indexing mode to conect the reference inside a while/for loop i got the error 1055 "object reference is invalid", why is this happening vugie, please help 

Edited by Jose Ramos
im the profile that has commented
Link to post
Share on other sites
  • 1 month later...

You have dug really deep for this rusty thread :)

Well, for me it's still working, but I have no access to modern LV version and I'm stick to 2009. Maybe some of the nodes are obsolete now.

Have you modified anything? Show your code.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.