Hi @JuDi !
A Fish function relying on gridpoint functions would be:
def get_extent
local xmin = 1e12 ; A really huge value
local ymin = xmin
local zmin = xmin
local xmax = -1e12 ; A really small value
local ymax = xmax
local zmax = xmax
loop foreach local gppnt gp.list
xmin = math.min(xmin, gp.pos(gppnt)->x)
ymin = math.min(ymin, gp.pos(gppnt)->y)
zmin = math.min(zmin, gp.pos(gppnt)->z)
xmax = math.max(xmax, gp.pos(gppnt)->x)
ymax = math.max(ymax, gp.pos(gppnt)->y)
zmax = math.max(zmax, gp.pos(gppnt)->z)
end_loop
get_extent = list.seq(vector(xmin,ymin,zmin), vector(xmax,ymax,zmax))
end
Then, running the command [extent = get_extent]
in Flac3D console will store 2 vectors in the extent
variable: extent(1)
is the vector with minimum x, y, and z of gridpoints, and extent(2)
stores the max values.
Another option would be to use splitting:
def get_extent2
local extent_min = vector(list.min(gp.pos(::gp.list)->x),list.min(gp.pos(::gp.list)->y),list.min(gp.pos(::gp.list)->z))
local extent_max = vector(list.max(gp.pos(::gp.list)->x),list.max(gp.pos(::gp.list)->y),list.max(gp.pos(::gp.list)->z))
get_extent2 = list.seq(extent_min, extent_max)
end
Alternatively, you could take advantage of the Python API. In a Python console, this should do the trick:
import itasca as it
# Contains xmin, ymin, zmin
min_ext = it.gridpointarray.pos().min(axis=0)
# Contains xmax, ymax, zmax
max_ext = it.gridpointarray.pos().max(axis=0)
Cheers!
Théophile