Routine acts funny

Discussion in 'AutoCAD' started by cadman_meg, Jul 28, 2003.

  1. cadman_meg

    cadman_meg Guest

    This routine isn't work right anymore. Not sure what happened. Was working fine. Now when I type go-0 to use it it just shows the layer options from the command line. Here is the routine which gives a description of what it is supposed to do:

    GO-0.LSP -- forces all entities to layer 0, retaining colors.
    (c) 1988-1998 Tee Square Graphics

    GO-0 (final character is a zero) was written to facilitate editing drawings in a
    Block Library to force all of their objects into Layer 0. Blocks whose objects all
    reside in Layer 0 behave more predictably in complex drawings, since all of the
    embedded objects will take on the characteristics of the layer in which the block
    is inserted. Colors assigned by layer in the unmodified drawing will be redefined
    so as to be assigned by object in Layer 0.

    (defun C:GO-0 (/ flg l lst c ss nc)
      (command "._undo" "_be"
               "._layer" "_t" "0" "_s" "0" "_c" _conorm "0" "_f" "~0" ""
               "._tilemode" 1)
    (princ "\nWorking...please wait...")
    (setq flg T)
    (while (setq l (cdr (assoc 2 (setq lst (tblnext "layer" flg)))))
    (setq flg nil)
    (if (and (/= l "0")(/= l "X")(not (wcmatch l "@#*")))
    (progn
    (setq c (cdr (assoc 62 lst))
    ss (ssget "x" (list (cons 8 l)))
    nc (ssget "x" (list (cons 8 l)(cons 62 256))))
    (if ss
    (progn
    (princ ".")
    (dump_pspace ss)
    (if nc
    (dump_pspace nc))))
    (if (and ss (> (sslength ss) 0))
    (progn
                (command "._chprop" ss "" "_la" "0" "")
    (if (and nc (> (sslength nc) 0))
                  (command "._chprop" nc "" "_c" c "")))))))
    (princ "Done! \nAll Model Space entities now reside in Layer 0.")
      (command "._layer" "_t" "~x" ""
               "._undo" "_e")
    (princ)
    )
    (defun dump_pspace (ss / n e1)
    (setq n (sslength ss))
    (while (> n 0)
    (if (= (cdr (assoc 67 (entget (setq e1 (ssname ss (1- n)))))) 1)
    (ssdel e1 ss))
    (setq n (1- n)))
    )
     
    cadman_meg, Jul 28, 2003
    #1
  2. cadman_meg

    cadman_meg Guest

    Anyone have any ideas on this one? I would really appreciate it. If not, does someone have a routine that something similar? Thanks.
     
    cadman_meg, Jul 31, 2003
    #2
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.