Read files and run
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/09/2008 at 10:35, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.5
Platform: Windows ;
Language(s) : C++ ;---------
Hi ..is there any way to open files like *.txt ??
and when they opened is possible to run the code inside them ??
example :
i put code to create a cube in txt file ...
can i open the txt file and run it ... to create the cube ???
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/09/2008 at 11:56, xxxxxxxx wrote:
hi!
Its possible, check the class BaseFile.
You want to run code? Which code? You have to write your own parser or you take the hook for coffee to allow custom code in your plugin. See "c4d_coffee"
Bye.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/09/2008 at 18:40, xxxxxxxx wrote:
lets say that i have this code :
BaseObject *cube = BaseObject::Alloc(Ocube);
cube->SetName("cube");
doc->InsertObject(cube, NULL, NULL);and save it in c:\file.txt
how i open the file.txt and run the code to create the cube ???
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/09/2008 at 21:29, xxxxxxxx wrote:
Won't work. The cube is a parametric Cinema 4D object. All of the 'code' exists in Cinema 4D and the only data saved to disk that recreates it is in the c4d file.
In order to save the cube as a text file it would be to save the parameters in some textual format and recreate the parametric object from these when read back in. So, you would need to set up a file format something like this maybe:
OBJECT cube
size: 100, 100, 100
divs: 16, 16, 16
rotation: 0, 0, 0
translation: 0, 1, 0
scale: 1, 1, 1
...You get the point. You'll need to have code to write a file with this information and to read the file with this information and the code to understand these keywords and formatting to recreate the object in question in Cinema 4D.