Jump to content

Erasing the text in the 2nd line of an Mtext


Recommended Posts

Posted
Not necessary, in case DXF 1 started with either "\\P" or "\n" and the next line of text didn't start until somewhere within the DXF 3 block perhaps.

254+ characters later

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    11

  • Lee Mac

    6

  • LearningLisP

    5

  • Tharwat

    2

Top Posters In This Topic

Posted Images

Posted
*shrug* just throwing it out there :)

uglyToLookAt.gif

My point was that if we're using the filter within ssget (since it only searches the first matching pair), it's kind of pointless to step through the entire entity data dump when it's only concerning itself with the first.

 

Boy, you will argue with a post. LoL

Posted

Just for grins and giggles (using my modded example):

 

(defun c:test (/ ss i e s)
 (vl-load-com)

 (if (setq ss (ssget "_:L" '((0 . "MTEXT"))))
   (repeat (setq i (sslength ss))
     (if (cond ((vl-string-search
                  "\\P"
                  (setq s (apply 'strcat
                                 (mapcar '(lambda (x)
                                            (if (vl-position (car x) '(1 3))
                                              (cdr x)
                                              ""
                                            )
                                          )
                                         (entget (setq e (ssname ss (setq i (1- i)))))
                                 )
                          )
                  )
                )
               )
               ((vl-string-search "\n" s))
         )
       (vla-put-Textstring
         (vlax-ename->vla-object e)
         (car
           (vl-remove
             ""
             (read
               (strcat "(\"" (LM:StringSubst "\" \"" "\\P" (LM:StringSubst "\" \"" "\n" s)) "\")")
             )
           )
         )
       )
     )
   )
 )
 (princ)
)
(defun LM:StringSubst (new old string / l i)
 (setq l (strlen new)
       i 0
 )
 (while (setq i (vl-string-search old string i))
   (setq string (vl-string-subst new old string i)
         i      (+ i l)
   )
 )
 string
)

Posted

wow.. i thought this was solved.. :).. you guys are genius!! thanks!

 

@Thalwart

ah ok.. maybe it wont work in an older version. thanks!

Posted

hey alan, tested your code and unfortunately, it did not work on me. i guess its my CAD version. thanks for updating it. :)

  • 2 years later...
Posted

Can you please suggest us how can we delete last line of the AutoCAD mtext by a single click through lisp file. Thanks in advance!

  • 5 years later...
Posted

IS THERE ANY CHOICE OPTION, any one can provide a lisp 

MAY BE IN SOME MTEXT I WANT REMOVE ABOVE 2 OR 3 LINE

MAY BE IN SOME MTEXT I WANT REMOVE BELOW ONE LINE (2 OR 3) .

 

*** MUST BE ASK CHOICE  (FROM ABOVE 1,2,3......OR FROM BELOW 1,2.3.....) LIKE THAT

 

THANKS 

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