# Is there a way to get surfaces volumes from Dynamo?

**URL:** <https://forum.dynamobim.com/t/is-there-a-way-to-get-surfaces-volumes-from-dynamo/43767>\
**Category:** Civil 3D\
**Created:** [November 28, 2019, 3:50pm UTC](https://forum.dynamobim.com/t/is-there-a-way-to-get-surfaces-volumes-from-dynamo/43767 "2019-11-28T15:50:25Z")\
**Posts on this page:** 1\
**Showing post:** 28

<div class="post-metadata">

**Author:** ![WrightEngineering](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/wrightengineering/32/115676_2.png) [@WrightEngineering](https://forum.dynamobim.com/u/WrightEngineering)\
**Post date:** [July 17, 2022, 2:03am UTC](https://forum.dynamobim.com/t/is-there-a-way-to-get-surfaces-volumes-from-dynamo/43767/28 "2022-07-17T02:03:07Z")

</div>

@Edwin.Saez , Sorry for the delay. I just started a new job and I’ve been having less time/an adjustment period + other personal matters. Here is your solution. It will get the combined boundary of two selected surfaces and generate a grid based on the grid spacing input, so decrease the spacing if you want higher accuracy. Where surface 1 exists and surface 2 doesn’t, points on surface 1 will be returned for the new surface and vice versa. Where surface 1 and surface 2 overlaps, the point that is returned is the one with the lower z value. The script then creates a new surface named “combined\_surface” and adds the verticies to generate the surface you intend to compare with surface 3. You may have to trim off triangulation or add a boundary manually. I couldn’t find the add surface boundary command exposed in the API.

@zachri.jensen Any intention to add “AddVertices” to tinSurface to camber? I wouldn’t of had to go into python if I had it available. 😅 I did notice that “AddVertices” was throwing an exception when the surface was empty. Not sure why. I just iterated with the “AddVertex” Method.  
[LowestElevationSurfaceCombo.dyn](https://forum.dynamobim.com/uploads/short-url/3S26P5W99lvW4xemwfGq4ev1Nd9.dyn) (162.1 KB)  
[LowestElevationSurfaceCombo-Post-Script.dwg](https://forum.dynamobim.com/uploads/short-url/90VwXwEJyPTCWbPFGMhYlhCEqDR.dwg) (1002.5 KB)  
[LowestElevationSurfaceCombo-Pre-Script.dwg](https://forum.dynamobim.com/uploads/short-url/1ljktgyDEQ7Qvoh2TJud4ohOFwW.dwg) (957.5 KB)

 ![Result.PNG](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/2/c219eff2d67f5d2efe392086771d148bec99b776.jpeg)  
(Result in green)

```auto
# Load the Python Standard and DesignScript Libraries
import sys
import clr

# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')

# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

# The inputs to this node will be stored as a list in the IN variables.
inputPoints = IN[0]
surface = IN[1]

verticesToAdd = [Point3d(inputPoint.X, inputPoint.Y, inputPoint.Z) for inputPoint in inputPoints]

adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor

with adoc.LockDocument():
    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
            try:
                shoot = "yay"
                cdoc = CivilDocument.GetCivilDocument(db)
                tinSurface = surface.InternalDBObject
                tinSurface.UpgradeOpen()
                    
                for vertex in verticesToAdd:
                    tinSurface.AddVertex(vertex)
                
            except:
                shoot = "oops"
                
            
                
            
            t.Commit()
            pass

# Assign your output to the OUT variable.
OUT = tinSurface.AddVertices. __doc__ , shoot, tinSurface, verticesToAdd

```

---

_[View the full topic](https://forum.dynamobim.com/t/is-there-a-way-to-get-surfaces-volumes-from-dynamo/43767)._
