> Андрей
Мне кажется идея непродуктивная, не лучше ли
будет изменять значения атрибутов с приращением
а то у тебя будет немерено блоков
Тем не менее попробуй (почти без теста):
Option Explicit
Sub RenameOnFly()
Dim objBlk As AcadBlock
Dim newBlk As AcadBlock
Dim itmBlk As AcadObject
Dim objBlks As AcadBlocks
Dim insPnt As Variant
Dim origPt As Variant
Dim i, j As Integer
Dim blkRef As AcadBlockReference
Dim itmVar() As AcadObject
Dim blkName, matchStr As String
Dim isExist As Boolean
isExist = False
On Error GoTo ErrQuit
Set objBlks = ThisDrawing.Blocks
blkName = InputBox("Block Name:", , "Number")
For Each itmBlk In objBlks
If itmBlk.Name = blkName Then
isExist = True
End If
Next
If isExist Then
Set objBlk = objBlks(blkName)
Else
MsgBox "Block " & blkName & " does not isExist"
Exit Sub
End If
Set objBlk = objBlks(blkName)
origPt = objBlk.Origin
ReDim Preserve itmVar(0 To objBlk.Count - 1)
For i = 0 To objBlk.Count - 1
Set itmVar(i) = objBlk.Item(i)
Next
j = 0
On Error Resume Next
With ThisDrawing
Do
insPnt = .Utility.GetPoint(, "Pick insertion point >> :")
Set newBlk = objBlks.Add(origPt, "Block" & CStr(j))
.CopyObjects itmVar, newBlk
Set blkRef = .ModelSpace.InsertBlock(insPnt, "Block" & CStr(j), 1#, 1#, 1#, 0#)
j = j + 1
Loop
End With
ErrQuit:
MsgBox Err.Description
End Sub
~'J'~