Skip to main content

ModelCenter APIs 2025 R2

toFile

Last update: 16.07.2025

public toFile(fileName: String)

writes out contents to a file (same as writeFile()).

Parameters

fileName the file to write to

Throws

ModelCenterException

public toFile(fileName: String, encoding: String)

writes out contents to a file (same as writeFile()). Encoding can be ASCII, UTF-8, or binary. If encoding string is blank, will default to ASCII encoding for text files and binary encoding for binary files. Will throw an exception if binary encoding is used on a text file and vice-vera.

Parameters

fileName the file to write to
encoding how to encode the file on disk: 'ascii', 'utf-8', or 'binary'.

Throws

ModelCenterException

Connect with Ansys