- 积分
- 738
- 明经币
- 个
- 注册时间
- 2004-11-5
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
按AutoCAD2004的开发者文档的例子编译,发现运行时出现这种错误提示,请问是怎么回事
代码如下:
Sub Ch3_ImportingAndExporting()
' 创建圆用于直观显示 Dim circleObj As AcadCircle Dim centerPt(0 To 2) As Double Dim radius As Double centerPt(0) = 2: centerPt(1) = 2: centerPt(2) = 0 radius = 1 Set circleObj = ThisDrawing.ModelSpace.AddCircle _ (centerPt, radius) ThisDrawing.Application.ZoomAll ' 创建空的选择集 Dim sset As AcadSelectionSet Set sset = ThisDrawing.SelectionSets.Add("NEWSSET") '将当前图形输出到 ' AutoCAD 临时文件目录下的 DXF 文件 Dim tempPath As String Dim exportFile As String Const dxfname As String = "DXFExprt" tempPath = _ ThisDrawing.Application.Preferences.Files.TempFilePath exportFile = tempPath & dxfname ThisDrawing.Export exportFile, "DXF", sset
' 删除空的选择集 ThisDrawing.SelectionSets.Item("NEWSSET").Delete
' 打开新图形 ThisDrawing.Application.Documents.Add "acad.dwt" ' 定义输入 Dim importFile As String Dim insertPoint(0 To 2) As Double Dim scalefactor As Double importFile = tempPath & dxfname & ".dxf" insertPoint(0) = 0: insertPoint(1) = 0: insertPoint(2) = 0 scalefactor = 2# ' 输入文件 ThisDrawing.Import importFile, insertPoint, scalefactor ThisDrawing.Application.ZoomAll End Sub
调试时, 提示这一句有问题 ThisDrawing.Application.Documents.Add "acad.dwt"
另外,请问在2002和2004里用VBA或VB进行二次开发时有没有区别,在一个版本上编的程序会不会在另一个版本里出错. |
|