Code library

Signed-off-by: 刘明宏 <liuminghong@mail.sdu.edu.cn>
这个提交包含在:
刘明宏
2023-06-22 06:27:19 +00:00
提交者 Gitee
父节点 186f84784d
当前提交 90b2d9ba09
共有 13 个文件被更改,包括 898 次插入0 次删除

33
lib/AddBlocks.m 普通文件
查看文件

@@ -0,0 +1,33 @@
function [object_blk,blk_pos_corner ]=AddBlocks(model,blk)
%Add blocks, used in model expansion and loading rectangular sources on the topographic surface
blk_pos_corner = [];
ins0 = 0;
for n = 1:size(blk.Lx,2)
%Size unitm
lenx = blk.Lx(n);
leny = blk.Ly(n);
lenz = blk.Lz(n);
%Center position coordinate
xc = blk.CentCoord(n,1);
yc = blk.CentCoord(n,2);
zc = blk.CentCoord(n,3);
blk_position = [xc yc zc];
blk_size = [lenx leny lenz];
blkLabel = ['blk' num2str(n+ins0)];
model.geom('geom1').feature.create(blkLabel,'Block');
model.geom('geom1').feature(blkLabel).set('size',blk_size);
model.geom('geom1').feature(blkLabel).set('pos',blk_position);
model.geom("geom1").feature(blkLabel).set("rot", blk.angle);
model.component("mod1").geom("geom1").feature( blkLabel).set("base", "center");
object_blk{n} = blkLabel;
temp = [];
blk_pos_corner = cat(1, blk_pos_corner, temp);
end
model.component("mod1").geom("geom1").run();