Move to Layer or created one.... Needs a fix

Discussion in 'AutoCAD' started by pochrist, Sep 13, 2004.

  1. pochrist

    pochrist Guest

    I have an old lisp I was trying to adjust to Move a selelction set to an exsting layer or Create a new Layer if needed. It orginally did that with the Copy function. My problem is that it will Stall out if I want to "Key-in" a layer... Can somebody find out why? TIA
    ***********************************************************************
    (defun c:mtol ( / ss ssl cnt ename ent nent pic8 new8)
    (setq ss (ssget)
    ssl (sslength ss)
    cnt 0
    );setq
    (if
    (setq pic8 (entsel "\nSelect entity on \"move to\" layer or <enter> to key-in. "))
    (setq new8(cdr(assoc 8(entget(car pic8)))))
    (setq new8 (ustr 1 "\Enter layer name to move to. " (getvar"clayer") nil))
    );if
    (if
    (tblsearch "LAYER" new8)
    nil
    (command ".layer" "m" new8 "")
    );if
    (while (< cnt ssl)
    (setq ename (ssname ss cnt)
    ent (entget ename)
    nent
    (cdr
    (subst (cons 8 new8)
    (assoc 8 ent)
    ent)
    );cdr
    cnt (1+ cnt)
    );setq
    (if
    (and
    (not(eq "POLYLINE" (cdr(assoc 0 ent))))
    (not(eq "INSERT" (cdr(assoc 0 ent))))
    );and
    (entmake nent)
    (progn
    (command ".move" ename "" (list 0 0 0) "")
    (setq ent (entget(entlast))
    ent
    (subst
    (cons 8 new8)
    (assoc 8 ent)
    ent
    )
    );setq
    (entmod ent)
    );progn
    );if
    );while
    (princ)
    );defun
     
    pochrist, Sep 13, 2004
    #1
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.