Suppose that you want to create a three-dimensional linear array of a
LUMP object
ent. Creating the necessary
pattern object,
pat, is most easily done by using the
api_linear_pattern function, which requires that you specify the base displacements in three directions (which need not be orthogonal), and the number of corresponding pattern elements desired in each direction:
|
|
// define the pattern parameters
|
pattern* pat = NULL;
|
SPAvector x_dir(. . .,. . .,. . .);
|
SPAvector y_dir(. . .,. . .,. . .);
|
SPAvector z_dir(. . .,. . .,. . .);
|
int num_x = . . .;
|
int num_y = . . .;
|
int num_z = . . .;
|
|
// create the pattern
|
outcome result = api_linear_pattern(pat, x_dir, num_x,
|
|
y_dir, num_y, z_dir, num_z);
|
check_outcome(result);
|
// apply the pattern
|
result = api_set_entity_pattern(ent, pat);
|
check_outcome(result);
|
// clean up
|
pat->remove();
|