masterfal Posted April 19 Posted April 19 ^C^C._SELECT;$M=$(if,$(eq,$(getvar,cmdnames),SELECT),_SI;\,(ssget);_SI;\)._COPY;_P;;\\._TEXTEDIT;_L;; Hi All, The simple macro above copies text and then after pasting brings up the edit text box. Is it possible to set this up as a lisp routine so i can set up a shortcut for quick use? Or does anyone have a similar lisp routine they can share? Thanks in advance! Quote
fuccaro Posted April 19 Posted April 19 This should work. (defun c:pp() (setq txt (car (entsel))) (cond ((and txt (= (cdr (assoc 0 (entget txt))) "TEXT")) (command "copy" txt "" pause pause) (command "textedit" "L" "") ) (t "wrong selection")) ) It can be improved... 1 Quote
masterfal Posted April 20 Author Posted April 20 yeh that works good. how can i amend so it includes "MTEXT" also? it works with MTEXT when i change the TEXT to that. i thought adding MTEXT there would add that option but it stops it working properly.. Quote
Nikon Posted April 20 Posted April 20 (edited) The macro copies the Mtext, and then, after pasting, opens the text editor ^C^C_Copy;\;@;\_MTEDIT;_Last Edited April 20 by Nikon Quote
masterfal Posted April 20 Author Posted April 20 3 minutes ago, Nikon said: The macro copies the Mtext, and then, after pasting, opens the edit Mtext field ^C^C_Copy;\;@;\_MTEDIT;_Last yeh the macro i pasted in original post did that as well as working with single line text i'm trying to work out how to achieve the same via lisp Quote
Nikon Posted April 20 Posted April 20 (edited) On 20.04.2024 at 08:22, masterfal said: yeh the macro i pasted in original post did that as well as working with single there is a slight difference between macros for MTEXT... Edited May 20 by Nikon Quote
Steven P Posted April 20 Posted April 20 Fuccaros code tests for text being selected, if you want text OR mtext you need to change the check line: (cond ((and txt (= (cdr (assoc 0 (entget txt))) "TEXT")) to include (or....) Untested replace with something like this: (cond ((and txt (or (= (cdr (assoc 0 (entget txt))) "TEXT") (= (cdr (assoc 0 (entget txt))) "MTEXT") ) ; endor ) ; end and 1 Quote
fuccaro Posted April 21 Posted April 21 I wrote the Lisp above to deal with texts according to OP's request. So the program checks first if there is anything selected, next it looks for the type of the selected entity. Yes, you can expand that second check by adding some ORs, or you could use wildcards. Another option could be to skip all these checks. Of course, in this case it is the user's responsibility to make correct selections. 1 Quote
masterfal Posted April 21 Author Posted April 21 i tweaked the code to include the (or...) as per Steven P suggestion and now it works perfect thanks for the help guys. much appreciated 1 Quote
pkenewell Posted April 21 Posted April 21 another way as fuccaro stated using wildcards: (cond ((and txt (wcmatch (cdr (assoc 0 (entget txt))) "TEXT,MTEXT")) 1 Quote
fuccaro Posted April 22 Posted April 22 There are many ways to skin this cat (cond ((and txt (wcmatch (cdr (assoc 0 (entget txt))) "*TEXT")) also works. 2 Quote
Nikon Posted April 22 Posted April 22 (edited) If you replace this string (command "textedit" "L" "") with (command "MTEDIT" "L" "") a copy of the mtext in the editor will be highlighted Edited May 20 by Nikon Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.