Jump to content

Recommended Posts

Posted

I have this lisp I used for basic ask and do commands:

 (defun c:SETUP ()
  (initget "122X34 224X36 330X42")
  (setq SIZE (getkword "\nEnter name [1]22X34,[2]24X36,[3]30X42: "))
(cond
     ((= SIZE "122X34")
        (initget "1FULL 21/2=1")
        (setq SCALE (getkword "\nEnter state [1]FULL,[2]1/2=1:"))
        (cond
           ((= SCALE "1FULL")
              (command "MIRRTEXT" "0"))
    ((= SCALE "21/2=1")
              (command "MIRRTEXT" "1"))                 
         )
     )
     ((= SIZE "224X36")
        (initget "1FULL 21/2=1")
        (setq SCALE (getkword "\nEnter state [1]FULL,[2]1/2=1:"))
        (cond
           ((= SCALE "1FULL")
              (command "MIRRTEXT" "0"))
          ((= SCALE "21/2=1")
             (command "MIRRTEXT" "1"))
        )
     )
     ((= SIZE "330X42")
        (initget "1FULL 21/2=1")
        (setq SCALE (getkword "\nEnter state [1]FULL,[2]1/2=1:"))
        (cond
           ((= SCALE "1FULL")
              (command "MIRRTEXT" "O"))
          ((= SCALE "21/2=1")
             (command "MIRRTEXT" "1"))
        )
     )
  )
  (princ)
)

 

Everything works fine I just want to add multiple line of command for each SCALE. What would I have to do to the lisp, for each line of extra commands. See below for what I mean! It will have this next to it(;;

 

((= SIZE "122X34")
        (initget "1FULL 21/2=1")
        (setq SCALE (getkword "\nEnter state [1]FULL,[2]1/2=1:"))
        (cond
           ((= SCALE "1FULL")
              (command "MIRRTEXT" "0"))
              (command "DIMSCALE" "48");;<==THIS IS WHAT I WANT TO ADD
              (command "LTSCALE" "24");;<==THIS IS WHAT I WANT TO ADD
    ((= SCALE "21/2=1")
              (command "MIRRTEXT" "1"))
              (command "DIMSCALE" "96");;<==THIS IS WHAT I WANT TO ADD
              (command "LTSCALE" "48");;<==THIS IS WHAT I WANT TO ADD  
         )
     )

 

I want to add something like that to each size under each scale option.

 

Thanks for everything in advance!!!

Posted

 

((= SIZE "122X34")
        (initget "1FULL 21/2=1")
        (setq SCALE (getkword "\nEnter state [1]FULL,[2]1/2=1:"))
        (cond
           ((= SCALE "1FULL")
              (command "MIRRTEXT" "0"))
              (command "DIMSCALE" "48"));;<==THIS IS WHAT I WANT TO ADD
              (command "LTSCALE" "24"));;<==THIS IS WHAT I WANT TO ADD
    ((= SCALE "21/2=1")
              (command "MIRRTEXT" "1"))
              (command "DIMSCALE" "96"));;<==THIS IS WHAT I WANT TO ADD
              (command "LTSCALE" "48"));;<==THIS IS WHAT I WANT TO ADD  
         )
     )

quote]

 

Why is it if I only put two command lines they both work, but if I add a third like above only the first and third ones work?

Posted

Hey neekcotrack

 

The code is fine, it is just a case of balancing the brackets

 

 

(cond

((= SCALE "1FULL")

(command "MIRRTEXT" "0"))

(command "DIMSCALE" "48"));;

(command "LTSCALE" "24"));;

 

 

Try keep all expresions to be evaluated for a particular condition in the same list

 

eg. (cond

((if true)(exp1)(exp2)(exp...));first expression

((if true)(exp...)) ;second expression

);end of cond

 

 

((= SIZE "122X34")

 (initget "1FULL 21/2=1")

 (setq SCALE (getkword "\nEnter state [1]FULL,[2]1/2=1:"))

 (cond

   ((= SCALE "1FULL")
    (command "MIRRTEXT" "0")
    (command "DIMSCALE" "48")
    (command "LTSCALE" "24")
    );end of first test

   ((= SCALE "21/2=1")
    (command "MIRRTEXT" "1")
    (command "DIMSCALE" "96")
    (command "LTSCALE" "48")
    );end of second test
   )
 )

 

Regards

jammie

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...