Jump to content

Recommended Posts

Posted
^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!

Posted

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... 

  • Like 1
Posted

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..  🤔

Posted (edited)

The macro copies the Mtext, and then, after pasting, opens the text editor

^C^C_Copy;\;@;\_MTEDIT;_Last

 

Edited by Nikon
Posted
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

Posted (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 by Nikon
Posted

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

 

  • Like 1
Posted

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.

  • Like 1
Posted

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

  • Like 1
Posted

another way as fuccaro stated using wildcards:

(cond ((and txt (wcmatch (cdr (assoc 0 (entget txt))) "TEXT,MTEXT"))

 

  • Like 1
Posted

There are many ways to skin this cat :)

(cond ((and txt (wcmatch (cdr (assoc 0 (entget txt))) "*TEXT"))

also works.

  • Like 2
Posted (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 by Nikon

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...