(vl-load-com)
(defun c:t4 (/ d o c)(setq c (vla-get-Blocks (setq d (vla-get-ActiveDocument (vlax-get-acad-object)))))
(if (and (setq o (entsel "\nSelect block: ")) (block-p (setq o (vlax-ename->vla-object (car o)))))
(mapcar '(lambda (n) (vlax-for x (vla-item c n)(vla-put-Color x 0) (vla-put-linetype x "ByBlock")
(vla-put-Layer x "0") (vla-put-Lineweight x -2)(vla-put-EntityTransparency x "ByBlock"))) (nb o)))
(vla-regen d acAllViewports)
(princ)
)
;;; test of object is a block (block-p (vlax-ename->vla-object (car (entsel))))
(defun block-p (o) (and (= 'vla-object (type o))(eq (vla-get-objectname o) "AcDbBlockReference")))
;;; test if object is block and return name / effective name : (block-n (vlax-ename->vla-object (car (entsel))))
(defun block-n (o) (if (and (= 'vla-object (type o))(eq (vla-get-objectname o) "AcDbBlockReference"))
(if (vlax-property-available-p o 'EffectiveName)(vla-Get-EffectiveName o)(vla-Get-Name o)) nil))
;;; nested block names : test : (nb (vlax-ename->vla-object (car (entsel "\nSelect block: "))))
(defun nb ( b / c l n) (setq c (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))))
(vlax-for o (vla-item c (block-n b)) (if (and (eq "AcDbBlockReference" (vla-get-ObjectName o))
(not (member (setq n (block-n o)) l)))(progn(setq l (cons n l))(nb o))))(cons (block-n b) l))
Dear All,
I'm new to this thread and i have following book as a pdf. but I dont have pratice file cd, if anyone know place to download let me know
The Aubin Academy Master Series: AutoCAD MEP 2011
Thank you,