Flac3D通过fish实现(位移)测线功能
s:开始的点(向量)
e:结束的点(向量)
space:取点的步长
direction:获取哪个方向的位移
file:数据保存的文件名称
fish define func(s, e, space, direction, filename)
local space_x = 0
local space_y = 0
local space_z = 0
local length = 0
local loop_num = 0
if comp.x(s) - comp.x(e) # 0 then
space_x = space
length = math.abs(comp.x(s) - comp.x(e))
else if comp.y(s) - comp.y(e) # 0 then
space_y = space
length = math.abs(comp.y(s) - comp.y(e))
else if comp.z(s) - comp.z(e) # 0 then
space_z = space
length = math.abs(comp.z(s) - comp.z(e))
else
io.out("start point and end point is equivalent")
endif
io.out("the line`s length is " + [string(length)])
if length % space = 0 then
loop_num = int(length / space)
else
loop_num = int(length / space) + 1
endif
disp_array = array.create(loop_num)
loop i (0, loop_num-1)
if i < loop_num-1
x_point = comp.x(s) + space_x * i
y_point = comp.y(s) + space_y * i
z_point = comp.z(s) + space_z * i
gp = gp.near(x_point, y_point, z_point)
else
gp = gp.near(comp.x(e), comp.y(e), comp.z(e))
endif
if direction = "x" then
disp_array(i+1) = gp.disp.x(gp)
else if direction = "y" then
disp_array(i+1) = gp.disp.y(gp)
else if direction = "z" then
disp_array(i+1) = gp.disp.z(gp)
endif
endloop
file.open(filename, 1, 1)
f.write(disp_array, loop_num)
f.close()
end
执行命令行
[global s_point = vector(15,15,13)]
[global e_point = vector(15,15,25)]
@func([s_point],[e_point],1,"z","m.txt")