excellent coding...I also added the following for @jaimuthu
1. Place Text on specified Layer "TEXT" and Color "2" Yellow:
(setq txtlyr "TEXT" ; layer for text
txtcol "2" ; color for text
)
2. Created Field value for Hatches Layer & Area values so that the next time these change they're updated automatically:
; (setq la (vlax-get-property h 'layer))
(setq la(strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa(vla-get-ObjectID h)) ">%).Layer>%")) ; create layer as field
; (setq ha (/ (vlax-get-property h 'area) 1000000.0))
(setq ha(strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa(vla-get-ObjectID h)) ">%).Area \\f \"%lu2%pr2%ct8[1.000000000000000E-006]\">%")) ; create area as field
; (setq val (strcat "Layer: " la ", Area: " (rtos ha 2 2) " sq.m"))
(setq val (strcat "\\C" txtcol ";Layer: " la ", Area: " ha " sq.m")) ; layer & area as field in color
(vlax-put-property tex 'Layer txtlyr)