Creating Relationships between 3D Objects

To create a 3D scene with more than one 3D object, you must set up a hierarchy of 3D object relationships. The 3D object that you use to wire the reference for all objects to the 3D picture control terminal or, if you configure a scene window, the Scene property, is the parent of all other objects in the 3D scene. 3D objects that you add to the scene by wiring a reference to the object to a higher object in the hierarchy are child 3D objects.

If a 3D object is the parent of another 3D object, any transformations you apply to the object also affect the children of that 3D object. Child 3D objects can also be parents of children beneath them in the relationship hierarchy. You can use object relationships in large 3D scenes to program more efficiently and for 3D scenes that involve related movement.

Complete the following steps to create a 3D scene with multiple objects.

  1. Create a 3D scene, or open a VI that contains a 3D scene.
  2. Remove the wire that connects the 3D object to the 3D picture control terminal.
  3. Right-click the reference output of the Set Drawable method and select Create»Method for SceneObject Class»Object»Add Object from the shortcut menu to create the Object:Add Object method.
  4. Add the Object:Add Object method to the right of the Set Drawable method and wire the reference output of the Set Drawable method to the reference input of the Object:Add Object method.
  5. Wire the reference output of the Object:Add Object method to the 3D picture control terminal. The 3D object becomes the parent 3D object.
  6. Add another Create Object VI to the block diagram to the left of the Object:Add Object method.

     Add  Find
  7. Right-click the Scene:New Object output of the Create Object VI and select Create»Method for SceneObject Class»Set Drawable from the shortcut menu to create another Set Drawable method.
  8. Add the new Set Drawable method between the Create Object VI and the Object:Add Object method, and wire the Scene:New Object output of the Create Object VI to the reference input of the Set Drawable method.
  9. Select any VI from the Geometries palette and add it to the block diagram to the left of the Set Drawable method.
  10. Wire the New xxx Refnum output of the Geometries VI you selected to the Drawable input of the Set Drawable method.
  11. (Optional) Translate the new 3D object to another location in the 3D scene. Add the Translate Object VI to the block diagram.

     Add  Find
  12. Wire the reference output of the new Set Drawable method to the Scene.Object In input of the Translate Object VI
  13. Right-click the Translation input of the Translate Object VI, select Create»Constant from the shortcut menu, and change the values of the constant to the x, y, and z coordinates that you want to use to translate the child object.
  14. Wire the Scene.Object Out output of the Translate Object VI to the Object input of the Object:Add Object method.
Note Note  If you do not translate additional objects that you add to a 3D scene, the 3D objects that you do not translate appear on top of each other, and may be difficult to see.
  1. If you did not complete step 11, wire the reference output of the new Set Drawable method to the Object input of the Object:Add Object method.

    The following block diagram shows a 3D scene with two 3D objects.

  1. Wire error in and error out terminals on the block diagram.
  2. Run the VI to generate the 3D scene.

Refer to the 3D Model of Solar System VI in the labview\examples\Graphics and Sound\3D Picture Control directory for an example of a 3D scene with multiple object relationships.

 Open example  Find related examples