|
不好意思,我第一次接触这个用VB编CAD
能帮我看一下这个程序
Dim acadapp As .AcadApplication
Private Sub Command1_Click()
Call 连接AutoCAD
Dim s(2) As Double
Dim e(2) As Double
s(0) = 0: s(1) = 100: s(2) = 0
e(0) = 0: e(1) = 100: e(2) = 0
Dim a As AutoCAD.AcadLine
a = acadapp.ActiveDocument.ModelSpace.addline(s, e)
acadapp.ZoomExtents
End Sub
Public Sub 连接AutoCAD()
On Error Resume Next
Set acadapp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
Set acadapp = CreateObject("AutoCAD.Application")
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
acadapp.Visible = True
acadapp.WindowState = acMax
AppActivate (acadapp.Caption)
End Sub
运行的时候,它总出问题,怎么回事呢 |
|