3dsmax批量导入、导出文件

时间:2025-03-23 17:06:25

3dsmax中maxscript脚本批量导入导出obj,stl,fbx文件

批量导入

rollout form "import obj"
(
		label lbl "import obj"
		button btn "obj path" width:120 height:25
		button 'btn1' "export" width:120 height:25
	on btn pressed do
		(
			obj_files = getFiles"C://xx//xx//*.obj"
			for f in obj_files do(
				if(doesfileexist f) do
					importFile f #noPrompt using:Wavefront_Object
			)
)
createdialog form 200 50

批量导出

rollout myrollout "export obj" width:162 height:121
(	
	button 'btn1' "export" pos:[54,68] width:48 height:30 align:#left
	on btn1 pressed do
	(
		i = 0
		unhide objects
		unfreeze objects
		clearSelectcion()
		for obj in objects do
		(
			k = getPolygonCount obj
			if k[1] == 0 then
			(
				print 
			)
			else
			(
				select obj
				exportFile("C:\\xx\\xx\\"++".obj")#noprompt selectedOnly:true
				clearSelection()
				i+=1
			)
			j+=1
		)
		print "all"
		print j
		print "finished"
		print i
)
createdialog myrollout

之前也是找了特别多资料,最后进行总结,希望对大家有帮助哟