Jebus_kfc Posted February 24, 2012 Posted February 24, 2012 I was wondering if someone would be able to help me with a program that will use unlimited lists that I can call back to the variables. For example... if I were to loop a question like "Is there a beam?" and also "Specify depth of beam?" - In which I could ask these questions, get input, run the sub routines then when it is all said and done I can go back to the 1st 2nd... nth inputs, so I could do more things later in the program. Hopefully this isn't too confusing. Thanks, Quote
pBe Posted February 25, 2012 Posted February 25, 2012 (edited) sample code (defun c:sample (/ doyourthing a b c) (defun doyourthing (ls / pt) (princ (strcat "\nCurrent Beam size " "\t\t" (car ls))) (setq pt (getpoint "\nTesting purposes: Pick Point")) (command "_rectangle" "_non" pt "_non" (strcat "@" (itoa (cadr ls)) "," (itoa (caddr ls)))) ) (setq marker (if (null marker) 0 marker)) (while (progn (initget "Y L D") (setq a (getkword (if lst "\nCreate New List/\"L\" for Existing list [Yes/List/Done]?: " "\nCreate List [Yes/Done]: "))) (if (eq a "D") nil T) ) (cond ((eq a "L") (foreach itm (reverse lst)(print itm)(princ)) (setq b (getint "\nEnter List number: ")) (setq c (nth (1- b) (reverse lst))) (doyourthing c) ) ((eq a "Y") (prompt "\nEnter Data:") (setq b (getint "\nSpecify Depth of Beam: ")) (setq c (getint "\nSpecify Heigth of Beam: ")) (if (not (setq d (assoc (setq nm (strcat (itoa b) "X" (itoa c))) lst))) (setq lst (cons (list nm b c (setq marker (1+ marker))) lst) c (car lst)) (progn (princ "\Data Already Exist, using previous Data") (setq c d)) ) (doyourthing c) ) ) );while (princ) ) Command: sample Create List [Yes/Done]: Y Enter Data: Specify Depth of Beam: 200 Specify Heigth of Beam: 300 Current Beam size 200X300 Testing purposes: Pick Point_rectangle Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]: _non Specify other corner point or [Area/Dimensions/Rotation]: @200,300 Command: Create New List/"L" for Existing list [Yes/List/Done]?: Y Enter Data: Specify Depth of Beam: 100 Specify Heigth of Beam: 200 Current Beam size 100X200 Testing purposes: Pick Point_rectangle Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]: _non Specify other corner point or [Area/Dimensions/Rotation]: @100,200 Command: Create New List/"L" for Existing list [Yes/List/Done]?: L ("200X300" 200 300 1) ("100X200" 100 200 2) Enter List number: 1 Current Beam size 200X300 Testing purposes: Pick Point_rectangle Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]: _non Specify other corner point or [Area/Dimensions/Rotation]: @200,300 Command: Create New List/"L" for Existing list [Yes/List/Done]?: D HTH Edited February 25, 2012 by pBe add usage syntax/revrse list for viewing existing list Quote
BIGAL Posted February 27, 2012 Posted February 27, 2012 The other way would be to read and write a txt file with all the info per session or even reopen from last session went to lunch and want to continue. Just a question what are you trying to produce is it steel connections etc Quote
pBe Posted February 27, 2012 Posted February 27, 2012 The other way would be to read and write a txt file with all the info per session or even reopen from last session went to lunch and want to continue. Just a question what are you trying to produce is it steel connections etc Thats a brilliant idea Bigal, that way the user can indeed use the list on another session. Quote
Jebus_kfc Posted February 28, 2012 Author Posted February 28, 2012 It is a brace frame automated program for my comany. The idea is for the user to type in gerneal info, and then wait and be done. I appriciate the work you did pBe, I may be able to utilize the one you had put on here but its not exactly what I was hopeing for. So... my problem is I want to be able to recall back to various amounts of user imputs that were taken from the questions answered. I talked to a programing buddy of mine that uses html and other softwares and he said that he would use an "Array", I'm not sure how exactly that translate into lisp. Quote
Lee Mac Posted February 28, 2012 Posted February 28, 2012 For LISP, translating from other languages generally means Array = List Though, Visual LISP does offer a SafeArray data type. Quote
Jebus_kfc Posted February 28, 2012 Author Posted February 28, 2012 Sorry if this is posting more than once, I think there is a problem on this end... I've heard of SafeArrays could you give some examples? Quote
Lee Mac Posted February 28, 2012 Posted February 28, 2012 I've heard of SafeArrays could you give some examples? I could, but I don't think it would be necessary - you are far better off using a list for this task. LISP is built specifically for list processing and consequently is equipped with a multitude of list manipulation functions. SafeArrays are part of Visual LISP and only included for compatibility with ActiveX properties and methods; though if you specifically require some examples to learn about SafeArrays, the Visual LISP IDE (VLIDE) Help Documentation includes a lot of information on the subject. Quote
Jebus_kfc Posted February 28, 2012 Author Posted February 28, 2012 Thanks Lee, Ill check in to that. I would like to learn the ActiveX method of programing sometime, I think it can help do things quicker. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.