(defun c:imglay (/ ss i ent obj lay lklst)
(vl-load-com)
(if (and (setq ss (ssget "X" '((0 . "IMAGE"))))
(tblsearch "LAYER" "TPZ-XREF")
)
(progn
(vlax-for lay (vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)))
(if (= (vla-get-lock lay) :vlax-true)
(progn
(setq lklst (cons lay lklst))
(vla-put-lock lay :vlax-false)))
)
(setq i -1)
(while (setq ent (ssname ss (setq i (1+ i))))
(setq obj (vlax-ename->vla-object ent))
(vla-put-layer obj "TPZ-XREF")
)
(foreach lay lklst
(vla-put-lock lay :vlax-true)
)
(prompt "\nImages set to layer \"TPZ-XREF\".")
)
(prompt "\nNo images or no layer named TPZ-XREF.")
)
(princ)
)

(defun c:pdflay1 (/ ss i ent obj lay lklst)
(vl-load-com)
(if (and (setq ss (ssget "X" '((0 . "PDFUNDERLAY"))))
(tblsearch "LAYER" "TPZ-XREF")
)
(progn
(vlax-for lay (vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)))
(if (= (vla-get-lock lay) :vlax-true)
(progn
(setq lklst (cons lay lklst))
(vla-put-lock lay :vlax-false)))
)
(setq i -1)
(while (setq ent (ssname ss (setq i (1+ i))))
(setq obj (vlax-ename->vla-object ent))
(vla-put-layer obj "TPZ-XREF")
)
(foreach lay lklst
(vla-put-lock lay :vlax-true)
)
(prompt "\nPDF's set to layer \"TPZ-XREF\".")
)
(prompt "\nNo PDF's or no layer named TPZ-XREF.")
)
(princ)
)

(defun c:dwflay1 (/ ss i ent obj lay lklst)
(vl-load-com)
(if (and (setq ss (ssget "X" '((0 . "DWFUNDERLAY"))))
(tblsearch "LAYER" "TPZ-XREF")
)
(progn
(vlax-for lay (vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)))
(if (= (vla-get-lock lay) :vlax-true)
(progn
(setq lklst (cons lay lklst))
(vla-put-lock lay :vlax-false)))
)
(setq i -1)
(while (setq ent (ssname ss (setq i (1+ i))))
(setq obj (vlax-ename->vla-object ent))
(vla-put-layer obj "TPZ-XREF")
)
(foreach lay lklst
(vla-put-lock lay :vlax-true)
)
(prompt "\nDWF's set to layer \"TPZ-XREF\".")
)
(prompt "\nNo DWF's or no layer named TPZ-XREF.")
)
(princ)
)

(defun c:xreflay (/ ss i vla) ; Put Xrefs to TPZ-XREF Layer
;; Tharwat 31. Oct. 2011 ;;
( (lambda (/ layer)
(vlax-for
layer
(vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)))
(if (vlax-get-property layer 'Lock)
(vlax-put-property layer 'Lock :vlax-false)))) )
(if (setq ss (ssget "_x" '((0 . "INSERT"))))
(repeat
(setq i (sslength ss))
(setq vla (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
(if (vlax-property-available-p vla 'Path)
(vla-put-layer vla "TPZ-XREF")
)
)
(princ)
)
(princ)
)

(defun C:il (/ SETD LAY) ; Begin function

( (lambda (/ layer)
(vlax-for
layer
(vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)))
(if (vlax-get-property layer 'Lock)
(vlax-put-property layer 'Lock :vlax-false)))) )

(setvar "CMDECHO" 0) ; Turn off command echo

(setq SETD (ssget "X" '((0 . "IMAGE")))) ; Selection set of dims

(if (null SETD) ; If there are no dims

(princ "\nThere are no associated Images.") ; THEN tell user

(progn ; ELSE begin (progn)

;(setq LAY (getstring "\nTransfer to which layer? ")) ; Get layer name

(command ".CHPROP" SETD "" "LA" "TPZ-XREF" "") ; Change dimensions to layer

) ; End (progn)

) ; End (if)

(setvar "CMDECHO" 1) ; Turn on command echo

(princ) ; Clean exit

) ; End function

; - -( End of Program )- -

(defun C:pdfLay (/ SETD LAY) ; Begin function

( (lambda (/ layer)
(vlax-for
layer
(vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)))
(if (vlax-get-property layer 'Lock)
(vlax-put-property layer 'Lock :vlax-false)))) )

(setvar "CMDECHO" 0) ; Turn off command echo

(setq SETD (ssget "X" '((0 . "PDFUNDERLAY")))) ; Selection set of dims

(if (null SETD) ; If there are no dims

(princ "\nThere are no associated PDFs.") ; THEN tell user

(progn ; ELSE begin (progn)

;(setq LAY (getstring "\nTransfer to which layer? ")) ; Get layer name

(command ".CHPROP" SETD "" "LA" "TPZ-XREF" "") ; Change dimensions to layer

) ; End (progn)

) ; End (if)

(setvar "CMDECHO" 1) ; Turn on command echo

(princ) ; Clean exit

) ; End function

; - -( End of Program )- -

(defun C:dwfLay (/ SETD LAY) ; Begin function

( (lambda (/ layer)
(vlax-for
layer
(vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)))
(if (vlax-get-property layer 'Lock)
(vlax-put-property layer 'Lock :vlax-false)))) )

(setvar "CMDECHO" 0) ; Turn off command echo

(setq SETD (ssget "X" '((0 . "DWFUNDERLAY")))) ; Selection set of dims

(if (null SETD) ; If there are no dims

(princ "\nThere are no associated DWFs.") ; THEN tell user

(progn ; ELSE begin (progn)

;(setq LAY (getstring "\nTransfer to which layer? ")) ; Get layer name

(command ".CHPROP" SETD "" "LA" "TPZ-XREF" "") ; Change dimensions to layer

) ; End (progn)

) ; End (if)

(setvar "CMDECHO" 1) ; Turn on command echo

(princ) ; Clean exit

) ; End function

; - -( End of Program )-

(c:xreflay)
(c:imglay)
(c:pdflay1)
(c:dwflay1)

Advertisements