[Up] [Previous] [Next]

4. Including Other Inventor Files

For complicated scene descriptions, you may want to have separate files for different pieces of the scene, and then gather them together in a smaller file to organize the final result. The way you do that is with a File node:

    File {
        name "myfile.iv"
    }

The contents of the file will be inserted into the scene graph at the location of the file node, just as though you had literally typed them in at that point. For example, assume you had one file containing the description of a boat object, another file with an object for the shape of a lake. You could use them in a third file to build a scene as follows:

    #Inventor V2.0 ascii

    Separator {
        File {
            name "boat.iv"
        }
        Material {
            ambientColor 0.0 0.2 0.8
            transparent  0.3
        }
        File {
            name "lake.iv"
        }
    }

This would result in a scene containing the boat (with whatever colours might have been specified in "boat.iv", and a lake where the water is slightly transparent and coloured a dark blue-green.

This way of working can be very efficient because it lets you use graphical tools for designing complicated objects while still allowing you to write your own code to combine those objects into a final (possibly animated) scene.

More Information

More information about including files is available in chapter 11 of Inventor Mentor.


MIT home page HTML written and maintained by Reid M. Pinchback (reidmp@mit.edu)
Last modified 96/06/10; copyright © 1996 MIT