Change Attributes, changes all blocks.

Greg McLandsborough

Usenet Archive
Joined
Sep 11, 2003
Messages
46
Reaction score
0
This code is driving me silly..

(defun mm-put-entity-att-value
(Block-Ent TagString Textstring / Block-Set Block-Entity Block-Next cnt) (setq Block-Next Block-Ent) (while (setq Block-Next (entnext Block-Next)) (if (= (dxf 0 (setq Block-Entity (entget Block-Next))) "ATTRIB") (if (= (dxf 2 Block-Entity) TagString) (progn (entmod (subst (cons 1 Textstring) (assoc 1 Block-Entity) Block-Entity)) (entupd Block-Ent) ) ) ) )
)

I use it to select a single block, ie my material list, which is the same block inserted many times. I change on Block-Ent which is pass a ename, but several of the blocks are updated, sometimes all, but not always. Does anyone know what I doing wrong ??
 
Dont worry to much folks, sorted it with ActiveX.

(defun mm-put-entity-att-value
(Block-Ent TagString Textstring / Block-Set Block-Entity Block-Next cnt) (setq Attribute-list (vlax-safearray->list (vlax-variant-value (vla-getattributes (vlax-ename->vla-object Block-Ent))) ) ;_ end of vlax-safearray->list ) ;_ end of setq (foreach Attribute Attribute-List (if (= TagString (vla-get-TagString Attribute)) (setq Attribute-Value (vla-put-TextString Attribute Textstring)) ) )
)

Thanks anyway
 
Back
Top