作了一个改多线段方向的函数,请高手指正:
Public Sub qq()
Dim pt() As Double
Dim a As Double
Dim obj As AcadLWPolyline
Dim objj As AcadLWPolyline
On Error Resume Next
Dim sset As AcadSelectionSet
If Not IsNull(ThisDrawing.SelectionSets.Item("example")) Then
Set sset = ThisDrawing.SelectionSets.Item("example")
sset.Delete
End If
Set sset = ThisDrawing.SelectionSets.Add("example")
sset.SelectOnScreen
Dim element As AcadEntity
For Each element In sset
Set obj = sset.Item(0)
Next
pt = obj.Coordinates
For i = 0 To (UBound(pt) - 1) / 2
a = pt(i)
pt(i) = pt(UBound(pt) - i)
pt(UBound(pt) - i) = a
Next
For i = 1 To UBound(pt) Step 2
a = pt(i)
pt(i) = pt(i - 1)
pt(i - 1) = a
Next
Set objj = ThisDrawing.ModelSpace.AddLightWeightPolyline(pt)
If obj.Closed = True Then
objj.Closed = True
End If
objj.Linetype = obj.Linetype
objj.LinetypeGeneration = obj.LinetypeGeneration
objj.LinetypeScale = obj.LinetypeScale
objj.Lineweight = obj.Lineweight
objj.TrueColor = obj.TrueColor
objj.Layer = obj.Layer
obj.Delete
End Sub