Is it just 1 closed polyline on Layer-1, and 1 on Layer -2?
Can there be overlap, or is 2 nicely within 1? (no overlap would make it easier)
Anyway, see if you're happy with this
(vl-load-com)
(defun drawM-Text (pt str)
(entmakex (list (cons 0 "MTEXT")
(cons 100 "AcDbEntity")
(cons 100 "AcDbMText")
(cons 10 pt)
(cons 1 str))))
;; ADC, for Area Deducting Cutout
(defun c:adc ( / ss l1 l2 i ent lay area1 area2 area3 txt txtobj)
;; Step-1: After entering command user will select whole drawing in single selection
(princ "\nSelect all objects: ")
(setq ss (ssget (list (cons 0 "POLYLINE,LWPOLYLINE"))))
;; Step-2: Lisp will select only object in Layer-1 & Layer-2 (Other layers objects will be ignored)
(setq i 0)
(repeat (sslength ss)
(setq ent (ssname ss i))
;; read layer
(setq lay (cdr (assoc 8 (entget ent))))
(princ "\n")
(princ lay)
;; Step-3: Lisp will calculated the area of Layer-1 & Layer-2
(if (= "Layer-1" lay)
(progn
(setq area1 (vla-get-area (vlax-ename->vla-object ent)))
(princ " - area: ")
(princ area1)
)
)
(if (= "Layer-2" lay)
(progn
(setq area2 (vla-get-area (vlax-ename->vla-object ent)))
(princ " - area: ")
(princ area2)
)
)
(setq i (+ i 1))
)
;; Step-4: Now it will Subtract the area of Layer-2 from Layer-1
(setq area3 (- area1 area2))
;; Step-5: and paste it as Text.
(setq txt
(strcat
"Total Area: " (rtos area1 2 2)
"\nCutout Area: " (rtos area2 2 2)
"\nSubtracted Area: " (rtos area3 2 2)
)
)
(drawM-Text (getpoint "\nPick a point to put the MText: ") txt)
(princ)
)