Author Topic: Selection question  (Read 240 times)

0 Members and 1 Guest are viewing this topic.

Biscuits

  • Swamp Rat
  • Posts: 501
Selection question
« on: January 20, 2023, 03:09:54 PM »
How would I go about changing the second line of code to avoid hitting enter?
I want to select the attribute definition automatically.

Code: [Select]
(defun C:MNO (/ str ss)
  (setq str (getstring "\nYour [MAPNO] string search: ")) ;
  (if (setq ss (ssget "_X" (list (cons 1 str) (cons 410 (getvar 'ctab)))))
  (sssetfirst nil ss)
  )
(command "justifytext" "previous" "" "mc")
)

Thanks
 
« Last Edit: January 20, 2023, 03:13:28 PM by Biscuits »

BIGAL

  • Swamp Rat
  • Posts: 1138
  • 40 + years of using Autocad
Re: Selection question
« Reply #1 on: January 21, 2023, 07:01:50 PM »
A slight change

Code: [Select]
(defun C:MNO (/ str ss)
  (setq str (getstring "\nYour [MAPNO] string search: ")) ;
  (if (setq ss (ssget "_X" (list (cons 0 "TEXT") (cons 1 str) (cons 410 (getvar 'ctab)))))
  (repeat (setq x (sslength ss))
    (setq ent (entget (ssname ss (setq x (1- x))) ))
    (entmod (subst (cons 73 2) (assoc 73 ent) ent))
  )
  )
)
(c:mno)
A man who never made a mistake never made anything

Lee Mac

  • Seagull
  • Posts: 12752
  • London, England
Re: Selection question
« Reply #2 on: January 22, 2023, 10:40:30 AM »
Are you attempting to select an attribute reference, attribute definition, or text entity?

Biscuits

  • Swamp Rat
  • Posts: 501
Re: Selection question
« Reply #3 on: January 23, 2023, 08:26:55 AM »
It is an attribute definition