Author Topic: Move all xref to a specific layer (MS/PS)  (Read 2257 times)

0 Members and 1 Guest are viewing this topic.

MvdP

  • Guest
Move all xref to a specific layer (MS/PS)
« on: May 25, 2012, 05:48:14 AM »
I found this lsp on the www a while back.
It moves all attached x-ref's  to a specific layer.
And it is working great .but it...moves only x-ref in ms.
How can this be modified (if allowed by creator) that it all attached x-ref's MS&PS are moved to the specific layer.?

Code: [Select]
;;  XRLC.LSP                                       ;  Scot Harris  11-2-2011
;;   X-Ref Layer Change. Gathers all xrefs in the drawing file and moves
;;   these objects into a user specified layer.
(defun XRLC ( / a d n s )
(if (not (tblsearch "layer" "RENAMEXREFLayer$"))
  (entmake
    (list
      (cons 0 "Layer")
      (cons 100 "AcDbSymbolTableRecord")
      (cons 100 "AcDbLayerTableRecord")
      (cons 2 "RENAMEXREFLayer$")
      (cons 70 0)
      (cons 62 7)
      (cons 6 "Continuous")
    )
  )
)      

(setq s nil d nil n 0)
(setq a "RENAMEXREFLayer$")
 (if (= a "") (setq a "0") );if
 (if (tblsearch "LAYER" a)
  (progn
   (while (setq d (tblnext "BLOCK" (not d)))
    (if (assoc 1 d)
     (progn
      (setq s (ssget "x" (list (cons 0 "INSERT") (assoc 2 d) )))
      (setvar "CMDECHO" 0)
      (command ".chprop" s "" "Layer" a "")
      (setvar "CMDECHO" 1)
      (setq n (+ n (sslength s)) s nil)
     );progn
    );if
   );while
   (if (> n 0)
    (princ (strcat
  "\n " (itoa n) " X-Ref object(s) moved to layer \"" (strcase a) "\". "))
    (princ "\n No X-Ref objects found in this file. ")
   );if
  );progn
  (princ (strcat
   "\n Specified layer \"" (strcase a) "\" not found in this file. "))
 );if
 (setq a nil d nil n nil)(princ)
);endXRLC


MvdP

  • Guest
Re: Move all xref to a specific layer (MS/PS)
« Reply #2 on: May 25, 2012, 08:17:27 AM »
Yes ..That helps a lot thanks for link.

Tharwat

  • Swamp Rat
  • Posts: 712
  • Hypersensitive
Re: Move all xref to a specific layer (MS/PS)
« Reply #3 on: May 25, 2012, 08:18:49 AM »
Yes ..That helps a lot thanks for link.

You're welcome  :-)