关于 MAXScript 逐行写入文本

官方帮助文档FileStream Values部分有相关介绍.

fn format_txt filepath filetext =
(
    if doesFileExist filepath == true 
        then
    (
        fin = openfile filepath mode:"r+"
        seek fin #eof
        txt = filetext + "
"
        format txt to:fin
        close fin
    )
    else
    (
        newfile = createFile filepath
        close newfile
        format_txt filepath filetext
        )
    )  -- 逐行写入文本
format_txt "C:UsersAdministratorDesktop2.txt" "你好MAXScript"

每次都会在文档结尾处写入,如果文件不存在则自动创建.

原文地址:https://www.cnblogs.com/3dxy/p/3961003.html