Command: compound

Syntax

compound <name> {
    <data-block>
}

Description

Define a compound graphic structure identifier.

Parameters

Switches

None

Block

Multiple command lines, each of the form:

{<qual>} <type> { <element>{[<num>]} { = <value> } }

where:

Notes

Once defined, the compound name may be used as a command to create an object of that compound type. When such an object is created, a compound graphic primitive with graphic primitive children is created. The origin of the new compound object is assumed to be the current position of graphic contorl (gc). These children are initially undefined.

<element> and <num> may be omitted when <type> is another class of structure, gstructure or compound. In such cases the members of <type> are copied into the new compound and given the same element names.

The compound definition must have application scope and objects of its type are given global scope.

The qualifying word "static" defines an element to be a class value with the same value for all instances of <name>. Defining elements as static can result in considerable savings of object storage.

The qualifying word "heritage" defines an element to be available to child structures. For example, if an element named t of a structure is declared heritage, then object.child.child.t is equivalent to object.t.

The class command may also be used to define a compound, by inheriting from entity.

Examples

Define a compound structure (with graphic members).

compound ~furn.chair_t {
    entity back
    entity seat
    entity legs[]; # Variable length array
    string style
    string paint
}

Create an occurrence of a chair (compound).

~furn.chair_t my_chair, -p=(500,800,0)

The component parts may now be defined.

my_chair.back = prism {
# user prism definition, e.g. prism { ... }
}

The non-graphic attributes may now be defined.

my_chair.style = 'Decca Modern'
my_chair.paint = 'Black'

See Also

Commands:

class, entity, epointer, filter, gstructure, list, structure

Identifiers:

unique_compound_name (string)

Structures:

compound