daron 发表于 2004-4-15 08:37:43

当我替换Keiths关于对齐的代码时,代码运行得很好

daron 发表于 2004-4-15 09:55:44

亨迪,我想这似乎是解决办法

hendie 发表于 2004-4-15 18:39:26

我好像收到了一条奇怪的错误信息。我在网上查到的,其实没什么意义。我做了一个选择案例来检查它是否有错误消息,如果是,则继续下一步。明天上班的时候我会把代码发出去,以防有人想要 0 Then
      YesNo = MsgBox("You Have " & SelSet.Count & " Attribute
Definition(s) in " & ThisDrawing.Name & _
      ". Would you like this program to attempt to convert them to text?",
_
      vbYesNo + vbCritical + vbDefaultButton1)
      'if "Ok" is pressed then try to replace all of the attribute
definitions with text that has the same properties.
      If YesNo = vbYes Then
            For Each AT In SelSet
                Set TXT = ThisDrawing.ModelSpace.AddText(AT.TagString,
AT.InsertionPoint, AT.Height)
                TXT.Alignment = AT.Alignment
                TXT.TextAlignmentPoint = AT.TextAlignmentPoint
                TXT.Layer = AT.Layer
                TXT.Color = AT.Color
                TXT.Rotation = AT.Rotation
                TXT.Update
                AT.Delete
            Next
      End If
    End If
    'clear the selection set
    SelSet.Clear
    'rescan the drawing for attribute definitions
    SelSet.Select acSelectionSetAll, , , FilterType, FilterData
    'if it the count is zero then it worked.
    If SelSet.Count = 0 Then
      MsgBox "All attributes were converted to text."
    Else:
      MsgBox "Failed to convert all attributes to text."
    End If
Exit_Error:
    Select Case Err.Number
    Case -2145386494 'not applicable
      Resume Next
    Case Else
      SelSet.Delete
      Set SelSet = Nothing
      Set AT = Nothing
      Set TXT = Nothing
    End Select
End Sub

daron 发表于 2004-4-16 18:32:22

有趣的是事情是如何发展的。
我刚刚找到了这个例程的用途。谢谢你们。
页: 1 [2]
查看完整版本: 用文本替换属性定义。