Thank you Marko for your quick replay.
This is what iam doing now. There are several drawings, may be more than 100, to do this practice and may miss some area. So i thought of making a small routine by saying in SSGET the to polylines.
I am using the following code and iam not much happy with it. If i could do some thing to avoid the PICKING, it is not only time saving also avoid data missing.
Code:
(DEFUN c:cf ()
(setvar "cmdecho" 0)
(setq totfil 0)
(setq totcut 0)
(SETQ ERASESET (ssadd))
(command "regenall")
(while
(setq filpt (getpoint "\nPick FILL Area internal Point"))
(command "-boundary" "a" "o" "p" "" filpt "")
(setq cfens (entlast))
(if cfens
(progn
(setq chk (cdr (assoc 0 (entget cfens))))
(if (= chk "LWPOLYLINE")
(progn
(setq chk1 (cdr (assoc 70 (entget cfens))))
(if (= (rem chk1 2) 1)
(progn
(command "area" "e" cfens)
(command "chprop" cfens "" "c" 7 "")
(setq larea (getvar "area"))
(if larea
(setq totfil (+ totfil larea))
) ;_ end of if
) ;_ end of progn
) ;_ end of if
(SSADD cfens ERASESET)
) ;_ end of progn
) ;_ end of if
) ;_ end of progn
) ;_ end of if
) ;_ end of while
(while
(setq cutpt (getpoint "\nPick CUT Area internal Point"))
(command "-boundary" "a" "o" "p" "" cutpt "")
(setq cfens (entlast))
(if cfens
(progn
(setq chk (cdr (assoc 0 (entget cfens))))
(if (= chk "LWPOLYLINE")
(progn
(setq chk1 (cdr (assoc 70 (entget cfens))))
(if (= (rem chk1 2) 1)
(progn
(command "area" "e" cfens)
(command "chprop" cfens "" "c" 2 "")
(setq larea (getvar "area"))
(if larea
(setq totcut (+ totcut larea))
) ;_ end of if
) ;_ end of progn
) ;_ end of if
(SSADD cfens ERASESET)
) ;_ end of progn
) ;_ end of if
) ;_ end of progn
) ;_ end of if
) ;_ end of while
(setq fillarea (rtos totfil 2 3))
(setq cutarea (rtos totcut 2 3))
(if ERASESET
(command "erase" ERASESET "")
) ;_ end of if
;;;I am using a Title Block with attributes
;;;And i need to update that with new Total areas
(setq
ssblk (ssget "x"
(list (cons 0 "insert") (cons 2 "A3_Title_EW_Cont4"))
) ;_ end of ssget
) ;_ end of setq
(setq ttlblk (ssname ssblk 0))
(setq attrblock (entnext ttlblk))
(while (/= (cdr (assoc 0 (entget attrblock))) "SEQEND")
(setq attrent (entget attrblock))
(if (= (cdr (assoc 0 attrent)) "ATTRIB")
(progn
(setq atvalue (assoc 1 attrent))
(cond
((= (cdr (assoc 2 attrent)) "CUT")
(setq newattrib (cons 1 cutarea))
(setq su (subst newattrib atvalue attrent))
(entmod su)
(entupd attrblock)
)
((= (cdr (assoc 2 attrent)) "CHAINAGE")
(setq ex_chainage atvalue)
)
((= (cdr (assoc 2 attrent)) "FILL")
(setq newattrib (cons 1 fillarea))
(setq su (subst newattrib atvalue attrent))
(entmod su)
(entupd attrblock)
)
) ;_ end of cond
) ;_ end of progn
) ;_ end of if
(setq attrblock (entnext attrblock))
) ;_ end of while
;;;;and send this Areas to to a CSV file
(setq dwgpre_plt (getvar "dwgprefix"))
(setq fnm (strcat dwgpre_plt "Corrected Fill Vol.csv"))
(setq opn (open fnm "a"))
(setq txt (strcat (cdr ex_chainage) "," cutarea "," fillarea))
(write-line txt opn)
(setq opn (close opn))
(princ)
) ;_ end of DEFUN