TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Biscuits on January 20, 2023, 03:09:54 PM

Title: Selection question
Post by: Biscuits 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
 
Title: Re: Selection question
Post by: BIGAL 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)
Title: Re: Selection question
Post by: Lee Mac on January 22, 2023, 10:40:30 AM
Are you attempting to select an attribute reference, attribute definition, or text entity?
Title: Re: Selection question
Post by: Biscuits on January 23, 2023, 08:26:55 AM
It is an attribute definition