.NET

Reply
New Member
1 Posts
0 Kudos
Registered: ‎12-13-2005
Post 1 of 2

Deleting a Line

73 Views, 1 Replies
12-13-2005 08:36 AM
I have been trying to delete a AcadLine object from a AutoCad 2006 drawing. I have been using the "Delete" method and then regenerating the document. This doesn't raise a error but it doesn't delete the line either. Any help you can give would be appreciated.

Thanks.
Distinguished Contributor
212 Posts
6 Kudos
Registered: ‎10-03-2003
Post 2 of 2

Re: Deleting a Line

12-13-2005 09:02 AM in reply to: Jeff_Hoffelner
Public Sub remove_Line()
Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim tm As Transaction = db.TransactionManager.StartTransaction()
Try
Dim res As PromptSelectionResult = ed.GetSelection
If res.Status <> PromptStatus.OK Then
Exit Sub
End If
Dim SS As Autodesk.AutoCAD.EditorInput.SelectionSet = res.Value
Dim tempIdArray() As ObjectId
tempIdArray = SS.GetObjectIds()
Dim tempId As ObjectId
For Each tempId In tempIdArray
Dim Ent As Entity = CType(tm.GetObject(tempId, OpenMode.ForWrite), Entity)
If Ent.GetType.Name.ToString() = "Line" Then
Ent.Erase()
End If
Next
tm.Commit()
Catch
Finally
tm.Dispose()
End Try
End Sub
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!