Results 1 to 5 of 5

Thread: Rename multiple blocks

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2009-10
    Posts
    1
    Login to Give a bone
    0

    Default Rename multiple blocks

    Hi,

    is there some lisp/script, which renames multiple blocks in multiple drawings. I have about 300 blocks and 300 drawings and i need to rename every block in every drawing (about 10 blocks in one drawing). All the same, there aren't every 300 blocks in every drawing and that causes problems. I have a script, which works if there is every 300 block in one drawing, but there never is all the blocks in one drawing. I think i need to use some lisp with tblsearch-command, but i have no idea how to make a table where is "oldname" and "newname").

    The command i want to use is something like this

    rename block "oldname1" "newname1"
    rename block "oldname2" "newname2"
    rename block "oldname3" "newname3"
    rename block "oldname4" "newname3"

    Does anyone have an aid to deal with this problem?

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Rename multiple blocks

    What happens if the oldname1 and newname1 are in the same drawing?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    Member
    Join Date
    2009-07
    Posts
    45
    Login to Give a bone
    0

    Default Re: Rename multiple blocks

    Quote Originally Posted by vesa.hytonen View Post
    Hi,

    is there some lisp/script, which renames multiple blocks in multiple drawings. I have about 300 blocks and 300 drawings and i need to rename every block in every drawing (about 10 blocks in one drawing). All the same, there aren't every 300 blocks in every drawing and that causes problems. I have a script, which works if there is every 300 block in one drawing, but there never is all the blocks in one drawing. I think i need to use some lisp with tblsearch-command, but i have no idea how to make a table where is "oldname" and "newname").

    The command i want to use is something like this

    rename block "oldname1" "newname1"
    rename block "oldname2" "newname2"
    rename block "oldname3" "newname3"
    rename block "oldname4" "newname3"

    Does anyone have an aid to deal with this problem?
    +

    Down here in this page is the layer renamer... that is the one I modified to be used with blocks... Also, this post has been already answered in Cadtutor by someone else and me...

    hope it really helps you with your current task..

  4. #4
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Rename multiple blocks

    Maybe something like this:

    Code:
    (defun BlockRename (#OldName #NewName)
      (and
        (tblsearch "block" #OldName)
        (not (tblsearch "block" #NewName))
        (snvalid #NewName)
        (or *AcadDoc*
            (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))
        ) ;_ or
        (not (vl-catch-all-error-p
               (vl-catch-all-apply
                 'vla-put-name
                 (list (vla-item (vla-get-blocks *AcadDoc*) #OldName) #NewName)
               ) ;_ vl-catch-all-apply
             ) ;_ vl-catch-all-error-p
        ) ;_ not
      ) ;_ and
    ) ;_ defun
    Returns T if renamed, nil if not.
    Last edited by alanjt; 2009-10-07 at 08:34 PM.

  5. #5
    Woo! Hoo! my 1st post
    Join Date
    2012-09
    Posts
    1
    Login to Give a bone
    0

    Default Re: Rename multiple blocks

    hi, try use RENAME command
    eg,

    which one u want remove just select that one and remove (oldname1- old*) and in rename to new*, try this it will work

Similar Threads

  1. rename selected blocks
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2017-08-10, 08:46 AM
  2. Rename Blocks and Multi-View Blocks within AutoCAD
    By Wish List System in forum ACA Wish List
    Replies: 3
    Last Post: 2013-12-06, 08:53 AM
  3. Rename Blocks?
    By BILLYJOW in forum AutoLISP
    Replies: 26
    Last Post: 2013-01-11, 10:28 AM
  4. Rename blocks
    By godfrey0417 in forum AutoCAD Tips & Tricks
    Replies: 2
    Last Post: 2007-10-12, 03:38 PM
  5. Rename Anonymous Blocks
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2007-08-23, 12:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •