View Full Version : 2010 I need Help with Mtext
s.wasseem90681967
2014-10-26, 05:02 AM
Hi everyone, I'm using Autocad 2010.
is there any way to select random Mtexts and gather them in one column and sort them in Ascending order.
hints:
* Mtext contain text and numbers.
* Mtexts are not similar in height, color, style, layer ..... etc.
Thank you;
M.Jamal Khan
2014-11-11, 08:34 AM
Hi everyone, I'm using Autocad 2010.
is there any way to select random Mtexts and gather them in one column and sort them in Ascending order.
hints:
* Mtext contain text and numbers.
* Mtexts are not similar in height, color, style, layer ..... etc.
Thank you;
1st isolate these text
then type TXT2MTXT in command line
and select all require text...
it will come in one paragraph...
lesleys
2014-11-11, 11:08 AM
1st isolate these text
then type TXT2MTXT in command line
and select all require text...
it will come in one paragraph...
TXT2MTXT is an express tools command so you will need to have those loaded. Also it will not combine objects that are ALREADY mtxt. You could explode the text first then the TXT2MTXT will work. Not sure how you can arrange them in any specific order other than editing them after.
Someone here (One of the clever folk of which there are many) may suggest some lisp that might work
Tom Beauford
2014-11-12, 12:22 PM
This should join them, not sure what you mean by sorting them. Maybe if you gave an example of before and after texts.
; Written By: Peter Jamtgaard 2005
; Modified to work with Text or MText by: Tom Beauford
(defun C:TextJoin (/ intCount entSelection objSelection
objSelection1 ssSelections btwtxt)
; (vl-load-com) ;no longer needed in Autocad 2005
(princ "\nSelect First Text or MText Entity: ")
(while (not (and (setq ssSelections (ssget ":S" (list (cons 0 "TEXT,MTEXT"))))
(setq entSelection (ssname ssSelections 0))
(setq objSelection1 (vlax-ename->vla-object entSelection))
)
)
(princ "\nError with selection please select again: ")
)
(if(=(cdr(assoc 0 (entget entSelection))) "MTEXT")
(setq btwtxt "\\P") ;Return in MText.
(setq btwtxt " ") ;Or space between Text selections.
)
(vl-catch-all-apply 'vla-put-Layer (list objSelection1 "0"))
(redraw(ssname(ssget "P")0)3) ;Highlight First selection.
(princ "\nSelect text or mtext entities to add to first: ")
(setq thisdrawing (vla-get-activedocument (vlax-get-acad-object))
ssSelections (ssget (list (cons 0 "TEXT,MTEXT")))
intCount 0 ;Start with first selection.
)
(if(ssmemb entSelection ssSelections)(ssdel entSelection ssSelections))
; Don't delete First selection if selected again.
(repeat (sslength ssSelections)
(vla-startundomark thisdrawing)
(setq entSelection (ssname ssSelections intCOunt)
objSelection (vlax-ename->vla-object entSelection)
intCount (1+ intCount) ;increment to next selection.
)
(if(= btwtxt " ")
(while(vl-string-search "\\P" (vla-get-textstring objSelection))
(vla-put-textstring objSelection
(vl-string-subst " " "\\P" (vla-get-textstring objSelection))
)
)
)
(vla-put-textstring objSelection1
(strcat
(vla-get-textstring objSelection1)
btwtxt
(vla-get-textstring objSelection)
)
)
(vla-delete objSelection)
(vla-endundomark thisdrawing)
)
(princ)
)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.