Hi everybody, This is my firs post
My question is..It's possible to implement this lisp? Preface: I am just starting out with lisp. I tried this but I did not succeed
I'll explain, I will select some dynamic blocks, then I insert a number "N" (es.1,2,3..) to increment an attribute called "PO", then the lisp add the value that I've inserted "N" at the value contained in the attribute "PO" before...Example: Block1(attribute"PO":34 -->N=2 -->attribute"PO":36), Block2(attribute"PO":25 -->N=1 -->attribute"PO":26)
thank you!
This is the lisp that I would like to modify:
;; Room Number Update by CAB 03/21/2005
;; Update selected blocks with attribute "ROOM#"
;; with user entered room number
;; NOTE: Very little error checking
;;
;; Modified a subroutine by Jeff Mishler 1/11/05
;;
(defun c:rm#update (/ rm# attname ss count blk atts2 att2 att1 bc)
(vl-load-com)
(setq rm# (getstring t "\nEnter new room number: ")
attname "ROOM#" ; uppercase only
bc 0) ; block counter
(prompt "\n*** Select blocks to change room number. ***")
;; get only blocks with attributes
(if (and rm#
(not (eq rm# ""))
(setq ss (ssget (list '(0 . "INSERT") '(66 . 1))))
)
(progn
(setq count -1)
(while (< (setq count (1+ count)) (sslength ss))
(setq blk (vlax-ename->vla-object (ssname ss count))
atts2 (vlax-invoke blk "getattributes")
)
(foreach att2 atts2
(if (= attname (vla-get-tagstring att2))
(progn
(vla-put-textstring att2 rm#)
(vla-update att2)
(vla-update blk)
(setq bc (1+ bc))
)
)
)
)
(prompt (strcat "\n-=< " (itoa bc) " blocked updated >=-"))
) ; progn
(prompt "\n--- No blocks Updated ---")
) ; endif
(princ)
) ; defun
(prompt "\nRoom Number Update Loaded, Enter Rm#Update to run.")
(princ)