Author Topic: entsel with ability enter numbers?  (Read 282 times)

0 Members and 1 Guest are viewing this topic.

V@no

  • Newt
  • Posts: 25
  • AutoCAD 2023
entsel with ability enter numbers?
« 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.

BIGAL

  • Swamp Rat
  • Posts: 1425
  • 40 + years of using Autocad
Re: entsel with ability enter numbers?
« Reply #1 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
A man who never made a mistake never made anything

V@no

  • Newt
  • Posts: 25
  • AutoCAD 2023
Re: entsel with ability enter numbers?
« Reply #2 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)

V@no

  • Newt
  • Posts: 25
  • AutoCAD 2023
Re: entsel with ability enter numbers?
« Reply #3 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...

BIGAL

  • Swamp Rat
  • Posts: 1425
  • 40 + years of using Autocad
Re: entsel with ability enter numbers?
« Reply #4 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.

A man who never made a mistake never made anything

V@no

  • Newt
  • Posts: 25
  • AutoCAD 2023
Re: entsel with ability enter numbers?
« Reply #5 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, 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.