LISP routine to move items from layer to layer

Discussion in 'AutoCAD' started by CLS, Jul 21, 2004.

  1. CLS

    CLS Guest

    Hi All, I am back again.

    Now I need a way to move all items on layer "0" to layer "10". Layer names
    will never change.

    Thanks
    Chad
     
    CLS, Jul 21, 2004
    #1
  2. CLS

    Doug Barr Guest

    Zat from Acad 2?
    <g>
     
    Doug Barr, Jul 21, 2004
    #2
  3. CLS

    Tom Smith Guest

    I'd use the Properties palette to do this. Use Qselect to filter all objects
    on layer 0, then change layer in Properties palette.

    I wouldn't write a lisp to do a one-time task, or one that is so easily and
    quickly done by built-in methods.

    If you insist, you can use a filter list to select the objects

    (setq sset (ssget "x" '((8 . "0"))))

    and the same method you were shown yesterday to change them:

    (command "chprop" sset "" "Layer" "10" "")
     
    Tom Smith, Jul 21, 2004
    #3
  4. CLS

    Jim Claypool Guest

    (defun layerchange (oldlay newlay / ss)
    (setq ss (ssget "x" (list (cons 8 oldlay))))
    (if ss (command ".chprop" ss "" "la" newlay ""))
    )
    Assuming layer 10 exists:
    Use: (layerchange "0" "10")
     
    Jim Claypool, Jul 21, 2004
    #4
  5. CLS

    Grizzly Guest

    hey...if it works....
     
    Grizzly, Jul 21, 2004
    #5
  6. CLS

    Doug Barr Guest

    Truth there.
    I still use stuff I did in '91, minor tweaks for lwpolylines only.
     
    Doug Barr, Jul 21, 2004
    #6
  7. CLS

    CLS Guest

    Thanks Tom,

    That works. Nice and simple too.

    Chad
     
    CLS, Jul 21, 2004
    #7
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.