I am trying to write a attribute value replacer, in visual lisp. The following is what I have come up with.
(Defun ATTREPLACE (ENM ATT TXT)
(setq OBJ (VLAX-ENAME->VLA-OBJECT ENM)
ATT (VLA-GETATTRIBUTES OBJ)
VAR (VLAX-VARIANT-VALUE ATT)
CNT (vlax-safearray-get-dim VAR)
);
(while (>= CNT 0)
(setq ARG (VLAX-SAFEARRAY-GET-ELEMENT VAR CNT)
CNT (- CNT 1)
CHK (vlax-get-property ARG "TagString")
)
(if (= CHK ATT)
(setq CNT 0
VAL (vlax-put-property ARG "TextString" TXT)
)
);if
);while
);#ATTREPLACE
The problemI am having, is I know a attribute exist in the block I pass to the lisp, but for some reason the lisp does not change the existing value to the new value.
The only reason I can figure out why is that the safety arrays dimension is 1 insetad of 6, which is the number of attributes I have in the block.
Why does (vlax-safearray-get-dim VAR) return 1 when there are 6 attributes in the block?
:realmad: