Pegar um Mtext na tela do autocad

Pegar um Mtext na tela do autocad

alexandre_benekowski
Advocate Advocate
797 Views
2 Replies
Message 1 of 3

Pegar um Mtext na tela do autocad

alexandre_benekowski
Advocate
Advocate

Olá Pessoal, 

 

Como faço para "pegar" um MTEXT na tela do autocad apenas clicando? Exemplo (o getselec não existe):

 

(setq ESTACA (getselec "\nClique na Estaca ....."))

 

aí posso usar a "ESTACA" no meu bloco atributado.

 

Para driblar essa minha deficiência uso atualmente o:

 

(setq ESTACA (getstring "\nDigite o valor da estaca..."))  mas deixa meu trabalho mais demorado.

 

Muito obrigado pela atenciosidade.

 

Att.

0 Likes
Accepted solutions (1)
798 Views
2 Replies
Replies (2)
Message 2 of 3

ВeekeeCZ
Consultant
Consultant
Accepted solution

See the test function...

 

(defun c:test nil

  (if (and (setq en (car (entsel "\nSelect a M/TEXT: ")))
         (wcmatch (cdr (assoc 0 (entget en))) "*TEXT")
         )
  (setq text (cdr (assoc 1 (entget en)))))

)

 

Or in your case (if I understood correctly...)

 

(setq estace (cond ((and (setq en (car (entsel "\nSelect a M/TEXT: ")))
                         (wcmatch (cdr (assoc 0 (entget en))) "*TEXT")
                         )
                    (cdr (assoc 1 (entget en))))))

 

 

Or function to copy selected TEXT to CLIPBOARD. See the spoiler.

 

Spoiler
(vl-load-com)

(defun c:CT ( / en tx html) ; Copy Text To Clipboard
  
  (and (setq en (car (nentsel "\nSelect text: ")))
       (setq en (vlax-ename->vla-object en))
       (vlax-property-available-p en 'textstring)
       (setq tx (vla-get-textstring en))
       (vlax-invoke (vlax-get (vlax-get (setq html (vlax-create-object "htmlfile")) 'ParentWindow) 'ClipBoardData) 'setData "Text" tx)
       (vlax-release-object html)
       )
  
  (princ)
)

 

Thx  @patrick_35 

Message 3 of 3

alexandre_benekowski
Advocate
Advocate

hei man!!

 

it´s amazing!!! thank you very much!!!

 

it work!!!

 

grateful!!!! 

0 Likes