0 Members and 1 Guest are viewing this topic.
This .... ?Code - Auto/Visual Lisp: [Select](defun c:Test (/ s) (if (setq s (ssget "_:L" '((0 . "ATTDEF")))) ((lambda (i / n) (while (setq n (ssname s (setq i (1+ i)))) (entmod (subst (cons 2 (strcat "A" (substr (cdr (assoc 2 (entget n))) 2 (strlen (cdr (assoc 2 (entget n)))) ) ) ) (assoc 2 (entget n)) (entget n) ) ) ) ) -1 ) (princ) ) (princ))
It would be like this?...(setq s (ssget "_: L" '((0. "INSERT") (66. 1))))
Very clear instruction, Lee.I learned a lot. Thanks.
Code - Auto/Visual Lisp: [Select](defun c:Test (/ selectionset integer selectionsetname v) (vl-load-com) ;;; Tharwat 03. July. 2012 ;;; (cond (not acdoc) (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))) ) (if (setq selectionset (ssget "_:L" '((0 . "INSERT") (66 . 1)))) (progn (vla-StartUndoMark acdoc) (repeat (setq integer (sslength selectionset)) (setq selectionsetname (ssname selectionset (setq integer (1- integer)) ) ) (foreach x (vlax-invoke (vlax-ename->vla-object selectionsetname) 'GetAttributes ) (vla-put-textstring x (strcat "A" (substr (setq v (vla-get-textstring x)) 2 (strlen v)) )) ) ) (vla-EndUndoMark acdoc) ) (princ) ) (princ))
Quote from: antistar on July 03, 2012, 09:27:59 AMIt would be like this?...(setq s (ssget "_: L" '((0. "INSERT") (66. 1))))Select the blocks (ssget with filter list)Iterate over the Selection Set (repeat / while, ssname)For each block entity in the set, iterate over the attributes (entnext)Retrieve the attribute values (cdr, assoc DXF group code 1)Modify the value (as demonstrated above, substr, strcat)Update the value (subst, entmod, entupd)
UPDATED :
Quote from: Tharwat on July 03, 2012, 01:10:05 PMUPDATED : Perfect, exactly what I need. It will be very useful to me.Thank you for your attention and patience.Regards.
Lee,Thank you for your explanations.