Message 1 of 4
Delete an entity
Not applicable
11-17-2006
10:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I just commited a deletion an entity belonged to selection set.
Any help, I would appreciate it.
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Interop.Common
Public Class GILSclass
_
Public Sub NFU()
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = HostApplicationServices.WorkingDatabase()
Try
Using trans As Transaction = db.TransactionManager.StartTransaction()
Dim vls1() As TypedValue = {New TypedValue(8, "LEVEL")}
Dim sftr1 As New SelectionFilter(vls1)
Dim rs1 As PromptSelectionResult = ed.SelectAll(sftr1)
Dim i As Integer
Dim SS1 As Autodesk.AutoCAD.EditorInput.SelectionSet = rs1.Value
Dim idary1 As ObjectId() = SS1.GetObjectIds()
For i = 0 To idary1.Length - 1
Dim ent1 As DBText = trans.GetObject(idary1(i), OpenMode.ForRead, False)
ent1.Erase()
Next
End Using
Catch ex As Exception
Finally
End Try
End Sub
End Class
Any help, I would appreciate it.
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Interop.Common
Public Class GILSclass
Public Sub NFU()
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = HostApplicationServices.WorkingDatabase()
Try
Using trans As Transaction = db.TransactionManager.StartTransaction()
Dim vls1() As TypedValue = {New TypedValue(8, "LEVEL")}
Dim sftr1 As New SelectionFilter(vls1)
Dim rs1 As PromptSelectionResult = ed.SelectAll(sftr1)
Dim i As Integer
Dim SS1 As Autodesk.AutoCAD.EditorInput.SelectionSet = rs1.Value
Dim idary1 As ObjectId() = SS1.GetObjectIds()
For i = 0 To idary1.Length - 1
Dim ent1 As DBText = trans.GetObject(idary1(i), OpenMode.ForRead, False)
ent1.Erase()
Next
End Using
Catch ex As Exception
Finally
End Try
End Sub
End Class