THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/10/2003 at 09:22, xxxxxxxx wrote:
Cinema 4D Version: 8.207
Platform: Windows ;
Language(s) : C.O.F.F.E.E ;
Sorry I guess this is another set of stupid beginner's questions. I did a proper search on the subject this time, though, but haven't find a satisfactory answer.
Loading files via coffee. I saw some examples - but I don't seem able to recreate it. What I need is to merge an obj file inside a Cinema document and then simply get its points positions. I already learned that merging files using coffee is not possible - one has to open the object in a separate file and then copy data to the original file. Copy data - HOW?
I saw an example of LoadDocument() but, besides not being able to recreate it in my project (it simply will not work - nothing happens) I doubt that life is so easy and beatiful and that LoadDocument() will recognize obj file automatically and load it. I guess the function is intended for loading of c4d files exclusively. So I guess it would be a better idea to forget all about the LoadDocument() function and write a code that will Open an OBJ file and then extract data one by one out of it, right?
So here are my questions:
1. Will LoadDocument() open any file that Cinema recognizes as a valid file (ie, obj, dxf etc) or only c4d files?
2. Where can I find a whole, working example of how to implement the LoadDocument() function properly - the example in SDK is very basic.
3. Where can I find a working example of an OBJ file loader?
4. I made a piece of code. It works extremly well when I put it inside Execute(doc). But since there's already code for dialog box in there - I have to call my routine from a dialog instead (it should run when user clicks on OK button). The problem is, when I put my code inside a separate subroutine, for example, MyCode() and call it from Command(id, msg)- it doesn't work anymore. I tried to find out why - it seems the problem is, that MyCode() starts with
var obj=doc->FindObject(OBJECT); // search object inside current document, with name, defined in the OBJECT variable
and when I put it as separate subroutine and call it from Command(id,msg) - it "forgets" what "doc" stands for i.e. I get Object not found error (which means - the routine didn't search for object in the right (current) document. So what am I doing wrong? (OBJECT variable is declared at the beginning of the document - so I guess it is "global" and supposed to retain its value inside all functions?)
I hope there's someone here who will have a little patience with me Thanks for any answer or direction from a more experienced user. And sorry for long post.