Calculate volume using 3d Polyine

Calculate volume using 3d Polyine

cadgeek33
Contributor Contributor
3,611 Views
30 Replies
Message 1 of 31

Calculate volume using 3d Polyine

cadgeek33
Contributor
Contributor

Hi All,

I want to calculate cut volume for a pond. I have 2 Surfaces as 3d polylines with elevation in each vertices. Is there any lisp or routine I can follow rather than getting the volume using Civil 3D, because we have more than 500 similar ponds in this project. Sample dwg. and Image Attached for reference.

Untitled.jpg

TIA.

0 Likes
3,612 Views
30 Replies
Replies (30)
Message 2 of 31

Sea-Haven
Mentor
Mentor

I think it can be done found a volume of a 3dface formula, in the Civ3d build is example code about creating surfaces so pick 2 - 3d plines make  2 surfaces convert to 3d faces and read these calculating volume, I think you will still need a Vol1-vol2 calc. If it was possible to somehow run the CIV3D volume calc from a command point of view or reset the surface names or better still add surface names so do 500 shapes then export a results file. 

 

Whilst you can get into CIV3D sometimes using VL no idea where the volume stuff is saved.

 

There is surface to 3d solid problem is it makes a shell of your surface. 

Message 3 of 31

john.uhden
Mentor
Mentor
Accepted solution

I've never messed with solids, but I was thinking that a rough calculation could be made by using an average elevation for the top and and average elevation for the bottom, get each 2D area, and use the truncated prism method for computing the volume.  I thinks it's V= (A1 +A2 + (A1*A2)^0.5)*(Z2-Z1)/3.

John F. Uhden

Message 4 of 31

stevor
Collaborator
Collaborator
Accepted solution

One way may be to make them into one 3D Solid,

and  the command massprop .

S
Message 5 of 31

hosneyalaa
Advisor
Advisor
Accepted solution

see this link

 

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/area-capacity-table/td-p/7417797?fbclid=IwAR10033g2rxoLzKN2WzDKFlGuvsF-jy7Mpq-S-9Cui3t1JyTGHLpJawhM84

 

 

Message 6 of 31

Sea-Haven
Mentor
Mentor

Acpac2 looks interesting I think Johns idea of vol by prisms may be the way to go, I know I did intersect 3d faces years ago so could do create the cross section area of a slice, there is triangles by YMG at Cadtutor and pretty sure has cross section option, this would mean a program option not using CIV3D.  The issue I see with Acpac is it needs contours but I did not test.

 

No matter what somehow must have a 3d mesh. Still thinking about it. Will try to find the civ3d make surface example.

 

Screenshot406.png

Have a look at the readme.

 

SeaHaven_0-1623805390392.png

 

Message 7 of 31

Sea-Haven
Mentor
Mentor

I could be wrong maybe missing something but it makes a shell not a filled in solid as I suggested earlier there is a direct civ3d command to convert surface to solid.

Message 8 of 31

cadgeek33
Contributor
Contributor
Had tried Civil 3d, but its taking longer than usual. Any ways thanks alot.
0 Likes
Message 9 of 31

cadgeek33
Contributor
Contributor
hmmm.. seems like this will work for me. I would try. Thanks alot
0 Likes
Message 10 of 31

cadgeek33
Contributor
Contributor
Ya i am following the same concept until i get a Lisp. Thank You
0 Likes
Message 11 of 31

cadgeek33
Contributor
Contributor

This works with the 2D surfaces only. I am getting null value for 3D surfaces. If someone could modify the coding for the 3D surfaces that would be much appreciable. Thank you.

0 Likes
Message 12 of 31

cadgeek33
Contributor
Contributor
ya its making a shell only.
0 Likes
Message 13 of 31

cadgeek33
Contributor
Contributor
thanks alot, I would try this as well.
0 Likes
Message 14 of 31

Sea-Haven
Mentor
Mentor

Really have no idea if this is correct

 

;  https://stackoverflow.com/questions/5695322/calculate-volume-of-3d-mesh

(setq p1 (list 1 1 1))
(setq p2 (list 2  13 15))
(setq p3 (list 20 15 8))
(command "3dface" p1 p2 p3 "" "")

; var v321 = p3.X * p2.Y * p1.Z
(setq v321 (*(nth 0  p3)(nth 1 p2)(nth 2 p1)))
; var v231 = p2.X * p3.Y * p1.Z;
(setq v231 (*(nth 0  p2) (nth 1 p3)(nth 2 p1)))
;var v312 = p3.X * p1.Y * p2.Z;
(setq v312 (* (nth 0 p3)(nth 1 p1)(nth 2 p2)))
;var v132 = p1.X * p3.Y * p2.Z;
(setq v132 (* (nth 0 p1)(nth 1 p3)(nth 2 p2)))
;var v213 = p2.X * p1.Y * p3.Z;
(setq v213 (* (nth 0 p2)(nth 1 p1)(nth 2 p3)))
;var v123 = p1.X * p2.Y * p3.Z;
(setq v123 (* (nth 0 p1)(nth 1 p2)(nth 2 p3)))

(princ (setq vol (* (/ 1.0 6.0) (+ (- v321) v231 v312 (- v132) (- v213)  v123))))

But could loop through all 3dfaces. 

0 Likes
Message 15 of 31

hak_vz
Advisor
Advisor

@john.uhden wrote:

I've never messed with solids, but I was thinking that a rough calculation could be made by using an average elevation for the top and and average elevation for the bottom, get each 2D area, and use the truncated prism method for computing the volume.  I thinks it's V= (A1 +A2 + (A1*A2)^0.5)*(Z2-Z1)/3.


That's the way to calculate volume when two bases are parallel horizontal planes. In case as presented in example, where we have two inclined bases  there are various options how to calculate volume. One is use truncated prism with heights z1  being average z of lower base and z2 average z of upper base. Other method is to add volumes of truncated prism and two wedges. Third is to multiply volume of truncated prism with some coefficient representing difference in inclined bases i.e let say 1.05.

 

Best option is to use method of parallel vertical sections  and calculate volume using truncated prism formula, as we elaborated in one of previous posts. I have to work on code for this option, since requests like this are frequent.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 16 of 31

Sea-Haven
Mentor
Mentor

If I can find the maths for this would use base as all at Z=0

 

SeaHaven_0-1623896616393.png

 

Say with z=0 for base vol = (z1+z2+z3)/3 * Area of base at z=0 seems to be answer. Please disregard if I am wrong.

 

So would get total vol= sum vol triangles1 - sum vol triangles2.

 

If all wrong disregard, for 3dfaces need lisp a few free make TIN out there.

Only really suitable for holes or pyramids no cut/fill

 

 

0 Likes
Message 17 of 31

hak_vz
Advisor
Advisor

@Sea-Haven 

 

It's truncated pyramid and not prism (actually in some combinations one can use both). Volume is calculated using parallel sections with vertical plane. Areas from neighboring sections are looked as a bases of truncated pyramid and used to calculate partial volumes. that summed up give volume. I have started to write some code for this.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 18 of 31

john.uhden
Mentor
Mentor

@hak_vz , @cadgeek33 

I have been working on the multiple plane theory with tessellation lines connecting bottom to top and connecting the points at given Zs to form the equivalent of contours, then using the truncated prism method for the incremental volume between levels and then a total.  It's very rough if the 3DPolys don't have many vertices, so I am going to add a tessellation factor to add more vertices (to the data, not to the polyline).

The volume is computed from the minimum elevation of the bottom to the minimum elevation of the top on the premise that this is for a pond volume, which would overflow if the water rises above its lowest outlet.

This could also output a stage-storage table (if I knew how to make tables).  Maybe someone else can add that when I'm done.  I can create a list that looks like:

'((z depth area incvol cumvol) ;; repeated)

John F. Uhden

0 Likes
Message 19 of 31

hak_vz
Advisor
Advisor

@john.uhden wrote:

@hak_vz , @cadgeek33 

It's very rough if the 3DPolys don't have many vertices, so I am going to add a tessellation factor to add more vertices (to the data, not to the polyline).


@john.uhden  I like your idea. You can try to use ruled surface (rulesurf) created between upper and lower base 3dpolylines to obtain contour line points at some level Z.  If ruled surface is exploded it creates 3dfaces from whom is relatively ease to points at level Z and create contour.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 20 of 31

john.uhden
Mentor
Mentor
Thanks, @hak_vz,
but I already have the interpolation function, and I don't like using
commands unless I have to. It's all about manipulating data.

John F. Uhden

0 Likes