Using transparency 'byblock' (a nice tool)
Hi ,
Here is a demonstation of a great code that will set transparency of blocks as 'byblock'
I use transparency many times to get a certain display in a 3D view or in a drawing.
If you set all objects 3D object byblock the xref as a whole can be made transparant. I think that is powerful.
I didn't programm it myself, just wanted to shared this great tool here for you guys.
If you have any good ideas of suggestions for imporvement , please do.
Hans
`
;author: Roy_043
; http://www.cadtutor.net/forum/showthread.php?100592-Routine-to-set-transparency-byblock&p=684199&viewfull=1#post684199
; (NestedPutProp "MyBlk" 'entitytransparency "BYBLOCK")
; (NestedPutProp "MyBlk" 'color 3)
(defun NestedPutProp (nme prop val / blk)
(if
(and
(not
(vl-catch-all-error-p
(setq blk
(vl-catch-all-apply
'vla-item
(list
(vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
nme
)
)
)
)
)
(= :vlax-false (vla-get-islayout blk))
(= :vlax-false (vla-get-isxref blk))
)
(vlax-for obj blk (vlax-put obj prop val))
)
)
(defun KGA_Conv_Pickset_To_ObjectList (ss / i ret)
(if ss
(repeat (setq i (sslength ss))
(setq ret (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ret))
)
)
)
(defun C:TRBB ( / doc doneLst ss)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vla-endundomark doc)
(vla-startundomark doc)
(if (setq ss (ssget '((0 . "INSERT"))))
(foreach obj (KGA_Conv_Pickset_To_ObjectList ss)
(if (not (vl-position (strcase (vla-get-name obj)) doneLst))
(progn
(NestedPutProp (vla-get-name obj) 'entitytransparency "BYBLOCK")
(setq doneLst (cons (strcase (vla-get-name obj)) doneLst))
)
)
)
)
(vla-regen doc acactiveviewport)
(vla-endundomark doc)
(princ)
)`