.NET

Reply
New Member
Jeff_Hoffelner
Posts: 1
Registered: ‎12-13-2005
Message 1 of 2 (67 Views)

Deleting a Line

67 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
Mikko
Posts: 212
Registered: ‎10-03-2003
Message 2 of 2 (67 Views)

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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community