Jump to content

Recommended Posts

Posted

I am looking for a way to prompt the user for a choice of Line/Circle/Options. If the user chooses options, I would like to be able to go back to the main choice of Line/Circle/Options until they choose Line or Circle. In the options I would have Layer/Linetype...

Im lost and not sure if I should use booleans or a while or what to choose.

Any thoughts,

matt worland

Posted

Check this out .......

 

(initget "Line Circle Options")
(setq reply (getkword "\n Specify your way [ Line,Circle,Options ]:"))

 

Regards,

 

Tharwat

Posted

Here's a simple example of what I undestand you are trying to achieve:

 

(defun c:test ( / flag ans1 ans2 )

 (while (not flag)

   (initget 1 "Line Circle Options")
   (setq ans1 (getkword "\nChoose Option [Line/Circle/Options]: "))

   (if (eq "Options" ans1)
     (progn
       (initget 1 "Layer lineType")
       (setq ans2 (getkword "\nChoose Secondary Option [Layer/lineType]: "))

       (alert (strcat "You chose: " ans2))
     )
     (setq flag T)
   )
 )

 (princ)
)

Here's a more complicated example:

 

(defun c:test ( / layer ltype )

 (while
   (progn (initget "Line Circle Options")
     (setq *ans*
       (cond
         (
           (getkword
             (strcat "\nChoose Option [Line/Circle/Options] <"
               (setq *ans*
                 (cond ( *ans* ) ( "Line" ))
               )
               "> : "
             )
           )
         )
         ( *ans* )
       )
     )
     (cond
       (
         (member *ans* '("Line" "Circle"))

         (command (strcat "_." *ans*))
         (while (= 1 (logand 1 (getvar 'CMDACTIVE))) (command pause))
       )
       (t
         (initget "Layer lineType")
         (if (eq "Layer" (getkword "\nChoose Secondary Option [Layer/lineType] <lineType> : "))
           (progn
             (while
               (not
                 (or
                   (eq "" (setq layer (getstring t "\nSpecify Layer <Exit> : ")))
                   (tblsearch "LAYER" layer)
                 )
               )
               (princ "\n** Layer Doesn't Exist **")
             )
             (if (not (eq "" layer)) (setvar 'CLAYER layer))
           )
           (progn
             (while
               (not
                 (or
                   (eq "" (setq ltype (getstring "\nSpecify Linetype <Exit> : ")))
                   (tblsearch "LTYPE" ltype)
                 )
               )
               (princ "\n** Linetype not Found **")
             )
             (if (not (eq "" ltype)) (setvar 'CELTYPE ltype))
           )
         )
         t
       )
     )
   )
 )

 (princ)
)
     

Got a bit carried away with that one... :geek:

 

 

This might also help you:

http://lee-mac.com/promptwithdefault.html

Posted

Sorry for the delayed response, these are exactly what I was after. Thank-you

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...