Hi John the request was for volume of cut so look at my cross section image using water spill point would give incorrect answer this could be a substantial difference in volume. I know of a project where they ran out of dirt needed, the vols suggested an excess of material.
I designed a retard basin exactly that shape where batter chased the up hill slope.
The request is do multiple ponds, a couple of if and buts if all cut then make a super top surface all holes, make a second surface all top and bottom, take the top pline and get surface1 triangles, same again get triangles surface 2 then a VOL calc. The formula I posted adding each triangle down to say z=0 volume, then a VOL1-VOL2. This all falls apart when you have cut and fill.
Can use the ssget WP to find all the triangles. Need a answer for sample dwg correct volume. I got 5892.
The code is rough as I am having problems with my CIV3d and need to do a full install again. I have checked against a simple pyramid solid and got the same answer for volume.
This is based on 2 surfaces 3dfaces from CIV3D it is the sample dwg C-TINN-VIEW is the 2 plines C-TINN-VIEW2 is the outside only.
; surface volumes 1st go
; the two surfaces must have a common outside boundary
(defun trivols ( )
(setq vol 0.0 totarea 0.0)
(repeat (setq x (sslength ss))
(setq tri (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(setq lst (vlax-get tri 'coordinates))
(setq j 1 x 1)
(repeat 3
(set (read (strcat "p" (rtos x 2 0) "x")) (nth (- j 1) lst))
(set (read (strcat "p" (rtos x 2 0) "y")) (nth j lst))
(set (read (strcat "p" (rtos x 2 0) "z")) (nth (+ j 1) lst))
(setq j (+ j 3) x (+ 1 x))
)
(setq lst2 '())
(setq lst2 (cons (list p1x p1y) lst2))
(setq lst2 (cons (list p2x p2y) lst2))
(setq lst2 (cons (list p3x p3y) lst2))
(setq lst2 (reverse lst2))
(setq lst2 (cons (last lst2) lst2))
(setq k 0 tot 0.0)
(repeat (- (length lst2) 1)
(setq xy (- (* (car (nth k lst2))(cadr (nth (+ k 1) lst2))) (* (car (nth (+ k 1) lst2))(cadr (nth k lst2)))))
(setq tot (+ tot xy))
(setq k (+ k 1))
)
(setq tot (abs (/ tot 2.0)))
(setq newvol (* tot (/ (+ p1z p2z p3z) 3.0)))
(setq vol (+ vol newvol))
)
(princ)
)
(defun c:trivol ()
(setq ss (ssget (list (cons 0 "3DFACE")(cons 8 "C-TINN-VIEW"))))
(trivols)
(setq vol1 vol)
(setq ss (ssget (list (cons 0 "3DFACE")(cons 8 "C-TINN-VIEW2"))))
(trivols)
(alert (strcat "total volume is " (rtos (- vol vol1) 2 2)))
(princ)
)
(c:trivol)
This is just a start so much more to add.