马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
根据上次探讨的话题,给出两个常用的函数。
- [FONT=courier new]
- '获取块集合中匿名块的数量
- Function GetUNBlockCount() As Integer
- Dim BlockObj As AcadBlock
- Dim n As Integer
- For Each BlockObj In ThisDrawing.Blocks
- If Left(BlockObj.Name, 1) = "*" Then
- If BlockObj.Name <> "*Model_Space" And Left(BlockObj.Name, 12) <> "*Paper_Space" Then
- n = n + 1
- End If
- End If
- Next
- GetUNBlockCount = n
- Set BlockObj = Nothing
- End Function
- [/FONT]
- [FONT=courier new]
- '返回最后创建的匿名块
- Public Function GetUNBlock() As AcadBlock
- Dim BlockObj As AcadBlock
- Dim n As Integer
- For Each BlockObj In ThisDrawing.Blocks
- If Left(BlockObj.Name, 1) = "*" Then
- If BlockObj.Name <> "*Model_Space" And Left(BlockObj.Name, 12) <> "*Paper_Space" Then
- If Mid(BlockObj.Name, 3) >= n Then
- n = Mid(BlockObj.Name, 3)
- Set GetUNBlock = BlockObj
- End If
- End If
- End If
- Next
- Set BlockObj = Nothing
- End Function
- [/FONT]
|