Thanks sir
it works correctly
now the dynamic block that i work on it i find more attributes on it in the current visibility
so can we add another feature that it take the value of the attribute in the current visibility and also it's tag contain "lay" ??
I've tried to make this code but it doesn't work
(defun c:c_2 ()
(if (setq insert_sset (ssget '((0 . "insert") (66 . 1))))
(foreach insert (vl-remove-if-not
'(lambda (insert)
(minusp (vlax-get insert 'isdynamicblock)))
(mapcar 'vlax-ename->vla-object
(vl-remove-if 'listp
(mapcar 'cadr (ssnamex insert_sset))))
)
(if (vl-some
'(lambda (dyn_property)
(setq dyn_value (vlax-variant-value (vla-get-value dyn_property)))
(= "Visibility1" (vla-get-propertyname dyn_property)))
(vlax-invoke insert 'getdynamicblockproperties)
)
;; Modify the block if the condition is met
(entmod (append (entget (vlax-vla-object->ename insert))
(list (cons 8 (getpropertyvalue (vlax-vla-object->ename insert) dyn_value))))
)
)
;; Process attributes with "lay" in the tag
(foreach att (vlax-invoke insert 'getattributes)
(if (and (eq 'STR (type (vla-get-tagstring att))) ;; Check if it has a tag string
(wcmatch (strcase (vla-get-tagstring att)) "*LAY*")) ;; Match tag containing "lay"
(progn
;; Get and display the attribute's value
(setq att_value (vla-get-textstring att))
(princ (strcat "\nAttribute with 'lay' in tag found: " att_value))
)
)
)
)
)
(princ)
)
thanks in advance