GDexIndex.gif Previous-2.gif Next-3.gif

Creating an object (CreateObject)


In this tutorial, we create a Graphics Display Kit object from the ground up.

Here is what the definition of a Graphics Display Kit object looks like, at the base-type level. Most of the base types defining a Graphics Display Kit object are optional. In the diagram, the object is connected into Uviewer3D, a macro that defines a full-featured renderer, including a view and a rendering window.

 

GENERATE/FH031310.gif

Starting up

  1. 1.      Start AVS/Express and choose Single-window DataViewer with no viewer (select None as the Viewer type) from the startup dialog, or, from an existing AVS/Express session, start a new Single-window DataViewer with no viewer by selecting the appropriate entries from the File->New Application... dialog, or clear an existing SingleWindowApp workspace, as appropriate.
  2. Create the data object

    The data object we'll build consists of DefaultObject (the data object's "root" object), DefaultModes, and DefaultProps.

    Instance into the SingleWindowApp workspace the following objects: DefaultModes, DefaultProps, and DefaultObject. Connect them as shown in the diagram below. 

     

    GENERATE/FH649311.gif

    Create a view and window

    A Graphics Display Kit application requires a view for the Graphics Display Kit object and a window in which to render the view. For this tutorial, we create both with Uviewer3D. Uviewer3D is a full-featured 3D viewer, complete with a top-level object, a window, a view, and related editors.

    Instance Uviewer3D and connect it to DefaultObject, as shown in the diagram below. 

     

    GENERATE/FH267310.gif

    When we instance Uviewer3D, a window with a black window inside it appears. This is where the data is rendered.

    Render an object

    Finally, we need to supply the Graphics Display Kit with an object to render. We can do this with Arrow1. It makes the data available both as a field (first output port) and as a Graphics Display Kit object (second output port), ready for rendering. We use the second output port.

    Instance Arrow1 and connect it to DefaultObject, as shown in the diagram below. 

    The application renders an arrow in the view's window.

     

    GENERATE/FH885413.gif

    Clean up

    This completes the tutorial. The completed tutorial is available in Libraries.Examples.Graphics_Display.CreateObject.

    Delete the application.

     



    GDexIndex.gif Previous-2.gif Next-3.gif