Author Topic: Getpoint Option  (Read 3161 times)

0 Members and 1 Guest are viewing this topic.

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
Getpoint Option
« on: January 31, 2017, 09:21:45 PM »
Hi, how are you:

I would like to know how I can have two options that are permuted ie if I have:

Code - Auto/Visual Lisp: [Select]
  1. (setq pt1 T)
  2. (while pt1
  3. (initget "Horizontal Eliminar")
  4. (setq pt1 (getpoint "\nIndica punto de origen Vertical ó [Horizontal/Eliminar]: "))
  5.   ((= (type pt1) 'LIST) (vl-cmdf "_xline" "V" pt1 ""))
  6.   ((= pt1 "Eliminar")
  7.    (setq ObjSelect (ssget "x" (list (cons 8 "0-DEUSTUA PROYECCION"))))
  8.    (command ".erase" ObjSelect ""))
  9.   ((= pt1 "Horizontal")
  10.    (setq pt1 (getpoint "\nIndica punto de origen Horizontal ó [Vertical/Eliminar]: "))
  11.    (vl-cmdf "_xline" "H" pt1 "")))
  12.   )
  13.  

And when you select "Horizontal" this will hold as follows until you exit the loop.

Code - Auto/Visual Lisp: [Select]
  1. (setq pt1 (getpoint "\nIndica punto de origen Horizontal ó [Vertical/Eliminar]: "))
  2.   ((= (type pt1) 'LIST) (vl-cmdf "_xline" "H" pt1 ""))
  3.   ((= pt1 "Eliminar")
  4.    (setq ObjSelect (ssget "x" (list (cons 8 "0-DEUSTUA PROYECCION"))))
  5.    (command ".erase" ObjSelect ""))
  6.   ((= pt1 "Horizontal")
  7.    (setq pt1 (getpoint "\nIndica punto de origen Vertical ó [Horizontal/Eliminar]: "))
  8.    (vl-cmdf "_xline" "V" pt1 "")))
  9.   )
  10.  

Thanks....
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: Getpoint Option
« Reply #1 on: February 01, 2017, 10:06:19 AM »
Hi, try this:
Code - Auto/Visual Lisp: [Select]
  1. (setq opts '("Horizontal" "Eliminar"))
  2. (setq msg "\nIndica punto de origen Vertical ó ")
  3. (while (not Stop)
  4.   (initget (strcat (car opts) " " (cadr opts)))
  5.   (setq pt1 (getpoint (strcat msg "[" (car opts) "/" (cadr opts) "] <exit>: ")))
  6.   (cond
  7.     ( (and (vl-consp pt1) (vl-every 'numberp pt1))
  8.       (cond
  9.         ( (member "Horizontal" opts) (command "_.XLINE" "V" pt1 "") )
  10.         ( (member "Vertical" opts) (command "_.XLINE" "H" pt1 "") )
  11.       ); cond
  12.       (setq Stop T)
  13.     )
  14.     ( (eq 'STR (type pt1))
  15.       (cond
  16.         ( (wcmatch pt1 "V*")
  17.           (setq opts '("Horizontal" "Eliminar"))
  18.           (setq msg "\nIndica punto de origen Vertical ó ")
  19.         )
  20.         ( (wcmatch pt1 "H*")
  21.           (setq opts '("Vertical" "Eliminar"))
  22.           (setq msg "\nIndica punto de origen Horizontal ó ")
  23.         )
  24.         ( (wcmatch pt1 "E*")
  25.           (setq ObjSelect (ssget "_X" (list (cons 8 "0-DEUSTUA PROYECCION"))))
  26.           (command "_.ERASE" ObjSelect "")
  27.           (setq Stop T)
  28.         )
  29.       ); cond
  30.     )
  31.     (T (setq Stop T) )
  32.   ); cond
  33. ); while
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
Re: Getpoint Option
« Reply #2 on: February 01, 2017, 10:51:11 AM »
Thanks was what I was looking for  :smitten:
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Getpoint Option
« Reply #3 on: February 01, 2017, 01:14:16 PM »
To offer an alternative: Custom XLine Program - you could quite easily add the option to erase existing XLines.

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: Getpoint Option
« Reply #4 on: February 01, 2017, 04:06:37 PM »
To offer an alternative: Custom XLine Program - you could quite easily add the option to erase existing XLines.
Nice,
I remember once I rewrote the LAYMCUR command, using the loop with (/= 52 (getvar 'errno)) - not sure who, but I think you were the inventor of this (errno 52 trick).
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Getpoint Option
« Reply #5 on: February 02, 2017, 12:49:27 AM »
That error code use has been around for a very long time.  8)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.


Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Getpoint Option
« Reply #7 on: February 02, 2017, 07:53:03 AM »
To offer an alternative: Custom XLine Program - you could quite easily add the option to erase existing XLines.
Nice,

Thanks  :-)

not sure who, but I think you were the inventor of this (errno 52 trick).

Most definitely not... there is very little in AutoLISP which has not been done before.  :wink:

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
Re: Getpoint Option
« Reply #8 on: February 02, 2017, 08:51:24 AM »
That error code use has been around for a very long time.  8)
at least since 2001... 8-)
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/if-statement-revisited/td-p/788306

Hey Marc!  Thanks for the trip down memory lane!  I was already visiting it yesterday as it was Frank's birthday.  If I remember correctly, that post happened just about the same time I joined with the guys at acadx.com.



Bobby C. Jones

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Getpoint Option
« Reply #9 on: February 02, 2017, 09:02:27 AM »
Believe it or not somewhere I have the unopened box of AutoCAD LT I won for submitting the name acadx.com in Frank's "Hey y'all -- name my new website" contest. I tried to talk Frank out of the name and refuse the prize upon learning Tony T had a software product by the same name but Frank wouldn't change his mind, seemed even more convinced it was the right name. He'd already had some "interesting" exchanges with Tony by then (Frank didn't monopolize Tony's wrath mind you) so I'm not sure what he was thinking. Anyway ... As you know Frank and Tony would go many bloody rounds on the issue. I always regretted having unwittingly contributed to it.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
Re: Getpoint Option
« Reply #10 on: February 02, 2017, 09:26:42 AM »
Believe it or not somewhere I have the unopened box of AutoCAD LT I won for submitting the name acadx.com in Frank's "Hey y'all -- name my new website" contest. I tried to talk Frank out of the name and refuse the prize upon learning Tony T had a software product by the same name but Frank wouldn't change his mind, seemed even more convinced it was the right name. He'd already had some "interesting" exchanges with Tony by then (Frank didn't monopolize Tony's wrath mind you) so I'm not sure what he was thinking. Anyway ... As you know Frank and Tony would go many bloody rounds on the issue. I always regretted having unwittingly contributed to it.

That is an awesome bit of trivia I didn't know, although I find it non-surprising, even fulfilling, that you came up with that name :)  But please don't have any regrets, Frank very much enjoyed the friction with Tony; a steel sharpens steel kind of thing.  Privately he warned both Bob B. and I to be careful when sparring with Tony as, "he has the skills to mop us up with any of his code", but publicly he relished every opportunity that he happened upon, or could create, to 'exchange' with Tony, or anyone else he thought was worthy :)

I haven't kept up over the years, anyone know what's up with Tony?
Bobby C. Jones

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Getpoint Option
« Reply #11 on: February 02, 2017, 10:02:32 AM »
That error code use has been around for a very long time.  8)
at least since 2001... 8-)
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/if-statement-revisited/td-p/788306

Hey Marc!  Thanks for the trip down memory lane!  I was already visiting it yesterday as it was Frank's birthday.  If I remember correctly, that post happened just about the same time I joined with the guys at acadx.com.
:-)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Getpoint Option
« Reply #12 on: February 02, 2017, 11:41:18 PM »
1. That is an awesome bit of trivia I didn't know, although I find it non-surprising, even fulfilling, that you came up with that name :)  2. But please don't have any regrets, Frank very much enjoyed the friction with Tony; a steel sharpens steel kind of thing.  3. Privately he warned both Bob B. and I to be careful when sparring with Tony as, "he has the skills to mop us up with any of his code", 4. but publicly he relished every opportunity that he happened upon, or could create, to 'exchange' with Tony, or anyone else he thought was worthy :)

5. I haven't kept up over the years, anyone know what's up with Tony?

1. :-)
2. True, he loved to to wind things up. He basically dismantled the Take5 forum because he would stir up hornets nest after hornets nest. Drove poor Anne Brown (Autodesk moderator) crazy.
3. Tony's coding still remains the standard for efficiency, thoroughness, robustness. I wish I knew a tenth of what he's forgotten.
4. See response to item 2.
5. Haven't seen a post from him in ages. Hope he's well & relaxing, he's certainly earned it.

Awesome to see you posting Bobby. You remain one of the finest forumites I ever e-met -- on any forum. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst