明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1524|回复: 1

用VBA编程以后出现图形退化,程序代码如下,请教一下,是怎么回事?

[复制链接]
发表于 2007-5-18 15:34:00 | 显示全部楼层 |阅读模式

问一下,图形退化是怎么回事?

程序如下:

Private Sub draw()
          '引用   Microsoft   Excel   11.0   Object   Library
          Dim xlsApp     As Excel.Application
          Dim eworkbook     As Workbook
          Dim eworksheet     As Worksheet
          Dim cir(0 To 1) As AcadEntity
          Dim b(0 To 2) As Double, g(0 To 2) As Double
          Dim c  As Double
          Dim x As Acad3DSolid
          Dim d As Double
          Dim e As Double
          Dim f As Double
          Dim re As Variant
          Dim height(0 To 1) As Double          
               
            e = 0
                        
          Set xlsApp = New Excel.Application
          Set eworkbook = xlsApp.Workbooks.Open("F:\国道112\坐标.xls")
          Set eworksheet = eworkbook.Sheets("8标的桥位坐标表")
          For j = 4 To 20
      
            For i = 4 To 118
            
             With eworksheet
            
                 b(0) = .Cells(i, j)
                 b(1) = .Cells(i, j + 1)
                 b(2) = .Cells(i, j + 2)
                    c = .Cells(i, j + 3)
                    height(0) = .Cells(i, j + 4)
                 g(0) = .Cells(i + 1, j)
                 g(1) = .Cells(i + 1, j + 1)
                 g(2) = .Cells(i + 1, j + 2)
                    f = .Cells(i + 1, j + 3)
                    height(1) = .Cells(i + 1, j + 4)
         
             End With
            
             Set cir(0) = ThisDrawing.ModelSpace.addcircle(b, c)
             Set cir(1) = ThisDrawing.ModelSpace.addcircle(g, f)
            
             re = ThisDrawing.ModelSpace.AddRegion(cir)
            
        
                                            
          Set x = ThisDrawing.ModelSpace.AddExtrudedSolid(re(0), -height(0), e) '此中的re(0),即acadregion必须为一个域,而不是一个数组。
          Set x = ThisDrawing.ModelSpace.AddExtrudedSolid(re(1), -height(1), e)
         
              i = i + 2
            
              Next i
              j = j + 16
              Next j
            
             ZoomAll
             eworkbook.Close
             xlsApp.Quit
            
          'eworkbook.Save
          Set xlsApp = Nothing
          Set eworkbook = Nothing
          Set eworksheet = Nothing
                                  
         End Sub

哪位高手给看一下是哪出问题了?

发表于 2007-5-19 11:36:00 | 显示全部楼层
图形退化?不懂!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-2 06:37 , Processed in 0.166147 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表