麻烦高手给看看这段程序有什么问题,我想把一幅地形图的所有符合条件的直线的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 "修改完毕" |