毛竹 22:12:47
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common
Public Class Form1
  rivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Acadapp As AcadApplication
Dim Acaddoc As Autodesk.AutoCAD.Interop.AcadDocumentClass
Dim StartPoint(0 To 2) As Double
Dim Endpoint(0 To 2) As Double
StartPoint(0) = 100
StartPoint(1) = 100
Endpoint(0) = 200
Endpoint(1) = 200
Try
Acadapp = GetObject(, "AutoCAD.Application.18")
Catch ex As Exception
If Err.Number Then
Err.Clear()
Acadapp = CreateObject("AutoCAD.Application.18")
Acadapp = New Autodesk.AutoCAD.Interop.AcadApplicationClass
Acaddoc = Acadapp.ActiveDocument
Acadapp.Visible = True
Acaddoc.ModelSpace.AddLine(StartPoint, EndPoint)
If Err.Number Then
MsgBox(Err.Description)
Exit Sub
End If
End If
End Try
End Sub
End Class
毛竹 22:13:48
以上代码可以autocad2010中正确运行,但是觉得比较奇怪
Acadapplication用 为什么又有AcadapplicationClass
毛竹 22:14:33
不知道有什么区别 请教大家如果知道的话 请指导
毛竹 22:17:40
[qqimg]201309/{74B4EE77-A047-C52B-0D5B-68D853451D58}.jpg[/qqimg] |