TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: V@no on April 30, 2024, 07:44:42 PM

Title: entsel with ability enter numbers?
Post by: V@no on April 30, 2024, 07:44:42 PM
Is there a way prompt user to select an entity and at the same time accept a number as input?

Thank you.
Title: Re: entsel with ability enter numbers?
Post by: BIGAL on April 30, 2024, 08:22:19 PM
Do you mean select 5 objects but using ssget filters ? Using repeat may be the way to go. And look at Lee-Mac ssget functions, in particular :E
Title: Re: entsel with ability enter numbers?
Post by: V@no on April 30, 2024, 08:57:54 PM
SSGET might not be what I'm looking for, because it returns selected entity instead of prompt user (I need prompt user to select 2 entities individually, and keep first entity selected, while picking second one)
Title: Re: entsel with ability enter numbers?
Post by: V@no on April 30, 2024, 10:19:26 PM
My current hack is to include numbers in INITGET:
Code - Auto/Visual Lisp: [Select]
  1. (DEFUN c:test (/ commands i input)
  2.  
  3.     (SETQ commands ""
  4.           i        -1
  5.     )
  6.     (REPEAT 101
  7.         (SETQ commands (STRCAT commands " " (ITOA (SETQ i (1+ i)))))
  8.     )
  9.     (INITGET commands)
  10.     (SETQ input (ENTSEL "\nSelect object or enter a number 0-100: "))
  11.     (IF (= (TYPE input) 'STR)
  12.         (SETQ input (ATOI input))
  13.     )
  14.     (PRINC "\nresult: ")
  15.     (PRINC input)
  16.     (PRINC)
  17. )
It works for my needs, but it's just an ugly hack...
Title: Re: entsel with ability enter numbers?
Post by: BIGAL on May 02, 2024, 12:49:22 AM
Why not for 2 entities use entsel can have messages etc just do twice.

Code: [Select]
(setq ent1 (car (entsel "\Please pick object 1 ")))
(setq ent2  (car (entsel "\Please pick object 2 ")))

You can use (ssget pt) which selects a single item (ssname ss 0) useful if you want to show a drag line.

Title: Re: entsel with ability enter numbers?
Post by: V@no on May 02, 2024, 04:36:22 AM
Why not for 2 entities use entsel can have messages etc just do twice.
That's exactly what I'm using, except entsel doesn't allow arbitrary input (https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-9ED8841B-5C1D-4B3F-9F3B-84A4408A6BBF), hence is the hack above.

You can use (ssget pt) which selects a single item (ssname ss 0) useful if you want to show a drag line.
and pt is a set of coordinates? I think you lost me on this one.