明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2313|回复: 4

如何使多义线反向

[复制链接]
发表于 2007-10-8 15:44:00 | 显示全部楼层 |阅读模式
高手们,请教使多义线反向程序
发表于 2007-10-8 16:46:00 | 显示全部楼层
反向是什么意思,不说明白
发表于 2007-10-8 19:45:00 | 显示全部楼层

先获取多义线的坐标,在由坐标数组的最后一个点对倒过来画线,删除原线.此中法子适用于任何情况.

发表于 2007-10-8 20:47:00 | 显示全部楼层

Option Explicit

'program to reverse the direction of a pline
'modified from malcolm's codes

Private Sub reverse_pline(plineObj As Variant)
Dim pts() As Double
Dim bulge() As Double
Dim legs As Integer
Dim retcoord As Variant

Dim i As Integer
Dim i2 As Integer

retcoord = plineObj.Coordinates
ReDim Preserve pts(UBound(retcoord))

legs = (UBound(retcoord) / 2) - 1
ReDim Preserve bulge(legs)

For i = legs - 1 To 0 Step -1
bulge(i) = plineObj.GetBulge(legs - 1 - i) * -1
Next i

For i = UBound(retcoord) To 0 Step -2
i2 = UBound(retcoord) - i
pts(i2 + 1) = retcoord(i)
pts(i2) = retcoord(i - 1)
Next i

plineObj.Coordinates = pts
For i = 0 To legs - 1
plineObj.SetBulge i, bulge(i)
Next i

End Sub

Public Sub Test()
Dim polyObj As AcadLWPolyline
Dim ptPicked As Variant
ThisDrawing.Utility.GetEntity polyObj, ptPicked, "Select a LWpolyline: "
reverse_pline polyObj
End Sub

 楼主| 发表于 2007-10-9 08:40:00 | 显示全部楼层

请问这程序如何用呀

请问4楼楼主,这程序如何用呀?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 12:32 , Processed in 0.164798 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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