This works for me:
VolumeSurface.dyn (7.4 KB)
# 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.
vs_name = IN[0]
adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
btrID = bt.get_Item("*Model_Space")
btr = t.GetObject(btrID, OpenMode.ForWrite)
for oid in btr:
obj = t.GetObject(oid, OpenMode.ForWrite)
if isinstance(obj, TinVolumeSurface) and obj.Name == vs_name:
volumeSurface = obj
props = volumeSurface.GetVolumeProperties()
adjustedCutVolume = "Adjusted Cut Volume = " + str(props.AdjustedCutVolume)
adjustedFillVolume = "Adjusted Fill Volume = " + str(props.AdjustedFillVolume)
adjustedNetVolume = "Adjusted Net Volume = " + str(props.AdjustedNetVolume)
#
#
# Commit before end transaction
t.Commit()
pass
# Assign your output to the OUT variable.
OUT = adjustedCutVolume, adjustedFillVolume, adjustedNetVolume
If you just want the integers and not strings then you can just remove the string addition and the “str()” command. If you add dir(props) to “OUT”, you can see all available properties.