Is there a way to get surfaces volumes from Dynamo?

Hi
See this, may help you

Can you use
Qty earthwork
Try
Surface 1 compare
Surface 2 base
Surface 3 base

Screenshot_٢٠٢٢_٠٧٠٤_٢٢٤٨٥٨

I know that through several steps in civil 3d, what I indicate can be achieved.
But since Dynamo is used to automate processes, I wanted to know if it is possible to achieve it and have a shorter process to obtain that desired volume.

It’s an interesting idea. Ill take a look into it when I get a chance. Don’t have computer access for a bit. *Edit: Won’t have C3D access until the 11th due to being between jobs.

1 Like

thanks @WrightEngineering , I will be looking forward to your help.

@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.

@mzjensen Any intention to add “AddVertices” to tinSurface to camber? I wouldn’t of had to go into python if I had it available. :sweat_smile: 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 (162.1 KB)
LowestElevationSurfaceCombo-Post-Script.dwg (1002.5 KB)
LowestElevationSurfaceCombo-Pre-Script.dwg (957.5 KB)


(Result in green)

# 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

Sure!

1 Like