这段程序为绘制一个圆让后生成面域,但是我调试的时候只能绘出圆 ,到生成面域时出错:"时实错误426".请高人指点,谢谢!
Const pi = 3.1415926 Dim r As Double Dim Acadapp As AutoCAD.AcadApplication
Private Sub Command4_Click() Call drwPicture End Sub '绘制面域 Sub drwPicture() Call linkCad Dim curves(0) As AutoCAD.AcadEntity Dim centerpoint(2) As Double r = 600 centerpoint(0) = 0: centerpoint(1) = 0: centerpoint(2) = 0 Set curves(0) = Acadapp.ActiveDocument.ModelSpace.AddCircle(centerpoint, r) Dim obj As Object obj = Acadapp.ActiveDocument.ModelSpace.AddRegion(curves) End Sub
'建立与cad连接 Sub linkCad() 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 = AutoCAD.AcWindowState.acMax End Sub
|