Points API in 2012?

Points API in 2012?

Anonymous
Not applicable
1,156 Views
3 Replies
Message 1 of 4

Points API in 2012?

Anonymous
Not applicable

We have just upgrade to Civil 3d 2012 from LDD 08.  I have to update my VBA items to vb.net.  I have been looking for samples on the Points API, but i see that it has not been released.  So i have to use the COM API.  Does anyone have any samples on importing points thru the COM API for .net or point me in a good direction?  I know i can download the VBA installer for 2012 but need to convert code over to .net.

 

Thanks in advance

 

 

0 Likes
1,157 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Hi Bill,

 

Points are not yet available in .NET, however you can use the exiting Points COM API in VB.NET application using Interop. I have  code snippet on creating COGO point in Civil 3D 2012 using COM API in a VB.NET project, I can share with you if that helps.

 

Thanks,

 

0 Likes
Message 3 of 4

Anonymous
Not applicable
That would be great. You can email to bill.salling@uei-houston.com

Next time you are in Houston I will by you lunch or something
0 Likes
Message 4 of 4

Anonymous
Not applicable

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,

0 Likes