Hi @hosneyalaa,
Yeah I found that link as well, and I can get the cut and fill values now, but I need the structural volumes list (calculated from corridor shapes), but I don’t know how to use QTOResultType Enumeration:
http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/net/Autodesk__Civil__QTO__DatabaseServices__QTOResultType.htm
Any ideas, how to change the QuantityTakeoffResult to MaterialStructureVolume?
# 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.
dataEnteringNode = IN
aDoc = Application.DocumentManager.MdiActiveDocument
editor = aDoc.Editor
cDoc = CivilApplication.ActiveDocument
def get_slg_vol_result():
"""
This method gets the total volume result data for material list
associated with a sampleline group.
:param mappingGuid:
:return: Volume result data.
"""
global aDoc
global ed
global cDoc
# Instantiate empty lists
mNames = []
mGuids = []
matNames = []
volumes = []
volumeres = []
result = []
error_report = None
try:
# Get the active document in the AutoCAD session:
with aDoc.LockDocument():
with aDoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
# Get the objectId collection of all Alignment objects in the drawing
alignmentId = cDoc.GetAlignmentIds()
# Get the alignment
for a in alignmentId:
alignment = t.GetObject(a, OpenMode.ForRead)
# Get the object collection of all sample line groups
# belonging to alignment
for s in alignment.GetSampleLineGroupIds():
slg = t.GetObject(s, OpenMode.ForRead)
# Get the SLG QTO Mapping Names
mNames = slg.GetQTOMappingNames()
# Get the SLG mapping global unique identifier
for m in mNames:
mGuid = slg.GetMappingGuid(m)
mGuids.append(mGuid)
# Get material names in mapping and total volume
# result data for material list
for n in mGuids:
matName = slg.GetMaterialNamesInMapping(n)
matNames.append(matName)
volume = slg.GetTotalVolumeResultDataForMaterialList(n)
##volumetype = volume.kMaterialStructureVolume
volumes.append(volume)
qtoSectionalResult = volume.GetResultsAlongSampleLines()
length = qtoSectionalResult.Length
for i in range(length):
qtoAtStation = qtoSectionalResult[i]
volumeresatstation = qtoAtStation.VolumeResult
fill = volumeresatstation.IncrementalFillVolume
volumeres.append(fill)
result = [mNames, mGuids, matNames, qtoSectionalResult,volumeres]
return result
except:
import traceback
error_report = traceback.format_exc()
# Output
OUT = get_slg_vol_result()