Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MTEXT Edit Select All Text

11 REPLIES 11
Reply
Message 1 of 12
dbinkney
4708 Views, 11 Replies

MTEXT Edit Select All Text

I am curious if there is a way to have MTEXT editor automatically select all the text in the particular item. 

 

I am doing a lot of copy/paste/edit, and every time that I do an MTEXT edit, I first have to hit CTRL-A to select everything in the item.  Is there a command or variable that will automatically select all of the text when I double click the item, so I don't have to keep hitting CTRL-A?

 

Thanks,


-Dan

Tags (1)
11 REPLIES 11
Message 2 of 12
scot-65
in reply to: dbinkney

I can get you started on a LISP expression.
Go into customization forum and ask how to take this and "Match String" or send to the clipboard...

(cdr (assoc 1 (entget (car (entsel "Select MText object: ")))))

Or a more expanded and somewhat foolproof method [one method]:

(if (setq d (entsel "Select MText object: "))
(if (= (cdr (assoc 0 (entget (car d)))) "MTEXT")
(setq d1 (cdr (assoc 1 (entget (car d)))))
(alert "Object selected not MText. ")
);if
(alert "Nothing selected. ")
);if

You did not mention if you are using LT?

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Message 3 of 12
dbinkney
in reply to: scot-65

I'm using Civil 3D 2014 Infrastructure Design Suite Premium.

Thank you very much! I am going to enlist some help with getting the LISP entered, and will let you know if I have any problems.
Message 4 of 12
msarqui
in reply to: dbinkney

Hi,

I am searching for the same solution!
Could you post the link please?

Thanks!
Message 5 of 12
skultan172
in reply to: msarqui

I sought out a solution for this,

Lee at http://www.lee-mac.com/ came up with the following code that accomplishes just what you are looking for.

 

Add this to your "acaddoc.lsp" file using a text editor:

 

(   (lambda nil (vl-load-com)
        (foreach r (cdar (vlr-reactors :vlr-command-reactor))
            (if (= "acdbmtext-reactor" (vlr-data r))
                (vlr-remove r)
            )
        )
        (vlr-set-notification
            (vlr-command-reactor "acdbmtext-reactor"
               '((:vlr-commandwillstart . acdbmtext-reactor-callback))
            )
            'active-document-only
        )
        (defun acdbmtext-reactor-callback ( a b / w )
            (if (= "mtedit" (strcase (car b) t))
                (if (setq w (vlax-create-object "wscript.shell"))
                    (progn
                        (vl-catch-all-apply 'vlax-invoke (list w 'sendkeys "^{HOME}(^+{END})"))
                        (vlax-release-object w)
                    )
                )
            )
        )
        (princ)
    )
)

You can find your "acaddoc.lsp" file by entering the following into the command line in autocad:

 

(startapp "notepad" (findfile "acaddoc.lsp"))

 

If you don't have an "acaddoc.lsp" file create it at:

%appdata%\Autodesk\Your CAD Version\enu\Support

 

It is important to note that you will probably have to restart your session of autoCAD after you save acaddoc.lsp

 

Thanks, to Lee!

-Skultan

Message 6 of 12
steve216586
in reply to: dbinkney

Double clicking only selects a single line of text in the editor. To use a built in feature, you would have to click at the beginning (or end) of the text and hold to the opposite end of text, and click again to highlight all.

"No one can make you feel inferior without your consent. "-Eleanor Roosevelt
Message 7 of 12
Kent1Cooper
in reply to: steve216586

This question has come up before, probably more than once.  I don't recall the Subject lines of threads about it, but a Search should reveal some approaches in addition to the reactor version posted above.

Kent Cooper, AIA
Message 8 of 12
msarqui
in reply to: skultan172

Amazing!

Thanks to Lee and to you Skultan for sharing this! 🙂

 

Message 9 of 12
Lee_Mac
in reply to: msarqui

msarqui wrote:

Amazing!

Thanks to Lee and to you Skultan for sharing this! 🙂

 

Many thanks - I'm glad it proved useful!

Message 10 of 12
msarqui
in reply to: Lee_Mac

Hi Lee,

 

Do you think this could also be made for a multiple line attribute with ATTIPEDIT?

 

Thanks

 

Marcelo

Message 11 of 12
cgentile
in reply to: Lee_Mac

Hey Lee, I'm trying to use your reactor, but the reactor isn't picking up the mtedit on the last of the this routine. Any suggestions? 

(defun c:lab ( )

(if (not *sty1*) (setq *sty1* "Simplex"))
(if (not *sty2*) (setq *sty2* "Regular"))
(if (not *siz*) (setq *siz* "Small"))
(if (not *scl*) (setq *scl* 1))

(initget 128 "Style siZe")
(setq pt (getpoint (strcat "\nSelect insertion point for text or select current [Style/siZe] <" *sty1* ">: ")))

(cond
	((= pt "Style")
		(initget "Simplex Regular Condensed")
		(setq	*sty1*	(cond ((getkword (strcat "\nChoose [Simplex/Regular/Condensed] <" *sty1* ">: "))) (*sty1*)))
	
		(cond 
			((= *sty1* "Regular")
				(initget "Regular Bold Italic")
				(setq	*sty2*	(cond ((getkword (strcat "\nChoose [Regular/Bold/Italic] <" *sty2* ">: "))) (*sty2*)))
			)
			
			((= *sty1* "Condensed")
				(initget "Regular Bold Italic")
				(setq	*sty2*	(cond ((getkword (strcat "\nChoose [Regular/Bold/Italic] <" *sty2* ">: "))) (*sty2*)))
	)))
	
	((= pt "siZe")
		(initget "Small Medium lArge largeR")
		(setq	*siz*	(cond ((getkword (strcat "\nChoose [Small/Medium/lArge/largeR] <" *siz* ">: "))) (*siz*)))
		
		(cond
			((and (= *siz* "Small")) (setq *scl* 1))		;1/8 = 0.125
			((and (= *siz* "Medium")) (setq *scl* 1.5))		;3/16 = 0.1875
			((and (= *siz* "lArge")) (setq *scl* 2))		;1/4 = 0.25
			((and (= *siz* "largeR")) (setq *scl* 3))		;3/8 = 0.375
				
			; ((and (= (getvar 'useri1) 128) (= *siz* "Small")) (setq *scl* 1));3/32 = 0.09375
			; ((and (= (getvar 'useri1) 128) (= *siz* "Medium")) (setq *scl* 1.666));5/32 = 0.15625
			; ((and (= (getvar 'useri1) 128) (= *siz* "lArge")) (setq *scl* 2.333));7/32 = 0.21875
			; ((and (= (getvar 'useri1) 128) (= *siz* "largeR")) (setq *scl* 4.333));13/32 = 0.40625
		)))
	
(cond
	((= *sty1* "Simplex") (setq *sty* "Simplex"))
	
	((and (= *sty1* "Regular") (= *sty2* "Regular")) (setq *sty* "U001"))
	((and (= *sty1* "Regular") (= *sty2* "Bold")) (setq *sty* "U001 Bold"))
	((and (= *sty1* "Regular") (= *sty2* "Italic")) (setq *sty* "U001 Italic"))
	
	((and (= *sty1* "Condensed") (= *sty2* "Regular")) (setq *sty* "U001 Con"))
	((and (= *sty1* "Condensed") (= *sty2* "Bold")) (setq *sty* "U001 Con Bold"))
	((and (= *sty1* "Condensed") (= *sty2* "Italic")) (setq *sty* "U001 Con Italic"))
	)
	


(setq
	clay	(getvar 'clayer)
	blk	(strcat "*" @blk "txt_" *sty* ".dwg")
	lay	"0L_CALL_TEXT"
	ascl (getvar 'cannoscalevalue)
	)

(command "-layer" "m" lay "")	

(if (tblsearch "layer" lay)
	(progn 
		(command "-insert" blk (if (listp pt) pt pause) (/ *scl* ascl) pause)
		(command "mtedit" (entlast))
	)
	(progn
		(command "-insert" blk "0,0" "1" "1" "0")
		(command "erase" (entlast) "")
		(command "-insert" blk (if (listp pt) pt pause) (/ *scl* ascl) pause)
		(command "mtedit" (entlast))
	))

(setvar 'clayer clay)

(princ)
)

 Thanks!

Message 12 of 12
msarqui
in reply to: Lee_Mac

How can I disable this reactor?

Thanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost