See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: Wildcard Character * Not Allowing Renaming of Multiple Layers

  1. #1
    100 Club
    Join Date
    2005-04
    Posts
    112
    Login to Give a bone
    0

    Angry Wildcard Character * Not Allowing Renaming of Multiple Layers

    In the RENAME dialog, I am using the *wildcard character to rename multiple layers.
    See Attached.
    But No Layers are renamed.
    What's the problem?

    Thanks
    Attached Files Attached Files

  2. #2
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,507
    Login to Give a bone
    0

    Default Re: Wildcard Character * Not Allowing Renaming of Multiple Layers

    Quote Originally Posted by rbdome View Post
    In the RENAME dialog, I am using the *wildcard character to rename multiple layers.
    See Attached.
    But No Layers are renamed.
    What's the problem?

    Thanks
    I don't think you can use (2) wildcards, I've tried it before too and couldn't make it work.
    You many have to do it in pieces:

    Rename:
    "Lev2-~Anno*" to "Lev2-~An*"

    "Lev5 Deluxe Suite-~Anno*" to "Lev5 Deluxe Suite-~An*"

    And so on.
    Realizing that you seem to only have a couple changes per type, not real efficient.

    I agree it should work as you attempted, but it doesn't.
    Unless someone else has better advice.

  3. #3
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Wildcard Character * Not Allowing Renaming of Multiple Layers

    tedg's method is the best you could ever do using Rename.

    cadtag's alternative http://forums.augi.com/showthread.ph...=1#post1289182

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    1

    Default Re: Wildcard Character * Not Allowing Renaming of Multiple Layers

    I've not downloaded the PDF (I prefer the contents included in the post, personally).

    That said, I *think* this old LISP routine might be of use; It is case-sensitive (just like WCMATCH), and can effectively replace sub-strings in the middle of a given Layer name:

    Code:
    (vl-load-com)
    
    (defun c:LAYREN () (c:LayerRename))
    (defun c:LayerRename
           (/ *error* old new acDoc oLayers i oldName newName)
    
      (defun *error* (msg)
        (if acDoc
          (vla-endundomark acDoc)
        )
        (cond ((not msg))                                                   ; Normal exit
              ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
              ((princ (strcat "\n** Error: " msg " ** ")))                  ; Fatal error, display it
        )
        (princ)
      )
    
      (if (and (setq old (getstring T "\nEnter string to replace: "))
               (setq new (getstring T "\nEnter replacement string: "))
          )
        (progn
          (vla-startundomark
            (setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
          )
          (setq oLayers (vla-get-layers acDoc))
          (setq i 0)
          (vlax-for x oLayers
            (if (vl-string-search old (setq oldName (vla-get-name x)))
              (if
                (tblsearch "layer"
                           (setq newName (vl-string-subst new old oldName)) ; single replacement only
                )
                 (prompt
                   (strcat
                     "\nLayer \""
                     newName
                     "\" already exists. "
                     "Move all objects, then delete layer \""
                     oldName
                     "\" "
                   )
                 )
                 (progn
                   (vla-put-name x newName)
                   (setq i (1+ i))
                 )
              )
            )
          )
          (prompt
            (strcat "\n"
                    (itoa i)
                    " layer"
                    (if (= 1 i)
                      " "
                      "s "
                    )
                    "renamed. "
            )
          )
        )
      )
    
      (*error* nil)
    )
    Quick example from Command Line:

    Code:
    Command:
    Command: LAYREN
    Enter string to replace: ANNO
    Enter replacement string: AN
    46 layer renamed.
    Command:

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    100 Club david-k's Avatar
    Join Date
    2015-12
    Location
    San Diego, CA
    Posts
    100
    Login to Give a bone
    0

    Default Re: Wildcard Character * Not Allowing Renaming of Multiple Layers

    Quote Originally Posted by BlackBox View Post
    ...That said, I *think* this old LISP routine might be of use; It is case-sensitive (just like WCMATCH), and can effectively replace sub-strings in the middle of a given Layer name...
    Is this your code? I may want to keep it with me, as it may come in handy, and want to give proper credit .

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Wildcard Character * Not Allowing Renaming of Multiple Layers

    Quote Originally Posted by david-k View Post
    Is this your code? I may want to keep it with me, as it may come in handy, and want to give proper credit .
    It is, yes - no need for attribution, and feel free to take from it what you like.


    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    100 Club david-k's Avatar
    Join Date
    2015-12
    Location
    San Diego, CA
    Posts
    100
    Login to Give a bone
    0

    Default Re: Wildcard Character * Not Allowing Renaming of Multiple Layers


    Cheers!

Similar Threads

  1. 2007: RENAMING MULTIPLE LAYERS
    By cad2335 in forum AutoCAD General
    Replies: 6
    Last Post: 2015-03-18, 12:11 PM
  2. Renaming blocks with wildcard characters
    By Wanderer in forum AutoCAD Map 3D - General
    Replies: 11
    Last Post: 2010-03-15, 03:15 PM
  3. Wildcard layers in xrefedit
    By Ddameron in forum AMEP General
    Replies: 3
    Last Post: 2008-03-31, 08:57 PM
  4. Wildcard Key use in Renaming Blocks Lost
    By rbdome in forum AutoCAD General
    Replies: 1
    Last Post: 2007-09-25, 02:02 AM

Posting Permissions

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