这是一个vba示例,您可以使用两种方法,一种是按照本例中属性的顺序,另一种是使用标记名。有很多建议从VBA转移到VL/lisp或。网
- Public Sub add_project_number()
- ' This Updates the project number
- Dim SS As AcadSelectionSet
- Dim Count As Integer
- Dim FilterDXFCode(1) As Integer
- Dim FilterDXFVal(1) As Variant
- Dim attribs, newtext As Variant
- Dim BLOCK_NAME As String
- 'On Error Resume Next
- Dim startCH As Double
- newtext = ThisDrawing.Utility.GetString(True, "Enter new project code : ")
- FilterDXFCode(0) = 0
- FilterDXFVal(0) = "INSERT"
- FilterDXFCode(1) = 2
- FilterDXFVal(1) = "DA1DRTXT"
- BLOCK_NAME = "DA1DRTXT"
- Set SS = ThisDrawing.SelectionSets.Add("issued")
- SS.Select acSelectionSetAll, , , FilterDXFCode, FilterDXFVal
- For Cntr = 0 To SS.Count - 1
- attribs = SS.Item(Cntr).GetAttributes
-
-
- attribs(1).TextString = newtext
- attribs(1).Update
-
- Next Cntr
- ThisDrawing.SelectionSets.Item("issued").Delete
- End Sub
|