|
Tutorials
|
|
This functions looks up and delete all blocks by name.
Show/Hidden vbnet code
Function DeleteBlock(ByVal BlockName As String)
'****************************************
'*** Code from VisibleVisual.com ********
'****************************************
Dim ent As AcadEntity
Dim oBkRef As AcadBlockReference
Dim Insertpoints As Variant
Dim A As Double
'First we go over every object in the modelspace
For Each ent In ThisDrawing.ModelSpace
'Check if the object is a block
If ent.ObjectName = "AcDbBlockReference" Then
Set oBkRef = ent
'If the object is a block then check if its the block we are looking for
If oBkRef.EffectiveName = BlockName Then
'Delete the Block
A = A + 1
oBkRef.Delete
End If
'Next object
End If
Next ent
End Function
Download the complete project below. The project is hooked to the count block tutorial. Just select a block from the list to delete it.
Attachments:
| File | Description | File size | Downloads |
CountDeleteBlocks | Get a list of Blocks and hit Delete to Delete it. | 80 Kb | 550 |
|