明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2697|回复: 1

麻烦高手给看看这段程序有什么问题

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

麻烦高手给看看这段程序有什么问题,我想把一幅地形图的所有符合条件的直线的ENDPOINT修改,也就是向某方向延长这条直线,但延长的方向总不对,为什么?

On Error Resume Next
   
Dim i, n As Long
Dim newObjs As AcadLine
Dim p(2)  As Double
Dim iCount As Long, iPoint As Integer

n = ThisDrawing.ModelSpace.Count

For i = 0 To n - 1
 
      If ThisDrawing.ModelSpace.Item(i).Thickness = "6112004" Or ThisDrawing.ModelSpace.Item(i).Thickness = "6320104" Or ThisDrawing.ModelSpace.Item(i).Thickness = "6310004" Then
     
         Set newObjs = ThisDrawing.ModelSpace.Item(i)
     
        
         X1 = newObjs.startPoint(iCount)
         Y1 = newObjs.startPoint(iCount + 1)
         z1 = newObjs.startPoint(iCount + 2)
        
         X2 = newObjs.endPoint(iCount)
         Y2 = newObjs.endPoint(iCount + 1)
         z2 = newObjs.endPoint(iCount + 2)
        
         If ThisDrawing.ModelSpace.Item(i).length = "7" Then
        
          p(0) = (2 * X1 - X2): p(1) = (2 * Y1 - Y2)
      
         Else
        
          p(0) = (2 * X2 - X1): p(1) = (2 * Y2 - Y1)
        
         End If
         newObjs.endPoint = p
        
         newObjs.Update
     Else
     End If
Next i
ThisDrawing.Regen (True)
MsgBox "修改完毕"

 

 楼主| 发表于 2007-4-14 14:55:00 | 显示全部楼层

怎么没人回答啊

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 09:33 , Processed in 0.162497 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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