本帖最后由 dong20030432 于 2018-1-23 17:31 编辑
这是我的代码,要实现文字按行对齐,即所有文字y坐标相同, x坐标等间距分布,帮忙看下怎么能保证文字对象初始相对顺序不乱序,谢谢!
- On Error Resume Next
- If Not IsNull(acadapp.ActiveDocument.SelectionSets.Item("ss1")) Then
- Set sset = acadapp.ActiveDocument.SelectionSets.Item("ss1")
- sset.Delete
- End If
- Set sset = acadapp.ActiveDocument.SelectionSets.Add("ss1")
- Call CreateSSetFilter(fType, fDate, 0, "text")
- AppActivate acadapp.Caption
- sset.SelectOnScreen fType, fDate
- Call ShowSelectionSetCrips(sset)
- For i = 0 To sset.Count - 1
- If sset.Count = 1 Then Exit Sub
- If sset.Count > 1 Then
- If i = 0 Then
- myPoint = sset.Item(0).InsertionPoint
- End If
- If i > 0 Then
- myPoint = sset.Item(i - 1).InsertionPoint
- sset.Item(i).GetBoundingBox pMin, pMax
- dyPoint = sset.Item(i).InsertionPoint
- xPoint(0) = myPoint(0) + Val(m.Text4.Text) + pMax(0) - pMin(0)
- xPoint(1) = myPoint(1)
- xPoint(2) = dyPoint(2)
- sset.Item(i).Move dyPoint, xPoint
- sset.Item(i).Update
- End If
- End If
- Next
- sset.Delete
|