Start and end point of alignment API Visual Basic . NET

Start and end point of alignment API Visual Basic . NET

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

Start and end point of alignment API Visual Basic . NET

Anonymous
Not applicable

Hello, 

 

I need to determine and extract the coordinates of the start and end point of the alignment.

 

Can someone help me with an example .net code.

 

Thank you very much.

 

Best regards.

 

Mauro Vega

 

AutoCAD Civil 3D 2018.1

Intel Core i7-6700HQ CPU 2.6 GHZ

32 GB RAM 2133 MHz

NVIDIA Quadro M3000M

Windows 10 Pro 64 Bits

0 Likes
Accepted solutions (1)
1,124 Views
3 Replies
Replies (3)
Message 2 of 4

Jeff_M
Consultant
Consultant
I don't do VB, so no example. However, the Alignment Object inherits from the AutoCAD Curve object, so it's properties can be used on the alignment. A Curve object has the StartPoint and EndPoint properties which is what you are looking for.
Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 3 of 4

sybold
Advocate
Advocate
Accepted solution

this should get you on your way,

 

            '' autocad
            Dim doc As Document = Core.Application.DocumentManager.MdiActiveDocument
            Dim db As Database = doc.Database
            Dim ed As Editor = doc.Editor
            Dim trans As Transaction = db.TransactionManager.StartTransaction

            '' civil
            Dim cdoc As CivilDocument = CivilApplication.ActiveDocument

            '' select alignment
            Dim promptentop As New PromptEntityOptions(vbLf + "select alignment")
            promptentop.SetRejectMessage("no alignment")
            promptentop.AddAllowedClass(GetType(Alignment), True)
            promptentop.AllowNone = False
            Dim promptentres As PromptEntityResult = ed.GetEntity(promptentop)
            If promptentres.Status <> PromptStatus.OK Then
                ed.WriteMessage(vbLf + "error, no alignment")
            End If
            Dim alm As Alignment = trans.GetObject(promptentres.ObjectId, OpenMode.ForRead)

            '' alignment stuff
            Dim start As Point3d = alm.StartPoint
Message 4 of 4

Anonymous
Not applicable

Hello Sybold,

 

Thank you very much, you are very kind.

 

This was just what I needed.

 

Best regards.

0 Likes