Lisp "_ERASE" to .net com VB

Lisp "_ERASE" to .net com VB

Anonymous
Not applicable
500 Views
1 Reply
Message 1 of 2

Lisp "_ERASE" to .net com VB

Anonymous
Not applicable

Hi all,

 

i want delete some Models in MODELL Drawing without the LISP "_ERASE" because its stop when doesent have a named group in the drawing.

 

any Idears or Hints for deleting in .Net with a com addin?

 

thx for help

Mario

0 Likes
501 Views
1 Reply
Reply (1)
Message 2 of 2

Balaji_Ram
Alumni
Alumni

If I understand your question correctly, you would like to remove block table records from the drawing through your external exe using the COM API . Correct me if this is not what you wanted.

 

Here is a code snippet to get you started :

 

Dim acApplication As AcadApplication = Nothing
Dim progID As String = "AutoCAD.Application.18.1"

' Get the running instance of AutoCAD or start a new one.
Try
	acApplication = DirectCast(Marshal.GetActiveObject(progID), AcadApplication)
	acApplication.Visible = True
Catch comexception As COMException
	acApplication = New AcadApplication()
End Try

Dim activeDocument As AcadDocument = acApplication.ActiveDocument
Dim db As AcadDatabase = activeDocument.Database

' Iterate through the blocks and erase a block named "Test" if it exists.
Dim acadBlocks As AcadBlocks = activeDocument.Blocks
For cnt As Integer = 0 To acadBlocks.Count - 1
	Dim acadBlock As AcadBlock = acadBlocks.Item(cnt)
	If acadBlock.Name.Equals("Test") Then
		acadBlock.[Erase]()
	End If
Next

 



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes