Option Explicit
Dim acadapp As AcadApplication
Dim preference As AcadPreferences
Dim acaddoc As AcadDocument
Dim paspace As AcadPaperSpace
Dim mospace As AcadModelSpace
Dim q(2, 50) As Double
Private Sub Command1_Click()
Static i As Integer
Combo1.AddItem i + 1
i = i + 1
q(0, i) = Text1.Text
q(1, i) = Text2.Text
q(2, i) = 0
End Sub
Private Sub Command2_Click()
On Error Resume Next
Set acadapp = GetObject("autocad.application")
If Err Then
Err.Clear
Set acadapp = CreateObject("autocad.application")
If Err Then
MsgBox "不能运行AutoCAD!!!"
Exit Sub
End If
End If
acadapp.Visible = True
Set preference = acadapp.Preferences
Set acaddoc = acadapp.ActiveDocument
Set mospace = acaddoc.ModelSpace
Set paspace = acaddoc.PaperSpace
Call acaddoc.New("acad.dwt")
End Sub
Private Sub Command3_Click()
Dim A(2) As Double
Dim B(2) As Double
Dim C(2) As Double
Dim D(2) As Double
Dim i As Integer
For i = 0 To 40
A(0) = q(0, i) + q(i + 1, 0)
A(1) = q(1, i) / 2
A(2) = 0
B(0) = q(0, 0) + q(i + 1, 0)
B(1) = -q(1, i) / 2
B(2) = 0
C(0) = q(0, i) + q(i + 1, 0)
C(1) = -q(1, i) / 2
C(2) = 0
D(0) = q(0, i) + q(i + 1, 0)
D(1) = q(1, i) / 2
D(2) = 0
mospace.AddLine A, B
mospace.AddLine B, C
mospace.AddLine C, D
mospace.AddLine D, A
Next i
End Sub
Private Sub GUANYU_Click()
MsgBox "作者:huayv"
End Sub
[此贴子已经被作者于2007-6-14 10:03:46编辑过]