本帖最后由 xuzhenjun130 于 2011-8-26 10:06 编辑
autocad开发人员手册里的一段代码,请高手帮忙翻译成autoitSub Ch2_AddLineVB()
On Error Resume Next
' 连接至 AutoCAD 应用程序
Dim acadApp As AcadApplication
Set acadApp = GetObject _
(, "AutoCAD.Application.17")
If Err Then
Err.Clear
Set acadApp = CreateObject _
("AutoCAD.Application.17")
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
' 连接至 AutoCAD 图形
Dim acadDoc As AcadDocument
Set acadDoc = acadApp.ActiveDocument
' 创建直线的端点
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) = 5
endPoint(1) = 5
endPoint(2) = 0
' 在模型空间中创建 Line 对象
Set lineObj = acadDoc.ModelSpace.AddLine _
(startPoint, endPoint)
ZoomAll
acadApp.visible = True
End Sub
另外,有没有高手肯做一个操作autocad的autoit函数呢?
autocad已经开放很多编程接口,有点类似excel的。
希望有高手能作一下贡献
这个问题有点蛋疼了,估计很少人有那样的需求 |