(defun c:color-rect (/)
(setq mydoct (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq mySel (ssget "_X" (list '(0 . "INSERT")
(cons 2 (strcat "`*U*," "Rect"))))
)
(repeat (setq no (sslength mySel))
(setq sname (ssname s (setq no (1- no)))
Blkname (vla-get-effectivename (vlax-ename->vla-object sname)
)
)
(vlax-for objs (vla-item (vla-get-blocks mydoct) Blkname)
(vla-put-color objs Acred))
)
(command "regen")
)
- Since your ssget filter list contains only constant data (literal strings), the entire filter list may be quoted and the group 2 pair does not need to be constructed using cons/strcat. See this article (http://bit.ly/18ftLyF) for more information.
why did you add the name of the block (ano) to the list and not the effective name (bln) ?
is is the same result in this case or another thing I can not see ? :-(
- Since your ssget filter list contains only constant data (literal strings), the entire filter list may be quoted and the group 2 pair does not need to be constructed using cons/strcat. See this article (http://bit.ly/18ftLyF) for more information.
That's also a very good point ( I got it ) , thanks a lot . :-)
why did you add the name of the block (ano) to the list and not the effective name (bln) ?
is is the same result in this case or another thing I can not see ? :-(
Because the effective name will be the same for all references of the dynamic block, whereas the block name (usually anonymous) will be different for each set of references of the dynamic block holding different values for the dynamic block parameters.
If the effective name was added to the list, the program would only process references of the first anonymous block encountered, or only non-anonymous references.
If I change the ssget function to (ssget "_:L") this will change ONLY the color of the same block name in the drawing but if I keep it (ssget "_X") , it is changing all blocks and the Block definition
of the same name of the block .
is that normal ? :-o
If I change the ssget function to (ssget "_:L") this will change ONLY the color of the same block name in the drawing but if I keep it (ssget "_X") , it is changing all blocks and the Block definition
of the same name of the block .
is that normal ? :-o
Yes, because not all of the anonymous block references are being processed, only those that the user has selected.
Thank you so much . :-)
Can I say that dynamic blocks definitions are similar to attributed blocks definitions somehow ? I am talking about ( attributes ) in blocks .
BlockTableRecord
Accesses the object ID of the BlockTableRecord referenced by the block reference.
DynamicBlockTableRecord
Returns the object ID of the dynamic block definition (a BlockTableRecord) if the block reference is a dynamic block.
AnonymousBlockTableRecord
Returns the anonymous block definition used to draw the dynamic block.