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