|
|
Loading Object Data From A Text / INI / DAT files
#135122
06/09/07 22:31
06/09/07 22:31
|
Joined: Jun 2007
Posts: 236 acknex.exe
ACKNEX007
OP
Member
|
OP
Member
Joined: Jun 2007
Posts: 236
acknex.exe
|
Hello , i need a simple code / idea to load some data saved in text files.. so..i can assign it to the model in runtime. anybody help please ? Thanks 
|
|
|
Re: Loading Object Data From A Text / INI / DAT files
[Re: ACKNEX007]
#135123
06/10/07 04:57
06/10/07 04:57
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
Store your info in some type of organized way. fHandle = file_open() file_str_write(fhandle, property1); file_str_write(fhandle, property2); file_str_write(fhandle, property3); ... file_close(fHandle); Just a basic outline. The rest is up to you! 
xXxGuitar511 - Programmer
|
|
|
Re: Loading Object Data From A Text / INI / DAT f
[Re: Shadow969]
#135127
06/10/07 10:33
06/10/07 10:33
|
Joined: Mar 2007
Posts: 776 Poor village - Poland ;)
tompo
User
|
User
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
|
yes... I hope... then .txt should look like myaction1,1.5,1.5,1.5,0,0,0,my_mat1
try something like this:
//veriables// var veriables_var; string myaction_str[20]; string scale_x_str[4]; string scale_y_str[4]; string scale_z_str[4]; string pose_x_str[4]; string pose_y_str[4]; string pose_z_str[4]; string material_str[10];
//function// veriables_var = file_open_read("your.txt");
my.action = file_str_read(veriables_var,myaction_str);
file_str_read(veriables_var,scale_x_str); scale_x = str_to_num(scale_x_str); file_str_read(veriables_var,scale_y_str); scale_y = str_to_num(scale_y_str); file_str_read(veriables_var,scale_z_str); scale_z = str_to_num(scale_z_str);
file_str_read(veriables_var,pos_x_str); pos_x = str_to_num(pos_x_str); file_str_read(veriables_var,pos_y_str); pos_y = str_to_num(pos_y_str); file_str_read(veriables_var,pos_z_str); pos_z = str_to_num(pos_z_str);
material = file_str_read(veriables_var,material_str);
file_close(veriables_var);
Last edited by tompo; 06/10/07 10:41.
Never say never.
|
|
|
Re: Loading Object Data From A Text / INI / DAT f
[Re: ACKNEX007]
#135130
06/10/07 21:19
06/10/07 21:19
|
Joined: Mar 2007
Posts: 776 Poor village - Poland ;)
tompo
User
|
User
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
|
Quote:
If you do this by simply saving/loading numeric or string information, this WILL NOT work for actions and materials.
Maybe it's right... I haven't test it so for action or material use f.e. numbers and vars and then your txt file will be looking like: 1,1.5,1.5,1.5,0,0,0,1
then: file_str_read(veriables_var,material_str); material_var = str_to_num(material_str); if(material_var ==1){my.material = my_mat1;}
or use str_cmp (String1, String2) function I hope it will be helpfull 
Never say never.
|
|
|
|