Hi Bill,
Here is a VB.NET code snippet to create COGO points using COM API in Civil 3D (in a .NET application ) :
<code_begin>
Public Sub CreateCOGOPoint()
'' This sample Demonstrates Creation of COGO Point Civil 3D 2012
''
'' Created by Partha P. Sarkar - DevTech, Autodesk
Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim oAcadApp As Autodesk.AutoCAD.Interop.AcadApplication = Nothing
Dim oAeccApp As Autodesk.AECC.Interop.UiLand.AeccApplication = Nothing
Dim oAeccDoc As Autodesk.AECC.Interop.UiLand.AeccDocument = Nothing
Dim oAeccDB As Autodesk.AECC.Interop.Land.AeccDatabase = 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
oAeccApp = oAcadApp.GetInterfaceObject("AeccXUiLand.AeccApplication.9.0")
oAeccDoc = oAeccApp.ActiveDocument
oAeccDB = oAeccApp.ActiveDocument.Database
Dim oPoint As Autodesk.AECC.Interop.Land.AeccPoint = Nothing
Dim pointLocation As Point3d = Nothing
Dim promptPtOp As PromptPointOptions = New PromptPointOptions(vbCrLf + "Select the Location to create the COGO Point : ")
promptPtOp.LimitsChecked = True
promptPtOp.AllowNone = False
Dim promptPtRes As PromptPointResult = ed.GetPoint(promptPtOp)
If promptPtRes.Status <> PromptStatus.OK Then
ed.WriteMessage("Exiting! Try Again !")
Exit Sub
End If
pointLocation = promptPtRes.Value
Dim location(0 To 2) As Double
location(0) = pointLocation.X
location(1) = pointLocation.Y
location(2) = pointLocation.Z
oPoint = oAeccDoc.Points.Add(CType(location, Object))
oPoint.RawDescription = "RAW1"
oPoint.Name = "NAME1"
oPoint.Number = 10
trans.Commit()
Catch ex As Exception
ed.WriteMessage("Error : ", ex.Message & vbCrLf)
End Try
End Using
End Sub
<code_end>
You might find the following DevTVs / Training videos useful (http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=8007696 😞
DevTV : Introduction to AutoCAD Civil 3D .NET Programming NEW!
A self-paced video tutorial on introduction to AutoCAD Civil 3D .NET Programming.
View Online | Download
DevTV: Introduction to Civil 3D Programming
A self-paced video tutorial demonstrating how to get started developing with Civil 3D.
View online | Download
Video : AutoCAD Civil 3D 2012 Surface .NET API
A self-paced video tutorial demonstrating the new Surface objects and related function in AutoCAD 2012 .NET API.
View online | Download
Hope this helps,
Thanks,