This looks more like a job for ASSOC:
Code:(setq listProfiles '(("W530 x 85" 535 166 10.3 16.5 35 22) ("W530 x 74" 529 166 9.7 13.6 32 21))) (setq listBeam (cdr (assoc name listProfile)) (if listBeam (setq H (nth 0 listBeam) L (nth 1 listBeam) ...


Registered forum members do not see this ad.
Hi,
I'm making a I beam routine.
now I would like to use a file with all the specification and make them use it in the routine. Such as this file. Specification.txt
So I want to set those variable with the one in the .txt file according to the name given.Code:(setq name (getstring T "\nGive name of I Beam : ")) (setq H L EA ES k k1 )
Anyone have a suggestion !
This looks more like a job for ASSOC:
Code:(setq listProfiles '(("W530 x 85" 535 166 10.3 16.5 35 22) ("W530 x 74" 529 166 9.7 13.6 32 21))) (setq listBeam (cdr (assoc name listProfile)) (if listBeam (setq H (nth 0 listBeam) L (nth 1 listBeam) ...
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3


Well can I put it in another file.. since the I beam list is pretty long![]()
This is enough ..
Code:(mapcar 'set '(H L EA ES k k1) (list "W530 x 85" 535 166 10.3 16.5 35 22))
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said


Well i'm pretty sure they work and all... But i'd like to make it a seperate file since I have like 288 different I beam
like it i would use :
I know i'm asking alotCode:(setq list (open file "r") ... etc![]()
But I want to learn fast more and more
That's correct . and use the function read-line to read the line of values with while function to run to the end .
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said


Now I get to this and it's not keeping the variable in memori..
Now, what am I missing.Code:(setq f (open "C:\\Users\\francois.levesque\\Documents\\specification.txt" "r")) (setq name "W530 x 74") (setq listt (while (setq blist (read-line f)) (if (wcmatch blist (strcat "*"name"*")) (princ blist) ) ) )
What are you trying to achieve ?
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said


Well keep the line in memorie so i can use them and put each variable in a setq
Registered forum members do not see this ad.
You should step through each line of string and divide it by spaces or characters or what ever you have in your criteria .
functions may help in this regard .
Code:vl-position vl-string-search vl-string-position
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said
Bookmarks