We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Create file using OPEN command

Anonymous
Not applicable
I'm trying to write a code to create a BTL file for output to a CNC machine. I can't get my head around the OPEN command when it comes to creating a new file. (Have used it successfully to read from an existing TXT file).

Does anyone have code to demonstrate how to create a new text file and choose its path?
2 REPLIES 2
Matt Balaam
Advocate
The below code will open a file and output text to it. To output to the beginning of the file change recordID and fieldID to 1. The text to output can be string parameters or actual text strings.
filepath = "C:\Temp\Temp.btl"

fileID = open("TEXT", filepath, "separator = '\t', mode = wo, fullpath")

output fileID, recordID, fieldID, "text to output 1", "text to output 2" etc...

close fileID
AC24 (7000 AUS FULL)| Windows 10 Pro | Intel Core i7-12700 @ 2.1GHz | 32GB RAM | NVidia T1000
Anonymous
Not applicable
Thanks. That works as long as I specify a folder path for the file, but I'm not so familiar with how that works on a Mac. (I can only get it to save to /Users/

Ideally, I'd like to save into the same folder as the file (though that won't be easy with Teamwork files). Does anyone have a code that will prompt to choose a folder to save in? Using the DIALOG switch doesn't seem to pop up a prompt as I would expect it to.