3D Max加载自定义结构文件

4 篇文章 0 订阅
1 篇文章 0 订阅

global vert_array = #()
global face_array = #()
global face_theta = #()

struct_length = openFile "struct_length.txt"
struct_width = openFile "struct_width.txt"
struct_theta = openFile "struct_theta.txt"

--in_file = getOpenFileName caption:"选择结构参数文件" types:"Text Files (*.txt)|*.txt|All Files (*.*)|*.*|" filename:"" 

--if in_file != undefined then
(
	--num_verts = readValue in_file
	--print(num_verts)
	--num_faces = readValue in_file
	--vert_array.count = num_verts
	--print(vert_array.count)
	--face_array.count = num_faces
	for v = 1 to 10000 do vert_array[v] = (readValue struct_length)
	for f = 1 to 10000 do face_array[f] = (readValue struct_width)
	for g = 1 to 10000 do face_theta[g] = (readValue struct_theta)
	close struct_length
	close struct_width
	close struct_theta

	--new_mesh = mesh vertices:vert_array faces:face_array
)
--prams = filterString vert_array " "

--print(vert_array)
--print(face_array)
mybox = box length:20 width:20 height:10
--mybox = cylinder radius:20 height:10
mybox.name = "BlueBox"
mybox.wirecolor = (color 220 220 220)
--mybox.radius = 1000 -- 2 times the original 20 units 
mybox.width = 4500 -- 3 times the original 20 units
mybox.length = 4500
mybox.pos = [mybox.width/2,mybox.length/2,0]
global x = 1
global m = 1
for i = 1 to 100 do
(
	n = 1
	for j = 1 to 100 do
	(
		--r = sqrt(i*i + j*j)
		--if r <= 50
		--print(vert_array[i])
		--print(face_array[i])
		mybox1 = box length:20 width:20 height:4
		mybox1.name = "Box"
		mybox1.height = 100
		mybox1.length = vert_array[x]/10
		mybox1.width = face_array[x]/10
		rot_box = eulerangles 0 0 face_theta[x]
		rotate mybox1 rot_box
		mybox1.wirecolor = (color 0 255 255)
		mybox1.pos = [m*45,n*45,10]
		x = x + 1
		n = n + 1
	)
	m = m + 1
)

 

  • 10
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值