neekcotrack Posted August 22, 2008 Posted August 22, 2008 Ok I have this lisp Setup that asks [1],[2],[3],[4]. Which everone I pick It runs another lisp that asks [1],[2],[3],[4],[5],[6],[7],[8] and proceeds. The problem is if I run the first lisp it runs the second one but terminates after I pick any option, but if I run the the second lisp by its self it runs fine. Can anyone help!!!. Lisp one is the first lisp, and second lisp is one of the second lisps. (defun c:setup () (initget "122X34 224X36 330X42 436X48") (setq SHEET (getkword "\nEnter Sheet [1]22X34,[2]24X36,[3]30X42,[4]36X48: ")) (cond ((= SHEET "122X34") (INITGET "1FULL 21/2=1 31/4=1 41/8=1 51/20=1 61/30=1 71/40=1 81/50=1") (SETQ SCALE (getkword "\Enter Scale [1]FULL,[2]1/2=1,[3]1/4=1,[4]1/8=1,[5]1/20=1,[6]1/30=1,[7]1/40=1,[8]1/50=1:")) (cond (COMMAND "22X34")) ((= SHEET "224X36") (INITGET "1FULL 21/2=1 31/4=1 41/8=1 51/20=1 61/30=1 71/40=1 81/50=1") (SETQ SCALE (getkword "\Enter Scale [1]FULL,[2]1/2=1,[3]1/4=1,[4]1/8=1,[5]1/20=1,[6]1/30=1,[7]1/40=1,[8]1/50=1:")) (cond (COMMAND "24X36")) ((= SHEET "330X42") (INITGET "1FULL 21/2=1 31/4=1 41/8=1 51/20=1 61/30=1 71/40=1 81/50=1") (SETQ SCALE (getkword "\Enter Scale [1]FULL,[2]1/2=1,[3]1/4=1,[4]1/8=1,[5]1/20=1,[6]1/30=1,[7]1/40=1,[8]1/50=1:")) (cond (COMMAND "30X42")) ((= SHEET "436X48") (INITGET "1FULL 21/2=1 31/4=1 41/8=1 51/20=1 61/30=1 71/40=1 81/50=1") (SETQ SCALE (getkword "\Enter Scale [1]FULL,[2]1/2=1,[3]1/4=1,[4]1/8=1,[5]1/20=1,[6]1/30=1,[7]1/40=1,[8]1/50=1:")) (cond (COMMAND "36X48")) ) ) ) ) (princ) ) (defun c:22X34 () (INITGET "1FULL 21/2=1 31/4=1 41/8=1 51/20=1 61/30=1 71/40=1 81/50=1") (SETQ SCALE (getkword "\Enter Scale [1]FULL,[2]1/2=1,[3]1/4=1,[4]1/8=1,[5]1/20=1,[6]1/30=1,[7]1/40=1,[8]1/50=1:")) (cond ((= SCALE "1FULL") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48")) ((= SCALE "21/2=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48")) ((= SCALE "31/4=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48")) ((= SCALE "41/8=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48")) ((= SCALE "51/20=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48")) ((= SCALE "61/30=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48")) ((= SCALE "71/40=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48")) ((= SCALE "81/50=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48")) ) ) ) ) ) ) ) ) (princ) ) Quote
Footpeg Posted August 23, 2008 Posted August 23, 2008 In "c:setup", the closing parenthesis for the cond statement were all mis-placed, the way the subsequent commands were called was incorrect, and those commands did not have to be inside of their own COND statement. While the code below works, you will find that running c:setup will cause the prompt for scale to be issued twice. For how I would structure these commands, scroll down to the next code box. (defun c:setup () (initget "122X34 224X36 330X42 436X48") (setq SHEET (getkword "\nEnter Sheet [1]22X34,[2]24X36,[3]30X42,[4]36X48: ")) (cond ((= SHEET "122X34") (INITGET "1FULL 21/2=1 31/4=1 41/8=1 51/20=1 61/30=1 71/40=1 81/50=1") (SETQ SCALE (getkword "\Enter Scale [1]FULL,[2]1/2=1,[3]1/4=1,[4]1/8=1,[5]1/20=1,[6]1/30=1,[7]1/40=1,[8]1/50=1:")) (c:22X34) ) ;_ cond1 ((= SHEET "224X36") (INITGET "1FULL 21/2=1 31/4=1 41/8=1 51/20=1 61/30=1 71/40=1 81/50=1") (SETQ SCALE (getkword "\Enter Scale [1]FULL,[2]1/2=1,[3]1/4=1,[4]1/8=1,[5]1/20=1,[6]1/30=1,[7]1/40=1,[8]1/50=1:")) (c:24X36) ) ;_cond2 ((= SHEET "330X42") (INITGET "1FULL 21/2=1 31/4=1 41/8=1 51/20=1 61/30=1 71/40=1 81/50=1") (SETQ SCALE (getkword "\Enter Scale [1]FULL,[2]1/2=1,[3]1/4=1,[4]1/8=1,[5]1/20=1,[6]1/30=1,[7]1/40=1,[8]1/50=1:")) (c:30X42) ) ;_ cond3 ((= SHEET "436X48") (INITGET "1FULL 21/2=1 31/4=1 41/8=1 51/20=1 61/30=1 71/40=1 81/50=1") (SETQ SCALE (getkword "\Enter Scale [1]FULL,[2]1/2=1,[3]1/4=1,[4]1/8=1,[5]1/20=1,[6]1/30=1,[7]1/40=1,[8]1/50=1:")) (c:36X48) ) ;_ cond4 ) ;_ cond (princ) ) ;_ defun c:setup (defun c:22X34 () (INITGET "1FULL 21/2=1 31/4=1 41/8=1 51/20=1 61/30=1 71/40=1 81/50=1") (SETQ SCALE (getkword "\Enter Scale [1]FULL,[2]1/2=1,[3]1/4=1,[4]1/8=1,[5]1/20=1,[6]1/30=1,[7]1/40=1,[8]1/50=1:")) (cond ((= SCALE "1FULL") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48") ) ((= SCALE "21/2=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48") ) ((= SCALE "31/4=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48") ) ((= SCALE "41/8=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48") ) ((= SCALE "51/20=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48") ) ((= SCALE "61/30=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48") ) ((= SCALE "71/40=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48") ) ((= SCALE "81/50=1") (COMMAND "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48") ) ) ) ;_ defun c:22X34 Here's how I would structure them: (defun c:setup () (initget "122X34 224X36 330X42 436X48") (setq SHEET (getkword "\nEnter Sheet [1]22X34,[2]24X36,[3]30X42,[4]36X48: ")) (cond ((= SHEET "122X34") (c:22X34) ) ;_ cond1 ((= SHEET "224X36") (c:24X36) ) ;_ cond2 ((= SHEET "330X42") (c:30X42) ) ;_ cond3 ((= SHEET "436X48") (c:36X48) ) ;_ cond4 ) ;_ cond (princ) ) ;_ defun c:setup (defun c:22X34 () (initget "1FULL 21/2=1 31/4=1 41/8=1 51/20=1 61/30=1 71/40=1 81/50=1") (setq SCALE (getkword "\Enter Scale [1]FULL,[2]1/2=1,[3]1/4=1,[4]1/8=1,[5]1/20=1,[6]1/30=1,[7]1/40=1,[8]1/50=1: ")) (command "_.LAYOUT" "D" "24X36" "_.LAYOUT" "D" "30X42" "_.LAYOUT" "D" "36X48") (cond ((= SCALE "1FULL") ;; do something here for full scale ) ;_ cond1 ((= SCALE "21/2=1") ;; do something here for 1/2=1 scale ) ;_ cond2 ((= SCALE "31/4=1") ;; do something here for 1/4=1 scale ) ;_ cond3 ((= SCALE "41/8=1") ;; do something here for 1/8=1 scale ) ;_ cond4 ((= SCALE "51/20=1") ;; do something here for 1/20=1 scale ) ;_ cond5 ((= SCALE "61/30=1") ;; do something here for 1/30=1 scale ) ;_ cond6 ((= SCALE "71/40=1") ;; do something here for 1/40=1 scale ) ;_ cond7 ((= SCALE "81/50=1") ;; do something here for 1/50=1 scale ) ;_ cond8 ) ;_ cond (princ) ) ;_ defun c:22X34 Footpeg 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.