首页 > 代码库 > max 批量导入obj

max 批量导入obj

建模的同事网上搜的,个别语法错误,修正了下挺好用的(网上随便一搜就有,借用一下做个记录)

 

 1 Fn getnames Title FilterName =( 2  3   dialog = DotNetObject"System.Windows.Forms.OpenFileDialog" 4  5   dialog.title = Title 6  7   dialog.filter = FilterName 8  9   dialog.Multiselect = true10 11   OpenFileResult = dialog.ShowDialog()12 13   if OpenFileResult.Equals OpenFileResult.OK then14 15   (16     dialog.FileNames17   )18 19   else 20     Undefined21 22 )23 24  25 26 --if form !=undefined do destroydialogmytools27 28  29 30 rollout form "批量导入obj"31 (32 33   label lbl "批量导入obj"34   35   button btn "选择导入obj路径" width:120 height:2536   on btn pressed do37 38   (39 40     file_names= getnames "选择导入文件" "OBJ (*.obj)|*.obj"41 42     if file_names != undefined do43 44     (       45 46       for f in file_names do  47 48       ( 49 50                 if ( doesfileexist f ) do 51 52                    importFile f #noPrompt using:Wavefront_Object 53 54                        for geo in geometry  55 56                 where (matchPattern geo.name pattern:"3D_Object*") do57 58         ( 59 60              --geo.name = (f as string)  61 62              pathaa = filterString (f as string)"//" 63 64                              geo.name = pathaa[pathaa.count] 65 66                        )      67 68                    )69 70                    )71 72  73 74          )75 76 )77 78 createdialog form 200 50

具体使用步骤:

技术分享

 

max 批量导入obj