sjydizhi 发表于 2007-10-8 15:44:00

如何使多义线反向

高手们,请教使多义线反向程序

phonexi 发表于 2007-10-8 16:46:00

反向是什么意思,不说明白

mycad 发表于 2007-10-8 19:45:00

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

alin 发表于 2007-10-8 20:47:00

<p>Option Explicit</p><p>'program to reverse the direction of a pline<br/>'modified from malcolm's codes</p><p>Private Sub reverse_pline(plineObj As Variant)<br/>Dim pts() As Double<br/>Dim bulge() As Double<br/>Dim legs As Integer<br/>Dim retcoord As Variant</p><p>Dim i As Integer<br/>Dim i2 As Integer</p><p>retcoord = plineObj.Coordinates<br/>ReDim Preserve pts(UBound(retcoord))</p><p>legs = (UBound(retcoord) / 2) - 1<br/>ReDim Preserve bulge(legs)</p><p>For i = legs - 1 To 0 Step -1<br/>bulge(i) = plineObj.GetBulge(legs - 1 - i) * -1<br/>Next i</p><p>For i = UBound(retcoord) To 0 Step -2<br/>i2 = UBound(retcoord) - i<br/>pts(i2 + 1) = retcoord(i)<br/>pts(i2) = retcoord(i - 1)<br/>Next i</p><p>plineObj.Coordinates = pts<br/>For i = 0 To legs - 1<br/>plineObj.SetBulge i, bulge(i)<br/>Next i</p><p>End Sub</p><p>Public Sub Test()<br/>Dim polyObj As AcadLWPolyline<br/>Dim ptPicked As Variant<br/>ThisDrawing.Utility.GetEntity polyObj, ptPicked, "Select a LWpolyline: "<br/>reverse_pline polyObj<br/>End Sub</p>

sjydizhi 发表于 2007-10-9 08:40:00

请问这程序如何用呀

请问4楼楼主,这程序如何用呀?
页: [1]
查看完整版本: 如何使多义线反向