Use PRINT statement with the list as argument to record it in the data file.
After call READ-LINE to retrieve it from file, respectively READ to evaluate the string into a list.


Registered forum members do not see this ad.
Dear all,
I am developing one project for my cencern, in this project i have so many details in a list format. I want to write all the lists in a text file as a organized manner and get it back as a list whenever required.
Please try forme.
my mail.
mkumar@mabanisteel.com
Use PRINT statement with the list as argument to record it in the data file.
After call READ-LINE to retrieve it from file, respectively READ to evaluate the string into a list.


Dear msasu,
Thank you so much. I wasted full day for this task.
I didn't use both the function till now which make me mad.
Anyhow thank you so much for your immediate response.
Can you explain in detail about that functions.
You are welcomed!
The below examples may help you:
To record a list into a text file:
To retrieve that list from the file:Code:(setq TargetFile (open "c:\\test_20091210.txt" "w")) ;open file to write (princ '(1 2 3 4) TargetFile) ;record the list into file (close TargetFile) ;close the file
For more and better explanations may use AutoLISP’s help.Code:(setq SourceFile (open "c:\\test_20091210.txt" "r")) ;open file to read (setq FileLine (read-line SourceFile)) ;read file content (one line in this case) (close SourceFile) ;close the file (setq theListFromFile (read FileLine)) ;evaluate the string into a list
Regards,


can you give me your mail ID to contact you if i face any problem in my task.
my mail Id
mkumar@mabanisteel.com
This should help you for writing to files:
http://www.cadtutor.net/forum/showth...ILE#post271366
DropBox | finding the light...
Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...
You will get better support if continue to post on forum – there are many great programmers that can help you and a lot of good approaches for each issue to choose from.
Also, is a good practice to avoid posting in clear your e-mail address since this sound like an invitation to spammers. For the case when you cannot avoid doing so, just spell it like:
“user at domain dot extension”at list this will avoid automatically parsing.


DropBox | finding the light...
Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...


Registered forum members do not see this ad.
Dear friends,
can you help me to modify this following lisp
(defun save_input_as_a_text_file_from_list ()
(setq input_text_file (strcat path_input_endwall "/endwall.txt"))
(setq file_descr (open input_text_file "w"))
(close file_descr)
(setq list_type_variables (list "main_input_building_details" "clear_span_dialog_details" "left_end_column_size" ))
(setq file_descr (open input_text_file "a"))
(setq i 0)
(repeat (length list_type_variables)
(write-line (nth i list_type_variables) file_descr)
(princ (eval (read (nth i list_type_variables))) file_descr)
(princ "\n" file_descr)
(setq i (1+ i))
)
(close file_descr)
)
I need a text file like this
firstline will be varible name
nextline will be the whole list
main_input_building_details
(("frame_type" "typical_endwall" "endwall_type_left" "endwall_girt_type_left" "corner_column_left_endwall" "endwall_column_spacings_left" "bay_spacings_sidewall" "building_length" "building_width" "eave_height" "expansion_joint" "gen_block_wall_ht") ("clear_span" "typical_endwall_yes" "bearing_frame_left" "by_pass_left" "306" "5@6000" "10@6000" "60000" "30000" "6000" "0" "2500"))
clear_span_dialog_details
(("building_width" "ridge_distance" "frame_profile" "eave_height_left" "ridge_slope_left" "girt_spacings_left" "purlin_spacings_left" "eave_height_right" "ridge_slope_right" "girt_spacings_right" "purlin_spacings_right") ("30000" "15000" "symmetrical" "6000" "1" "10@1000" "10@1500" "6000" "1" "10@1000" "10@1500"))
left_end_column_size
("Ipea-200" "Ipea-200" "Ipea-200" "Ipea-200" "Ipea-200" "Ipea-200")
But my lisp is removing the double quote inside the list and writing like this as a text file.
main_input_building_details
((frame_type typical_endwall endwall_type_left endwall_girt_type_left corner_column_left_endwall endwall_column_spacings_left bay_spacings_sidewall building_length building_width eave_height expansion_joint gen_block_wall_ht) (clear_span typical_endwall_yes bearing_frame_left by_pass_left 306 5@6000 10@6000 60000 30000 6000 0 3000))
clear_span_dialog_details
((building_width ridge_distance frame_profile eave_height_left ridge_slope_left girt_spacings_left purlin_spacings_left eave_height_right ridge_slope_right girt_spacings_right purlin_spacings_right) (30000 15000 symmetrical 6000 1 10@1000 10@1500 6000 1 10@1000 10@1500))
left_end_column_size
(Ipea-200 UB-203 UB-203 UB-203 Ipea-200 Ipea-200)
Bookmarks