Page 1 of 1
Block attribute
Posted: Sun Jan 12, 2025 11:55 pm
by EddieS
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
Posted: Mon Jan 13, 2025 3:28 am
by SPirou4D
After a long search in Dev help the Autolisp function "setpropertyvalue" don't work with IntelliCAD.
Re: Block attribute
Posted: Thu Jan 16, 2025 11:51 pm
by EddieS
Would you know of anyway to achieve this ?
VBA maybe?
Re: Block attribute
Posted: Fri Jan 17, 2025 2:13 am
by SPirou4D
Non I don't know! Yes VBA...
Re: Block attribute
Posted: Fri Jan 17, 2025 2:56 am
by QuanNguyen
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)
)
Re: Block attribute
Posted: Sun Jan 19, 2025 2:23 pm
by SPirou4D
Very efficient Dear Quan ! Thks a lot and Happy New Year 2025 from France.
Re: Block attribute
Posted: Sun Jan 19, 2025 5:05 pm
by EddieS
Fantastic.. that worked.
Thank you so much