/
extract
GiD - The personal pre and post processor
extract
set obj2 [objarray extract <obj> <indices_extract> ?-dim <dim>?]
Allocate an array extracting items by some indices of another objarray
<obj> is the source objarray
<indices_extract> is a list of integer indices to be extracted (from 0)
<dim> is the amount of values that represent an item (optional, 1 by default)
e.g. from an array of 3 coordinates (9 values) extract the coordinates with index 0 and 2 (6 values)
set node_xyzs [objarray new doublearray -values {0.480427 3.45196 0.0 -3.3451965 3.45196 0.0 0.480427 -1.70819 0.0}]
-> 0.480427 3.45196 0.0 -3.3451965 3.45196 0.0 0.480427 -1.70819 0.0
set some_xyzs [objarray extract $node_xyzs {0 2} -dim 3]
-> 0.480427 3.45196 0.0 0.480427 -1.70819 0.0
e.g. a common use could be to extract some nodes of the mesh (e.g, the ones of a group, element, etc.)
lassign [GiD_Info mesh -post -step_index $step_index nodes -array2] node_ids node_xyzs
set node_ids_set [GiD_EntitiesSets get $setname nodes]
# these ids start from 1, not from 0 as require, decrement one
objarray incr $node_ids_set -1
set node_xyzs_set [objarray extract $node_xyzs $node_ids_set -dim 3]
COPYRIGHT © 2022 · GID · CIMNE