3DCoatScripting  4.8.31β
С помощью скриптинга можно управлять возможностями Коута и расширять его функционал.
🌀 Работа с файлами

Может быть, тебе захочется записать результат своей работы в файл и / или прочитать записанные ранее данные из файла.

3DCoat умеет и это. Используй такие команды:

// предоставляет доступ к файлу "a.txt" через переменную `a`
// обрати внимание: здесь файл создан не будет
File  a( "a.txt" );
// вернёт `true`, если существует файл, доступный через созданную выше `a`
File  a( "a.txt" );
if ( a.exists() ) {
    // делаем что-то
}
// устанавливает для файла режим, когда ввод / вывод возможен
// не только в виде текстовых символов, но и байтами;
// что позволяет читать / создавать свои бинарные файлы
File  a( "a.data" );
a.binary( true );

// ввод / вывод осуществляется в виде текста
a.binary( false );

// вернёт, в бинарном ли режиме открыт файл
bool  r = a.binary();
// вернёт расширение файла
File  a( "a.txt" );
string  ext = a.extension();
// вернёт полный путь (папки и имя файла)
File  a( "my/folder/a.txt" );
string  fullPath = a.fullPathFile();
// вернёт путь к файлу (только папки)
File  a( "my/folder/a.txt" );
string  path = a.path();
// перезапишет содержимое файла нашим текстом
File  a( "a.txt" );
a = "Line for demo...\n"
    "and yet one, yes!";
// добавит наш текст к содержимому файла
File  a( "a.txt" );
a += "Line for demo...\n"
     "and yet one, yes!";
// перезапишет содержимое файла нашими бинарными данными
File  a( "a.bin" );
FormatBinary  bin = { 0x46, 0x4c, 0x49, 0x46 };
a = bin;
// добавит наши бинарные данные к содержимому файла
File  a( "a.bin" );
FormatBinary  bin = { 0x46, 0x4c, 0x49, 0x46 };
a += bin;
// удалит файл
File  a( "a.txt" );
a.remove();

Тебе может понадобиться открыть диалоговое окно для выбора файла. Посмотри, какие есть функции для работы с диалоговыми окнами:

// Show open file dialog. List extensions like in example - *.tga;*.jpg;
// The resulting file name will be placed in result.
// Function returns true if file is successfully chosen.
DEPRECATED bool OpenDialog(string &in extensions,string &out result);

// Show save file dialog. List extensions like in example - *.tga;*.jpg;
// The resulting file name will be placed in result.
// Function returns true if file is successfully chosen.
DEPRECATED bool SaveDialog(string &in extensions,string &out result);

// Show selecting folder dialog.  The resulting file name
// will be placed in result.
// Function returns true if file is successfully chosen.
DEPRECATED bool FolderDialog(string &out result);

// Some functions in 3DCoat may engage file dialog that
// will wait user's input.
// You may skip that dialogs and provide file name
// automatically so that file dialog will return specified
// file name without waiting for user's input.
// Use empty name "" to stop automatic file dialogs skipping
// othervice all next file dialogs will be skipped and it may
// lead to loosing data.
DEPRECATED void SetFileForFileDialogs(string &in name);

// Returns true if Cancel pressed in the last file dialog.
DEPRECATED bool FileDialogCancelPressed();

Также, если предпочитаешь функциональное программирование, тебе доступны такие функции для работы с файлами:

// Executes command, pass parameters. You may run executables,
// open webpages, open files in corresponding external editors.
DEPRECATED void Execute(const string& command, const string& parameters);
// 3DCoat script example - How to pass 3DCoat installation folder
// into python script under Linux:
    void main() {
        string instPath = installPath();
        string userFolder = homePath(); // userFolder = "/home/YourUserName"
        string pythonInterpreter = "/usr/bin/env python"; // Similar to standard "#!/usr/bin/env python"
        string pythonScript = userFolder + "/bin/testLauncher"; // Path to python script
        string arg = "-f " + "\"" + instPath + "\"";
        string app = pythonInterpreter + " " + pythonScript;
        print(app + "\n" + arg + "\n");
        Execute(app, arg);
    }

// Reads file content into the string.
DEPRECATED string ReadFromFile(const string& filename);

// Writes string content to the file.
// \param append `true` - string will be appended to file,
//               `false` - string will be overwrote a file.
DEPRECATED void WriteToFile(const string& filename,const string& text,bool append);

// Checks if file exists.
DEPRECATED bool CheckIfFileExists(const string& filename);

// Removes file from the disk.
DEPRECATED void RemoveFile(const char* filename);

// Removes a path from the `s`.
DEPRECATED string RemoveFilePath(string &in s);

// Removes a file extension from the `s`.
DEPRECATED string RemoveExtension(string &in s);

// Converts `s` to absolute path.
DEPRECATED string EnsureAbsolutePth(string &in s);

// Returns a path from the `s`.
DEPRECATED string GetFilePath(string &in s);

// Returns a file extension from the `s`.
DEPRECATED string GetFileExtension(string &in s);

// Returns a file name from the `s`.
DEPRECATED string GetFileName(string &in s);

// `true` then a file exists by the path `s`.
DEPRECATED bool CheckIfExists(string &in s);

// Creates all folders to the path `s`.
DEPRECATED void CreatePath(string &in s);

// Calls Callback for each file in folder. If Folder is empty
// used will be asked to choose file in folder.
// Callback should be declared as `void Callback(string &in Path)`.
// `ExtList` contains list of extensions like "*.jpg;*.png"
DEPRECATED void ForEachFileInFolder(string &in Folder,string &in ExtList,string &in Callback);

// Returns a path where the 3DCoat was installed.
string installPath();

// Get an absolute path including write folder of the 3DCoat.
string rwPath( const string& userPath );

// Returns a path to home directory "~" (for example "/home/YourUserName").
string homePath();