COFFEE:-reading point data from a file



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

    On 01/04/2003 at 07:42, xxxxxxxx wrote:

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

    ---------
    Hi there,
        Im trying to use C.O.F.F.E.E to read in some point position data from an external file. I am successfully reading in the data, but it is currently being read in as string data (using ReadChar()). I am having problems either reading in the data directly as some form of a float or converting it from a string to a float once it is read in. Either would do. I have seen the ReadLong() function in the documentation, but this does not seem to be reading in the values correctly. This may be due to my lack in understanding the function operation.
     
    I've inserted (below) a sample of the data file I am trying to read in.
     
    The part of the file that I am intrested in is as follows:
     
    CONVSECTION name sec4 type DefaultSection
     piece begx 79.9309899838865 begy -86.8901604003906 begz 18.354375 endx 79.9309899838865 endy -88.2553084003906 endz 18.304375 upy -0.0366015237812339 upz 0.999329939738069
     
    It is the numerical parts of this that I want to read in.
    As I said, I am currently only able to read this in, in a string format.
     
    Hoping you or anyone can help.



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

    On 01/04/2003 at 10:57, xxxxxxxx wrote:

    well is hard in cooffee

    I personaly use C++ SDK to handle all that...
    I pass to C++ for the same problem you get

    In C is a simple sscanf and you format all string to float long etc....

    Michel



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

    On 02/04/2003 at 00:54, xxxxxxxx wrote:

    I have done that for my Business Graphs plugin (http://www.3dweave.com), it imports Ascii files (CSV and XML format), and the plugin have to extract values and to place them in a spreadsheet.
    I have written my own code to extract each spring beetween spaces " ":
    I use a loop to build each string, reading each byte of the Ascii file with Readchar() until the space " ". Then I convert the string in value with my_value=evaluate(my_string), if value=NIL it's only text, else value contains the numerical conversion.
    Next, I continu with the next string of the file, until the end.
    I hope you can understand my bad english....


Log in to reply