本帖最后由 作者 于 2010-8-5 13:02:26 编辑
我将一个块复制黏贴成另外一个块后,如何在VBA里给两个块重命名啊? 以下代码执行后,两个块还是变成一样的名字
Dim sset As AcadSelectionSet Set sset = ThisDrawing.SelectionSets.Add("Selection") ' Define the filter list, only Circle objects ' will be selectable Dim FilterType(0) As Integer Dim FilterData(0) As Variant FilterType(0) = 0 FilterData(0) = "Block" ' Prompt the user to select objects ' and add them to the selection set sset.Select acSelectionSetAll, FilterType, FilterData MsgBox "Number of objects selected: " & sset.Count
For Count = 0 To sset.Count - 1 Set BlockObj = ThisDrawing.Blocks(sset.Item(Count).EffectiveName) '感觉是这里有问题,但是不知道怎么分别查找这两个同名块 BlockObj.name = sset.Item(Count).ObjectID
Next Count sset.Delete |