help?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/07/2003 at 07:46, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.100 
    Platform:      
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hey!
    Just a bunch of questions on COFFEE, if anyone is able to answer any one of them, just leave a message. Not all of the questions need to be solved in the same message. ANY help is greatly appreciated! THANK YOU ALL IN ADVANCE!
    I was wondering if I had a cylinder in my scene, if I could determine its radius/diameter and length using COFFEE scripting. Something similar to GetPosition() to determine the position, but it would give me the value of the radius/diameter and length.

    Also, if I had two different objects, with a COFFEE expression tag on each and I wanted to 'pass' the value of one variable to the other object,
    would that be possible? For example, suppose there are two cubes and a sphere in the scene.  Using one cube, I calculated the distance from the center to the center of the sphere.  Then, using the other cube, I do the same.  I would like to pass these variables to the sphere so it can decide which one is closer. (I know this would work better if I just calculated the distance using a COFFEE expression on the sphere, but it is just an example).

    Further, is it possible to write data to a file such as a *.txt file. For example, if I got all the coordinates of an object at each frame, could I output that to a file and then get that data back at another time from that file?

    Is there a method to call that can determine the closest point from a point on an object to a point on a spline? I knowthat Maya has a method called closestPointonCurve, but I have yet to find one on Cinema 4DXLR8.

    Finally, is there any way that I can initialize variables and functions to only do something for the first frame, frame 0? For example, if I set up a series of conditions and rules for the first frame, the methods will no longer be called after the first frame?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/07/2003 at 09:04, xxxxxxxx wrote:

        
        
        I was wondering if I had a cylinder in my scene, if I could determine its radius/diameter and length using COFFEE scripting. Something similar to GetPosition() to determine the position, but it would give me the value of the radius/diameter and length.
    

    see my answer on your last post

        
        
        Also, if I had two different objects, with a COFFEE expression tag on each and I wanted to 'pass' the value of one variable to the other object,  
        would that be possible? For example, suppose there are two cubes and a sphere in the scene.  Using one cube, I calculated the distance from the center to the center of the sphere.  Then, using the other cube, I do the same.  I would like to pass these variables to the sphere so it can decide which one is closer. (I know this would work better if I just calculated the distance using a COFFEE expression on the sphere, but it is just an example).
    

    you can pass anything to any object within one COFFEE expression. Using several expression tags and passing between them wouldn´t make sense and I doubt it´s even possible.

        
        
        Further, is it possible to write data to a file such as a *.txt file. For example, if I got all the coordinates of an object at each frame, could I output that to a file and then get that data back at another time from that file?
    

    yes, it is. Please see the SDK docs (BaseFile class) for more information.

        
        
        Is there a method to call that can determine the closest point from a point on an object to a point on a spline? I knowthat Maya has a method called closestPointonCurve, but I have yet to find one on Cinema 4DXLR8.
    

    you will need to calculate this yourself.

        
        
        Finally, is there any way that I can initialize variables and functions to only do something for the first frame, frame 0? For example, if I set up a series of conditions and rules for the first frame, the methods will no longer be called after the first frame?
    

    you have access to the current frame the COFFEE expression is calculated. You can then use the conditional if...else... statements to do so.
    It seems that you do not have any programming experience (or never had a look into the SDK documentation before). I would suggest learning basic programming things like syntax etc. (C++, Java, Perl and similar will help) before you start programming.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/07/2003 at 10:11, xxxxxxxx wrote:

    Hey buds, you tell me to look at the BaseFile for more information. The code there doesn't even work! I tried it, and thats why I asked you this question in the first place, then you tell me to look at code that doesn't work!
    Copying the code straight from the site, the problem occurs in the file->Open(filename, GE_WRITE); line.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/07/2003 at 10:20, xxxxxxxx wrote:

    1. We are not buds, so watch your language please
    2. A bit of trying would surely help, doing some research, looking at example codes, getting to know the SDK etc.
    3. Once again, without the intention to sound mean: I would suggest learning basic programming things like syntax etc. (C++, Java, Perl and similar will help) before you start programming.
    4. Accessing basefiles from within an expression is not possible. You will need to write a plugin to make use of the basefile class.
    Best
    Samir



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/07/2003 at 11:11, xxxxxxxx wrote:

    1. If the example codes suck, then I have no other choice but to ask the people on this forum. Which is exactly what I'm doing because they don't make sense. If you don't want to help, then don't answer.
    2. I can program in C++ and Java among other languages, so you're not the only one that can program in other languages.
    3. Who died and made you god?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/08/2003 at 10:34, xxxxxxxx wrote:

    I don't know where to even begin answering this thread. In the future please stick to one issue per thread. (Since there's only a flat threading model things can quickly get out of hand otherwise.)
    As you have noticed the C.O.F.F.E.E. expressions that you can write directly from within C4D are a bit limited. For example, it's hard to share variables and for security reasons file access is limited.
    I think you should check out the standalone plugins that you can place as .cof-files inside the plugins folder. Start by looking at PluginExpressionTag in the docs and among the examples.
    (I should also tell you that in C4D R8 there are some limitations with the C.O.F.F.E.E. language. You mention that you know C++, so if you have access to MSVC or CodeWarrior I'd suggest you use the C++ SDK instead. It's much better documented and more up-to-date.)


Log in to reply