Block attribute

#1
Hi all, I'm new to Intellicad but old with AutoCAD and was trying to workout why the following autocad lisp didn't work.

Code: Select all

; Set Status Attribute
(defun c:SSA (/ ss i ename)
  (if (setq ss (ssget "_X" '((0 . "insert") (2 . "TitleBlock") (66 . 1))))
    (repeat (setq i (sslength ss))
      (setq en (ssname ss (setq i (1- i))))
      (setpropertyvalue en "SHEETNAME" "AUSCO TEST")))
  (princ)
;  (command "_.save" "" "N")
;  (command "_.close" "")
  )
Any help would be appreciated

Eddie

Re: Block attribute

#5
Hi Eddies,
If you want to change the attribute of the block title only, you can use this lisp, it works the same.

Code: Select all

(defun SetAttValue (blk tag val / lst loop)
  (setq lst  (entget (entnext blk))
	loop (= "ATTRIB" (cdr (assoc 0 lst))))
  (while loop
    (if (= tag (cdr (assoc 2 lst)))
      (progn
	(entmod (subst (cons 1 val) (assoc 1 lst) lst))
	(entupd blk) (setq loop nil) )
      (setq lst (entget (entnext (cdr (assoc -1 lst))))
	    loop (= "ATTRIB" (cdr (assoc 0 lst)))   ) ) ))
Then use :

Code: Select all

; Set Status Attribute
(defun c:SSA (/ ss i ename)
  (if (setq ss (ssget "_X" '((0 . "insert") (2 . "TitleBlock") (66 . 1))))
    (repeat (setq i (sslength ss))
      (setq en (ssname ss (setq i (1- I))))
     ; (setpropertyvalue en "SHEETNAME" "AUSCO TEST")
      (SetAttValue en "SHEETNAME" "AUSCO TEST") ))
  (princ)
  )
cron