You did not iterate through each polyline to have them hatched separately so I did modify the codes a bit and added a few as well but you need to change the hatch pattern that suits your needs and I went with the pattern with ANSI31 in shown in the codes below:
Code:
(vl-load-com)
(defun c:test (/ js nb ent dxf_ent ptlst hy n pt_ins val_txt lst)
(setvar "clayer" "irr-drip-text")
(setvar "hplayer" "irr-drip-hatch")
(princ "\nSelect closed polylines")
(setq js (ssget (list '(0 . "*POLYLINE")
'(-4 . "<AND")
'(-4 . "<NOT")
'(-4 . "&")
'(70 . 120)
'(-4 . "NOT>")
'(-4 . "&")
'(70 . 1)
'(-4 . "AND>")
(cons 67
(if (eq (getvar "CVPORT") 1)
1
0
)
)
(cons 410
(if (eq (getvar "CVPORT") 1)
(getvar "CTAB")
"Model"
)
)
)
)
)
(cond (js
(repeat (setq nb (sslength js))
(setq ent (ssname js (setq nb (1- nb)))
dxf_ent (entget ent)
ptlst (mapcar
'cdr
(vl-remove-if-not '(lambda (x) (= (car x) 10)) dxf_ent)
)
n (float (length ptlst))
pt_ins (list (/ (apply '+ (mapcar 'car ptlst)) n)
(/ (apply '+ (mapcar 'cadr ptlst)) n)
)
val_txt (rtos (vlax-get-property
(vlax-ename->vla-object ent)
"Area"
)
2
0
)
lst (cons ent lst)
)
(entmake
(list '(0 . "TEXT")
'(100 . "AcDbEntity")
(cons 67
(if (eq (getvar "CVPORT") 1)
1
0
)
)
(cons 410
(if (eq (getvar "CVPORT") 1)
(getvar "CTAB")
"Model"
)
)
(cons 8 (getvar "CLAYER"))
'(100 . "AcDbText")
(cons 10 pt_ins)
(cons 40 (getvar "TEXTSIZE"))
(cons 1 val_txt)
(cons 50 (+ pi (angle '(0 0 0) (getvar "UCSYDIR"))))
'(41 . 1.0)
'(51 . 0.0)
(cons 7 (getvar "TEXTSTYLE"))
'(71 . 0)
'(72 . 1)
(cons 11 pt_ins)
(cons 210 (trans '(0 0 1) 1 0 T))
'(100 . "AcDbText")
'(73 . 2)
)
)
)
)
)
(prin1)
(if (and lst
(progn (initget "Yes No")
(setq hy (cond ((getkword "\nHatch? Y/N < Yes >: "))
("Yes")
)
)
)
(= hy "Yes")
)
(foreach obj lst
(command "_.-hatch" "S" obj "" "P" "ANSI31" 0.2 0.0 "")
)
)
(princ)
)