Using IAeccSurveyProject:: GetPointByNumber API we can access a Survey Point instance with the input point number. Once we get the specific AeccSurveyPoint object we can access its various properties and methods. Most of the properties in COM API are read only i.e. we can get the value, but can set them using API except few e.g. -
IAeccSurveyPoint:: Name Property - > Gets or sets the name of the Point.
Here is a VB.NET sample code which demonstrates how to access Survey Database Points using COM API in Civil 3D 2014 :
Public Sub DemoAccessSurveyPoints()
'' This sample Demonstrates How to access Survey Database Points using COM API in Civil 3D 2014
''
'' Created by Partha Sarkar - DevTech, Autodesk
Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim oAcadApp As Autodesk.AutoCAD.Interop.AcadApplication = Nothing
Dim oAeccSurveyApp As Autodesk.AECC.Interop.UiSurvey.AeccSurveyApplication = Nothing
Dim oAeccSurveyDoc As Autodesk.AECC.Interop.UiSurvey.AeccSurveyDocument = Nothing
Dim oAeccSurveyDB As Autodesk.AECC.Interop.Survey.AeccSurveyDatabase = Nothing
Using trans As Transaction = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction()
Try
If oAcadApp Is Nothing Then
oAcadApp = GetObject(, "AutoCAD.Application")
End If
Catch ex As Exception
ed.WriteMessage(ex.Message)
End Try
Try
' If you are using the COM API in Civil 3D 2014
' you need to update the object version to 10.3
' http://adndevblog.typepad.com/infrastructure/2013/03/whats-new-in-autocad-civil-3d-2014-api.html
oAeccSurveyApp = oAcadApp.GetInterfaceObject("AeccXUiSurvey.AeccSurveyApplication.10.3")
oAeccSurveyDoc = oAeccSurveyApp.ActiveDocument
oAeccSurveyDB = oAeccSurveyApp.ActiveDocument.Database
Dim oSurveyProjects As AeccSurveyProjects = CType(oAeccSurveyDB.Projects, AeccSurveyProjects)
' get the 1st Project from the Survey Projects collection
Dim oSurveyProject As AeccSurveyProject = oSurveyProjects.Item(0)
If Not (oSurveyProject Is Nothing) Then
' Get the Project Name
ed.WriteMessage(vbCrLf + "Projcet Name : " + " " + oSurveyProject.Name.ToString())
' IAeccSurveyProject:: GetPointByNumber
' Gets the Survey Point instance with the input point number.
Dim oSurveyPoint As AeccSurveyPoint = oSurveyProject.GetPointByNumber(1)
' Check the Point Properties Name, Easting, Northing & Elevation
ed.WriteMessage(vbCrLf + "Point Name : " + oSurveyPoint.Name.ToString() )
ed.WriteMessage(vbCrLf + "Easting : " + oSurveyPoint.Easting.ToString() + " " +
"Northing : " + oSurveyPoint.Northing.ToString() + " " +
"Elevation : " + oSurveyPoint.Elevation.ToString())
End If
trans.Commit()
Catch ex As Exception
ed.WriteMessage("Error : ", ex.Message & vbCrLf)
End Try
End Using
End Sub
Here is a screenshot of the result from this code snippet :
Hope this is useful to you!