PDA

View Full Version : Xref layer isolate



Wish List System
2012-12-21, 12:50 PM
Summary: Add the ability to isolate a layer within an Xref

Description: Add the ability to isolate one or several layers within an Xref drawing in the same manner as layer isolate. As it is right now the only way to do it is to freeze the unwanted layers one at a time.

Product and Feature: AutoCAD - XREF

Submitted By: Gary Finley on 12/21/2012

cadtag
2013-01-11, 01:16 PM
so, what would become the current layer?

or are you are just talking about _only_ impacting xref layers, and ignoring the layers in the current drawing?

BlackBox
2013-01-11, 02:24 PM
(vl-load-com)

(defun c:LAYISOX (/ *error* i eName layerName layers acDoc)
(princ "\rLAYISOX ")

;; error handler
(defun *error* (msg)
(if acDoc
(vla-endundomark acDoc)
)
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it
)
(princ)
)

;; Select xref layers
(setq i 0)
(while
(setq eName
(car
(nentsel
(strcat
"\nSelect objects on the XREF layer(s) to be isolated: "
(if (< 0 i)
(strcat (itoa i) " found ")
""
)
)
)
)
)
(setq i (1+ i))
(if (and (not (vl-position
(setq layerName (cdr (assoc 8 (entget eName))))
layers
)
)
(not (vl-position (strcase layerName) '("0" "DEFPOINTS")))
)
(setq layers (cons layerName layers))
)
)

;; if a valid xref layer selection has been made
(if layers
(progn

;; start an undomark
(vla-startundomark
(setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
)

;; iterate the layer collection
(vlax-for oLayer (vla-get-layers acDoc)

;; if an xref layer
(if (and (vl-string-search
"|"
(setq layerName (vla-get-name oLayer))
)

;; and not one of the layers we want to isolate
(not (vl-position layerName layers))
)

;; turn the xref layer off
(vla-put-layeron oLayer :vlax-false)
)
)
)
)

;; clean exit
(*error* nil)
)