AnyMath 文档

T-FLEX文档的软件管理

此页面包含 AnyMath 中T-FLEX DOCs的所有可用软件管理功能。

要在 AnyMath 中使用T-FLEX DOCs的软件管理功能,请按照 文章. 之后,执行:

using Main.EngeeDeviceManager.Devices.TFLEXDOCS
TFLEXDOCS.download_files(tdocs, calculation_name)

从指定的 T-FLEX DOCs 计算对象中导出计算的原始数据。

参数

  • tdocs::TFLEXDOCS :T-FLEX DOCs 对象。

  • calculation_name::String :T-FLEX DOCs 中现有计算对象的名称。

示例

tdocs = TFLEXDOCS.Tflexdocs()

# 从指定的计算对象中获取所有文件
download_files = TFLEXDOCS.download_files(tdocs, "new_calc")

# 准备将文件保存到Engee
function prepare_files_for_engee(calc_files::Dict{String, Vector{UInt8}})
    for (key, value) in calc_files
        write(key, value)
    end
end

prepare_files_for_engee(download_files)
TFLEXDOCS.new_calculation(tdocs, name, denotation)

在 T-FLEX DOCs 中创建新的计算对象。

参数

  • tdocs::TFLEXDOCS : T-FLEX DOCs 对象。

  • name::String : 新计算对象的名称。

  • denotation::String : 新计算对象的描述。

示例

tdocs = TFLEXDOCS.Tflexdocs()
TFLEXDOCS.new_calculation(tdocs, "new_calc", "default")
TFLEXDOCS.start_work(tdocs, docsPath, exePath)

创建用于操作 T-FLEX DOCs 的会话。

参数

  • tdocs::TFLEXDOCS : T-FLEX DOCs 对象。

  • docsPath::String : 已安装 T-FLEX DOCs 中的 Program 目录路径。默认值:"C:\Program Files (x86)\T-FLEX DOCs %version%\Program" 。

  • exePath::String :指向已安装的 T-FLEX DOCs 文件夹中 TflexDocsEngee 目录内 exe 文件的路径。默认值:"C:\Program Files (x86)\T-FLEX DOCs %version%\Program\TflexDocsEngee\TflexDocsEngee.exe" 。

示例

using Main.EngeeDeviceManager.Devices.TFLEXDOCS
tdocs = TFLEXDOCS.Tflexdocs()
TFLEXDOCS.start_work(tdocs)
TFLEXDOCS.stop_work(tdocs)

结束与 T-FLEX DOCs 的会话。

参数

tdocs::TFLEXDOCS: T-FLEX DOCs 对象。

示例

tdocs = TFLEXDOCS.Tflexdocs()
TFLEXDOCS.stop_work(tdocs)
TFLEXDOCS.upload_files(tdocs, files, calculation_name)

将计算结果加载到指定的 T-FLEX DOCs 计算对象中。

参数

  • tdocs::TFLEXDOCS : T-FLEX DOCs 对象。

  • files::Dict{String, Vector{UInt8}} : 字典,其中键为文件名,值为以字节数组形式表示的文件内容。

  • calculation_name::String : T-FLEX DOCs 中现有计算对象的名称。

示例

tdocs = TFLEXDOCS.Tflexdocs()

# 进行计算
path = "results.txt"
result = ""
for i in 1:10
    exh = i * 100 / i^3
    result *= string(exh) * "\n"
end

# 将计算结果写入文件
write(path, result)

# 准备要传输到DOCs的数据
function prepare_files_for_docs(paths::Vector{String})
    files::Dict{String, Vector{UInt8}} = Dict()
    for path in paths
        content = read(path)
        base = basename(path)
        files[base] = content
    end
    return files
end

# 将需要发送至DOCs的所有文件路径记录下来
files = prepare_files_for_docs([path])

# 将文件发送至DOCs
TFLEXDOCS.upload_files(tdocs, files, "new_calc")