qwh923820 发表于 2017-12-15 08:47:34

求助2个问题

1、VBA 用了标注,怎么编辑标注的文字内容,比如 ‘900’ 改成 “长度900”
Set x = ThisDrawing.ModelSpace.AddDimAligned(pt1, pt2, pt3)


2、选择的时候第一遍能选中区域内的内容,循环第二遍不能选中
Dim pt1(2) As Double, pt2(2) As Double
pt1(0) = -1500
pt1(1) = -1500
pt1(2) = 0
pt2(0) = 3200
pt2(1) = 3200
pt2(2) = 0
    On Error Resume Next
    If Not IsNull(ThisDrawing.SelectionSets.Item(na)) Then
      Set y = ThisDrawing.SelectionSets.Item(na)
      y.Delete
    End If
    Set y = ThisDrawing.SelectionSets.Add(na)
    y.Select acSelectionSetCrossing, pt1, pt2
    Dim ww As AcadBlock
    Set ww = ThisDrawing.Blocks.Add(pt, na)
    ReDim x(y.Count - 1)
    Dim i As Integer
    For i = 0 To y.Count - 1
      Set x(i) = y.Item(i)
    Next i   
    ThisDrawing.CopyObjects x, ww
    Dim obj As AcadObject
    For Each obj In ThisDrawing.ModelSpace
      obj.Delete
    Next
y.Delete

qwh923820 发表于 2017-12-15 09:30:23

第二个问题我查到了,加段代码
ThisDrawing.Application.Update

解决了

第一个问题求教大神
页: [1]
查看完整版本: 求助2个问题