|
发表于 2005-5-11 16:18:00
|
显示全部楼层
好象不是很难,进入后点工程--引用,弹出对话框,找到Autocad2004 type library( 我装的是2004版),接着做一个command1, 双击进入代码,代码为:
Private Sub mnu17_Click()
On Error Resume Next
' 连接至 AutoCAD 应用程序
Dim acadApp As AcadApplication
Set acadApp = GetObject(, "AutoCAD.Application.16")
If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application.16")
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
' 连接至 AutoCAD 图形
Dim acadDoc As AcadDocument
Set acadDoc = acadApp.ActiveDocument
acadDoc.ModelSpace.AddLightWeightPolyline ptArr1
acadDoc.ModelSpace.AddLightWeightPolyline ptArr2
ZoomAll
acadApp.Visible = True
'绘图完成,要求下一次计算
bCal = False
End Sub
运行程序,点击command1,就进入autocad2004了 |
|