See the top rated post in this thread. Click here

Page 1 of 4 1234 LastLast
Results 1 to 10 of 36

Thread: Remove $0$ and everything before from Layer names

  1. #1
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Question Remove $0$ and everything before from Layer names

    Hi everyone,

    Does someone know how to write a lisp or know where I can find the code, that will remove $0$ and everything before that from the layer name in the layer manager.

    From this - 532-IMP-BASE$0$area
    to this - area

    We are binding all the Civil, Architecture, & our base file to map a key map for the project.

    Thanks,

    Kyle C.

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

    Default Re: Remove $0$ and everything before from Layer names

    When you BIND the xref, have you tried the INSERT option? I believe this would resolve the problem, unless you have already done the binding.
    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
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Remove $0$ and everything before from Layer names

    Opie,

    I did use the insert option when I binded the xref's, thats why I got the $0$.

    but thanks for your input.

    Kyle C.

    Quote Originally Posted by Opie
    When you BIND the xref, have you tried the INSERT option? I believe this would resolve the problem, unless you have already done the binding.

  4. #4
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Remove $0$ and everything before from Layer names

    Quote Originally Posted by kylec_edg
    . . .I did use the insert option when I binded the xref's, thats why I got the $0$. . . .
    Nope,

    you can
    bind as bind
    and
    bind as insert

    : ) Happy computing !

    kennet

  5. #5
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Remove $0$ and everything before from Layer names

    Quote Originally Posted by kylec_edg
    . . . From this - 532-IMP-BASE$0$area
    to this - area . . .
    This is a sticky task,
    if layer area do not exist, rename is easy to do,
    if layer area exist, objects must move from .....$0$area to layer area.

    : ) Happy Computing !

    kennet

  6. #6
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Remove $0$ and everything before from Layer names

    kennet,

    No new layers exist other then the layers that we added in our base file, because all I am doing is doing a save as of our base and binding the xref's.

    Kyle C.


    Quote Originally Posted by kennet.sjoberg
    This is a sticky task,
    if layer area do not exist, rename is easy to do,
    if layer area exist, objects must move from .....$0$area to layer area.

    : ) Happy Computing !

    kennet

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

    Default Re: Remove $0$ and everything before from Layer names

    Quote Originally Posted by kylec_edg
    kennet,

    No new layers exist other then the layers that we added in our base file, because all I am doing is doing a save as of our base and binding the xref's.

    Kyle C.
    How many xrefs? If more than one xref contains the same layer names then the situation that kennet mentioned will occur.
    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

  8. #8
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Remove $0$ and everything before from Layer names

    Opie,

    Now I have a problem, I don't think about that .

    I have about 26 xref's and 13 of them are from the architect and I know they have the same named layers in all of them.

    Any Ideas on how to get around this maybe when it reads the layer name it can add a "X" and a "number" that increases, I just looking to get the layer names to be smaller.

    bko_451-xf-1a1$0$ABVBLW to X1ABVBLW

    bko_451-xf-1b1$0$ABVBLW to X2ABVBLW
    etc.

    Thanks,

    Kyle C.

    Quote Originally Posted by Opie
    How many xrefs? If more than one xref contains the same layer names then the situation that kennet mentioned will occur.

  9. #9
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Remove $0$ and everything before from Layer names

    Quote Originally Posted by kylec_edg
    . . .Now I have a problem. . .
    Yes you have,
    if there is block in the binded xref ( and of course there is ) you have problem in problem.
    and it is not only layers, it is textfons, linefonts, dimensionstyles. . . .

    Next time bind as insert ; )

    : ) Happy Computing !

    kennet

  10. #10
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Remove $0$ and everything before from Layer names

    Perhaps this will help.
    Code:
    ;;;=======================[ LayerXrename.lsp ]======================= 
    ;;; Author:  Charles Alan Butler 
    ;;; Version:  1.0 jan. 10, 2006
    ;;; Purpose: Rename Bound xref layers  $0$ to X1-Layername
    ;;; Sub_Routines: -None 
    ;;;==============================================================
    (defun c:layerxrename (/ usercmd lnamelst laylst x newname prefix prefixcnt tmp)
      (vl-load-com)
      (setq usercmd (getvar "CMDECHO"))
      (setvar "CMDECHO" 0)
      (setq laylst (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))
      (vlax-for x laylst
        (setq lnamelst (cons (list (vla-get-name x) x) lnamelst))
      )
    
      (setq lnamelst (vl-sort lnamelst '(lambda (e1 e2) (< (car e1) (car e2)))))
      (setq prefix ""
            prefixcnt 0
      )
      (foreach x lnamelst
        (if (wcmatch (car x) "*$*$*") ; rename the layer
          (progn
            (if (/= (setq tmp (substr (car x) 1 (vl-string-search "$" (car x)))) prefix)
              (setq prefixcnt (1+ prefixcnt)
                    prefix tmp)
            )
            (setq newname (strcat "X" (itoa prefixcnt)  "-"
                                  (substr (car x) (+ 4 (vl-string-search "$0$" (car x))))
                          )
            )
            (vl-catch-all-apply 'vla-put-name (list (cadr x) newname))
          )
        )
    
      )
      (setvar "CMDECHO" usercmd)
      (princ)
    )
    (prompt "\nXref Layer Rename removes $0$, Enter LayerXrename to run.")
    (princ)

Page 1 of 4 1234 LastLast

Similar Threads

  1. Replies: 11
    Last Post: 2009-02-27, 04:25 PM
  2. Replies: 6
    Last Post: 2007-05-30, 02:02 PM
  3. Replies: 2
    Last Post: 2007-01-09, 06:39 AM
  4. Change Layer names to other Layer names via a script?
    By tburke in forum AutoCAD Customization
    Replies: 5
    Last Post: 2006-12-04, 07:30 PM
  5. Replies: 12
    Last Post: 2006-10-06, 07:07 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
  •