Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Changing layer names

  1. #1
    100 Club Matt Mercer's Avatar
    Join Date
    2004-05
    Location
    Liberty Lake, WA
    Posts
    147
    Login to Give a bone
    0

    Question Changing layer names

    A general question about changing layer names to different layer names. I was wondering if anyone has a lisp routine that they are willing to share that changes a certain layer name to a different layer name, Obvious I would have to modify the lisp routine to fit the names I use. Thanks for any input. Matt

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

    Default Re: Changing layer names

    Quote Originally Posted by MATT_MERCER_2000
    A general question about changing layer names to different layer names. I was wondering if anyone has a lisp routine that they are willing to share that changes a certain layer name to a different layer name, Obvious I would have to modify the lisp routine to fit the names I use. Thanks for any input. Matt
    Have you tried the Layer Translator within AutoCAD?
    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
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Changing layer names

    Code:
    (vla-put-Name
     (vla-Item
      (vla-get-Layers
       (vla-get-ActiveDocument
        (vlax-get-Acad-Object)
       )
      )
      "Layer1" ; Old layer name
     )
     "HappyTest" ; New layer name
    )
    Will error if old layer name doesn't exist, or if new layer name alread exist, but shows you how to do it. If you don't already have it loading, you will have to add
    (vl-load-com)
    So that you can use the ActiveX controls in lisp.

  4. #4
    100 Club Matt Mercer's Avatar
    Join Date
    2004-05
    Location
    Liberty Lake, WA
    Posts
    147
    Login to Give a bone
    0

    Default Re: Changing layer names

    Thanks - I can't wait to try it out.

    Matt

  5. #5
    100 Club
    Join Date
    2004-12
    Posts
    153
    Login to Give a bone
    0

    Default Re: Changing layer names

    you can also use the RENAME command

  6. #6
    100 Club Matt Mercer's Avatar
    Join Date
    2004-05
    Location
    Liberty Lake, WA
    Posts
    147
    Login to Give a bone
    0

    Default Re: Changing layer names

    Thanks CiphDRMRS - This is what I've wanted. I do have a problem with it. I was wondering if there is a way around it. Lets say I have a couple of layers that are from a client that I want to name the same - It will not allow me to do that I get this error message." ; error: Automation Error. Duplicate record name"

    any suggustions?

    Matt

  7. #7
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Changing layer names

    You could rename the matching layers to a similar name like adding a 01, 02 to the end of the layername and then use the layer merge express tool to combine them.


    It is possible to search through each of the blocks collection of and iterate through each item and change the layer names to merge them yourself. The only difficulty is compound objects like normal weight polylines and blocks with attributes. Special attention needs to be paid to these objects, especially the seqend object which must be accessed though using entnext from the block entity or pline entity.

    Hope this helps.

    Peter Jamtgaard

  8. #8
    100 Club Matt Mercer's Avatar
    Join Date
    2004-05
    Location
    Liberty Lake, WA
    Posts
    147
    Login to Give a bone
    0

    Default Re: Changing layer names

    Thanks that does seem to work, with the lisp routine and layer merge tool - its going to be a lot faster now, I still wish there was a way of eliminating the express tool in the lisp routine - but I'm not going to complain because its again a lot faster than the old way.
    Thanks for everyone who responded.

    Matt

  9. #9
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Changing layer names

    If you don't want to use the Express tool, then you will have to write the code yourself. It might be hard, but could also be a great learning project. Maybe just work on it when you have time, and until you finish it use the ET one.

    Glad you got something that works for you.

  10. #10
    100 Club Matt Mercer's Avatar
    Join Date
    2004-05
    Location
    Liberty Lake, WA
    Posts
    147
    Login to Give a bone
    0

    Question Re: Changing layer names

    ; error: Automation Error. Key not found

    Does anyone know what this means?

Page 1 of 2 12 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. Replies: 4
    Last Post: 2006-12-11, 06:34 PM
  5. 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

Posting Permissions

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