Originally Posted by
LSElite
Ive attached the drawing for you Tharwat
Check this out now .
Code:
(defun Edit_att (BlockName Property Value / sel i sn e)
;; -------- Tharwat 06. May. 2013 ------- ;
; BlockName = Name of the Attributed Block ( String ) ;
; AttTag = Tag of the Attribute ( String ) ;
; Property = Property (Width / Height) ( String ) ;
; Value = Value of Width or Height (String ) ;
(if (and (tblsearch "BLOCK" BlockName)
(setq
sel (ssget "_X"
(list '(0 . "INSERT") '(66 . 1) (cons 2 BlockName))
)
)
)
(progn
(repeat (setq i (sslength sel))
(setq sn (ssname sel (setq i (1- i))))
(while
(/= (cdr (assoc 0 (setq e (entget (setq sn (entnext sn))))))
"SEQEND"
)
(if (eq (cdr (assoc 0 e)) "ATTRIB")
(if (eq (strcase property) (strcase "Width"))
(entmod (subst (cons 41 (read Value)) (assoc 41 e) e))
(entmod (subst (cons 40 (read Value)) (assoc 40 e) e))
)
)
)
)
)
)
(princ)
)
To try the code for height ...
Code:
(edit_att "Fields_A1_H" "Height" "1.5")
And this is width ...
Code:
(edit_att "Fields_A1_H" "Width" "0.8")