Group Format

The first byte of a group record stores the number of characters in the group name.  Group names can have from 1 to 127 characters (using the character sets A-Z, a-z, and 0-9) although four characters should generally be considered a minimum.  It is recommended that the first six characters of each group name are unique for compatibility with many older software applications.  The character count is always read as a positive number regardless of the actual sign of the stored value.

Byte

Length (bytes)

Description

1

1

Number of characters in the Group name (1-127) – this value may be set to a negative number to indicate that the group is “locked.”

2

1

Group ID number (-1 to –127 … always negative).

3

N

Group name (ASCII characters – upper case A-Z, 0-9 and underscore _ only)

3 + n

2

A signed integer offset in bytes pointing to the start of the next group/parameter.

3 + n + 2

1

Number of characters in the Group description.

3 + n + 3

M

Group description (ASCII characters – mixed case).

Figure 11 – The format of a Group Parameter.

The second byte of the group record contains the group ID number – this is always a negative value between –1 and –127 (hence it must be read as a signed byte) and is used to link parameters to their groups.  A parameter with a positive ID value that matches a negative group ID number “belongs” to that group.  Note that the actual value chosen for a group ID number is not fixed and may vary from one C3D file to another.  It is not required that group ID numbers are assigned in a contiguous sequence.  In the example shown the group ID number is 0xFFh, which translates to 255 decimal or –1 (signed integer), thus all parameters with a parameter ID of 0x01 will belong to this group.

The string containing the group name starts at the third byte.  Group names can have from 1 to 127 characters (using the character sets A-Z and 0-9) although four (4) characters should generally be considered a minimum.  Group names should not start with a number.  The hex dump below shows the format for the POINT group record with a description where the characters POINT are stored (in hex) as 0x50, 0x4F, 0x49, 0x4E, and 0x54.

Figure 12 – A typical Group record – this example defines the POINT group.

A “POINT” group, arbitrarily assigned the ID number –1, and with no description would be stored in 10 bytes as follows (values shown in hex):

0x05h

0xFFh

0x50h

0x4Fh

0x49h

0x4Eh

0x54h

0x03h

0x00h

0x00h

5

-1

P

O

I

N

T

3

0

Figure 13 – A simple group record with no description string.

A word pointer to the next parameter data structure follows the group name string unless this is the last parameter in the parameter section.  The last parameter in the parameter section always has a pointer value of 0x0000h to indicate that there are no more parameters following.  In the example shown here, the pointer has the value 0x0017h, indicating that the next parameter record starts in 23 bytes while the group has no description string (not a good idea) and therefore has a pointer of 0x0003h.

A single byte follows the pointer to the next parameter data structure – this records the length of the group description string (0-127 characters) that immediately follows this byte.  The group description can contain mixed case characters as well as space characters and is generally used to provide a human-readable description of the group function.  In the first example the description length is 0x14h – the group description 3-D point parameters contains 20 characters, while the second example has no description string and thus a description length of 0x00h.

The next parameter or group record in the parameter section starts immediately following the previous records’ description string.  From the example above, it can be seen that the following record name is six characters long and has a group ID of 0xFEh.  This is another group record that describes a different group name – in this case, this is the record for the ANALOG group.  You can work out the rest of the group description for this parameter item and the following item from the example data.

Although the example above does not have any associated description it is strongly recommended that the description string be used at all times to provide some basic information about the parameter item and its use.  Consider this as simply good programming practice to provide some documentation about the information stored in the C3D file.