Layer merge automatically.

Discussion in 'AutoCAD' started by Casey Roberts, Oct 5, 2004.

  1. Does anyone have a lisp or is anyone able to point me in the right direction
    for creating a lisp that will do accomplish the following.

    Currently, I have a drawing with multiple layers that have been prefixed
    with a drawing name (These were xref's that have been bound to the drawing I
    am working with.)

    There are several 'similar' layers which I would like to merge into the same
    layer. The difference between the layernames is the prefix portion. Is
    there a way to automate this process as typing in all the layer names is a
    time consuming process.

    For example, I have a drawing with layers named:

    UNIT-A-1$0$A-BALCONY
    UNIT-A-1$0$A-COLUMN
    UNIT-A-1$0$A-RAIL
    UNIT-B-1$0$A-BALCONY
    UNIT-B-1$0$A-COLUMN
    UNIT-B-1$0$A-RAIL
    UNIT-C-1$0$A-BALCONY
    UNIT-C-1$0$A-COLUMN
    UNIT-C-1$0$A-RAIL
    UNIT-D-1$0$A-BALCONY
    UNIT-D-1$0$A-COLUMN
    UNIT-D-1$0$A-RAIL

    I would like them combined into layers
    A-BALCONY
    A-COLUMN
    A-RAIL

    (this is only a small portion of the actual layer list)

    TIA


    Casey
     
    Casey Roberts, Oct 5, 2004
    #1
  2. Casey Roberts

    cr Guest

    Okay, I've got most of it figured out. All I need is how to supply the
    variables to the laymrg command that is packaged with express tools

    variables are:
    oldname ;name of old layer
    newname ;name of new layer

    I want to merge layer oldname onto layer newname

    so far:

    (c:laymrg)(command "T" OLDNAME "" "T" NEWNAME" "Y")

    but it doesn't work!

    any suggestions?

    Thnx
     
    cr, Oct 6, 2004
    #2
  3. Casey Roberts

    James Allen Guest

    Hi Casey. Have you already looked into the built-in laytrans command?
     
    James Allen, Oct 6, 2004
    #3
  4. Thanks for the suggestion, it works but it's still a tedios process when
    dealing with hundreds of layers in multiple drawings with varyious 'maps'
    required that are not the same fore each drawing.
     
    Casey Roberts, Oct 6, 2004
    #4
  5. And apparently it's too early for me to spell correctly...varyious? :-(
     
    Casey Roberts, Oct 6, 2004
    #5
  6. Okay, I've got it to the point where I have two variables that are strings
    that are the old layer and the new layer name. Both layers exist in the
    drawing, but what is the syntax for feeding these to the express tools
    laymrg command via lisp.

    (c:laymrg)(command "T" OLDLAY "" "T" NEWLAY "Y")
    doesn't work and neither does:


    Command: (command "laymrg")
    laymrg Unknown command "LAYMRG". Press F1 for help.
     
    Casey Roberts, Oct 6, 2004
    #6
  7. Casey Roberts

    C Witt Guest

    you can't use lisp to run laymrg.. you have to use script files (loaded
    by lisp)..

    see the attached files for an example..

    HTH

    laymrg
    t
    scale

    t
    text
    y

    (setvar "cmdecho" 0)
    (setq curlry (getvar "clayer"))(princ)
    (command "-layer" "m" "scale" "c" "7" "scale" "")(princ)
    (setvar "clayer" curlry)(princ)
    (command "script" "laymrg.scr")(princ)
    (setvar "cmdecho" 1)
     
    C Witt, Oct 6, 2004
    #7
  8. In that case, is there a method to use a lisp variable of the layernames
    within a script file?
     
    Casey Roberts, Oct 6, 2004
    #8
  9. Casey Roberts

    C Witt Guest

    AFAIK you can't use that kind of command call up (and that is why it's
    not working)..
     
    C Witt, Oct 6, 2004
    #9
  10. Casey Roberts

    DaveS Guest

    Sometimes doing it this way: (command "T" "!OLDNAME" "" "T" "!NEWNAME" "Y")
    but only sometimes. Also you have a floating quote after the NEWNAME
    variable.

    here
    |
    (command "T" OLDNAME "" "T" NEWNAME" "Y")

    Have fun,
    Dave
     
    DaveS, Oct 7, 2004
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.