GiD - The personal pre and post processor

new

 

objarray new <type> (-values {<value_1> ... <value_n>}) | (<size> ?<fill_value>?) | (-binary <data>)

return a new objarray

<type>: chararray shortarray intarray longarray longlongarray floatarray doublearray

objarray new <type> -values {<value_1> ... <value_n>}

<value_i> must be numeric values compatible with the <type>

In fact is is possible to provide another other objarray instead the list of values to copy its values. It can be of other type, a casting will be applied to convert each value to the destination type.

objarray new <type> <size> ?<fill_value>?

<size>: integer > 0 to create an array of this size. If <fill_value> is provided the array items are set to this value.

objarray new <type> -binary <data>

<data> is an arbitrary array of bytes (unsigned char), e.g. to store data of an image.

e.g.

set obj [objarray new intarray 3] -> 1518360 1518610 0 (3 random unitialized values) set obj [objarray new intarray 5 1] -> 1 1 1 1 1 (5 values intialized to 1) set obj [objarray new intarray -values {6 3 8}] -> 6 3 8 set obj [objarray new intarray -binary [binary decode base64 AQAAAAIAAAADAAAABAAAAA==]] -> 1 2 3 4 set obj2 [objarray new intarray -binary [objarray get_binary $obj]] -> 1 2 3 4

COPYRIGHT © 2022 · GID · CIMNE