Jump to content

Rename a text


hidxb123

Recommended Posts

Hi friends

Can you pls provide me a lips for following

1) rename my Drawing no from 001-5020

to MUP-001-5050

 

2) rename my drawing no MUP-001-5050 To 001-5050

 

in first lips just add MUP-

In second just replace MUP-

 

Thanks

Link to comment
Share on other sites

Thanks mostafa

 

i mean the rename the text within in the drawing only..

rename the text with MUP-

 

 

 

Did you mean rename the title or rename the file ?
Link to comment
Share on other sites

Thanks mostafa

 

i mean the rename the text within in the drawing only..

rename the text with MUP-

What about find and replace?

Link to comment
Share on other sites

(defun c:SwitchTxt ( / enm obj str)
 (if
   (and
     (setq enm (car (nentsel)))
     (setq obj (vlax-ename->vla-object enm))
     (vlax-property-available-p obj 'textstring)
   )
   (vla-put-textstring
     obj
     (if (wcmatch (strcase (setq str (vla-get-textstring obj))) "MUP-*")
       (substr str 5)
       (strcat "MUP-" str)
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

Thank you

there is any lips , when i click on the text and it will automatically rename in to by adding "mup"+ current text

Ok try this.

(defun C:addmup ( / END ENT I SSET TXT)
 (setq sset (ssget '((0 . "*TEXT"))))
 (setq i (sslength sset))
 (while (not (minusp (setq i (1- i))))
   (setq ent (ssname sset i)
     end (entget ent)
     txt (cdr (assoc 1 end))
     end (subst(cons 1(if (strcat txt )(strcat "MUP-" txt)))
          (assoc 1 end) end))
   (entmod end)
 )
(princ)
)

Link to comment
Share on other sites

Excellent :D:D:D it works

how you learn this lips , i am using many lips, but all of them got contributed good people like you :)

when i will learn to make some lips :P

Link to comment
Share on other sites

Ok try this.
(defun C:addmup ( / END ENT I SSET TXT)
 (setq sset (ssget '((0 . "*TEXT"))))
 (setq i (sslength sset))
 (while (not (minusp (setq i (1- i))))
   (setq ent (ssname sset i)
     end (entget ent)
     txt (cdr (assoc 1 end))
     end (subst(cons 1(if (strcat txt )(strcat "MUP-" txt)))
          (assoc 1 end) end))
   (entmod end)
 )
(princ)
)

 

 

icon7.gif

 

Excellent
:D
:D:D it works

how you learn this lips , i am using many lips, but all of them got contributed good people like you
:)

when i will learn to make some lips
:P

Link to comment
Share on other sites

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