ok explain is this a homework problem(and has to be done a certain way), or just something you want to work (any way possible) ? |
Any way possible.
I'm getting you want the second file to look something like this.
1 2 3 4 5 6
|
entity 3
11.2500000
-180.000000
7.03125000
entity 14
...
|
|
You mean the write file? No, just like this:
11.2500000 -180.008000 7.03125000
351.562500 104.062500 -3.03432100
..
and so on.
I think your making this more complicated than needed |
It's a distinct possibility, and one that I hope is true.
maybe just a loop to
find next Entity #
get angles_1
get angles_2
get angles_3
write to file
repeat |
As long as it knows I only want the values from entity 3, and that if there is no entity 3 make the three values 0.000000000 for that line.
How many values for entity # do you need to get ? |
Just one value for entity number, and I wish that value to be 3 in this case :-)
If you mean in the block, only 3 numbers (the angles). If an angle isn't present do a 0.000000000 for that angle.
Not within a block. There are many, many blocks though.
Will you get angles_1 - 3 for all of them ? |
Only for those listed under entity 3 in a block, then go to the next line in the write file, and start the process over for the next block.
There are many blocks in the read file, near 30,000 in fact. Performance may be a concern for the program, as notepad and wordpad can't seem to complete a simple search and replace on these files in under an hour. (OpenOffice Writer can do it in 20 minutes though!)
To make it more clear what I am trying to do is the following:
remove the setangle line, I think I can do this with search and replace, but if I come across some easy way to automate that I'd try to stick it in.
I want to replace the three values after 'camera' with the angles from entity 3, making them 0.000000000 if no entity 3 entry is seen in the block.
I figured I could do this by mining the values of entity 3, putting them in a new data file, and then making another program that reads from the readfile, looks for camera, and replaces its values with the ones in the new data file going line by line.
That was the simplest way I could think of doing it with my limited programming ability. If I got both programs working I could probably merge them into one.
There should be a simple way to do this, but I couldn't find any advanced word processors with such features, or databases that read from files.
Some complications I see is that each block needs to be scanned taking care to notice the curly brace terminators, and having it 'go back up' to 'camera' to adjust it with values that appear below it in the file. It's because that seems so difficult is why I'm doing it in what is likely a 'crude' way.