Home AutoCad VB Delete Blocks by Name
20 | 05 | 2012
This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade

Delete Blocks by Name PDF Print E-mail
User Rating: / 0
PoorBest 
Tutorials

This functions looks up and delete all blocks by name.

Show/Hidden vbnet code

View source
 
 
	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:
FileDescriptionFile sizeDownloads
Download this file (CountDeleteBlocks.dvb)CountDeleteBlocksGet a list of Blocks and hit Delete to Delete it.80 Kb550
 

Add comment


Security code
Refresh

This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade