I could do it as below code, which is similar to VBA coding.
When you add reference, you need to browse "Autodesk.autoCAD.Interop.dll" and "Autodesk.autoCAD.Interop.Common.dll" from AutoCAD installation directory.
===================================================================
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common
Public Class frm_Main
Dim AcadApp As New Autodesk.AutoCAD.Interop.AcadApplication
Dim AcadDoc As Autodesk.AutoCAD.Interop.AcadDocument
Dim ThisDwg As String
'----Open blank drawing in C:\, Event when form load.
Private Sub frm_Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ThisDwg = "C:\Test.dwg"
AcadDoc = AcadApp.ActiveDocument
AcadDoc.Application.Documents.Open(ThisDwg)
AcadDoc = AcadApp.ActiveDocument
AcadApp.Visible = True
End Sub
'----Event for button click
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim lineObj As AcadLine
Dim Point1(2) As Double
Dim Point2(2) As Double
Dim Point3(2) As Double
Dim Point4(2) As Double
Point1(0) = 0 : Point1(1) = 0
Point2(0) = 1 : Point2(1) = 1
Point3(0) = 2 : Point3(1) = 1
Point4(0) = 3 : Point4(1) = 4
lineObj = AcadDoc.ModelSpace.AddLine(Point1, Point2)
lineObj = AcadDoc.ModelSpace.AddLine(Point2, Point3)
lineObj = AcadDoc.ModelSpace.AddLine(Point3, Point4)
End Sub
End Class
Can't find what you're looking for? Ask the community or share your knowledge.