TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: amc.dicsac on December 30, 2016, 11:59:16 AM

Title: Select Option
Post by: amc.dicsac on December 30, 2016, 11:59:16 AM
Hi how is it going

I am looking forward to this with ssget:

Select objects to add or [option1 / option2]: <option1>

But as can not be done with ssget I want to do with grread I do not know if someone could give me an idea, thanks
Title: Re: Select Option
Post by: Lee Mac on December 30, 2016, 12:24:40 PM
But as can not be done with ssget I want to do with grread I do not know if someone could give me an idea, thanks

https://www.theswamp.org/index.php?topic=34804.0
Title: Re: Select Option
Post by: Grrr1337 on December 30, 2016, 02:49:15 PM
Simpliest I could think of:

Code: [Select]
(defun C:test ( / SS1 SS2 p1 p2 )
  (while
    (and
      (or (setq SS1 (ssget "_I")) T)
      (not (initget "A B C D"))
      (setq p1 (getpoint "\nSelect objects or [A/B/C/D] <exit>: "))
    )
    (cond
      ((vl-consp p1)
        (not (initget "A B C D"))
        (setq p2 (getcorner p1 "\nSelect objects or [A/B/C/D] <exit>: "))
        (cond
          ((vl-consp p2)
            (setq SS2 (ssget "_C" p1 p2))
            (sssetfirst nil (acet-ss-union (list SS1 SS2)))
          )
          ((= 'STR (type p2))
            (alert (strcat "\nOption \"" p2 "\" was chosen."))
          )
        ); cond
      )
      ((= 'STR (type p1))
        (alert (strcat "\nOption \"" p1 "\" was chosen."))
      )
    ); cond
  ); while
); defun
Must include DEselect Option.