VB与CAD相关的问题,求解答~~
Dim AcadApp As AcadApplicationPrivate Sub Command1_Click()
Dim lineObj As AcadLine
Dim Startpoint(0 To 2) As Double
Dim Endpoint(0 To 2) As Double
Startpoint(0) = 1#: Startpoint(1) = 1#: Startpoint(2) = 0#
Endpoint(0) = 15#: Endpoint(1) = 15#: Endpoint(2) = 0#:
Set lineObj = AcadApp.ActiveDocument.ModelSpace.Addline_(Startpoint.Endpoint)
ZoomAll
End Sub
Private Sub Form_Load()
On Error Resume Next
Set AcadApp = GetObject("AutoCAD.Application")
If Err Then
Err.Clear
Set AcadApp = CreateObject("AutoCAD.Application")
If Err Then
MsgBox ("不能运行AutoCAD 2007,请检查是否安装了AutoCAD 2007")
Exit Sub
End If
End If
AcadApp.Visible = True
End Sub