ODRecords.Remove method

AutoCAD Map 3D ActiveX

ODRecords.Remove method

Removes the current record from the collection.

Remove( ) As Boolean

Returns True on success.

The record is detached from its drawing object.

Create the query described here . Create an object data table described here . Run the following code to remove all the records with fields called Streams and display a list of the remaining records.

Dim amap As AcadMap

Dim ODrcs As ODRecords

Dim boolVal As Boolean

Dim acadObj As Object

Dim prj As Project

Dim i As Integer

 

Set amap = ThisDrawing.Application. _

GetInterfaceObject("AutoCADMap.Application") 

Set prj = amap.Projects(ThisDrawing)

prj.ProjectOptions.DontAddObjectsToSaveSet = True

Set ODrcs = prj.ODTables.GetODRecords

For Each acadObj In ThisDrawing.ModelSpace

boolVal = ODrcs.Init(acadObj, True, False) 

Do While ODrcs.IsDone = False 

For i = 0 To ODrcs.Record.Count - 1 

If ODrcs.Record.Item(i).Value = "STREAM" Then 

ODrcs.Remove 

End If 

Next i 

ODrcs.Next 

Loop 

Next

ODrcs.Rewind

For Each acadObj In ThisDrawing.ModelSpace

boolVal = ODrcs.Init(acadObj, True, False) 

Do While ODrcs.IsDone = False 

Debug.Print ODrcs.Record.tableName 

Debug.Print ODrcs.Record.ObjectID 

For i = 0 To ODrcs.Record.Count - 1 

Debug.Print ODrcs.Record.Item(i).Value 

Next i 

ODrcs.Next 

Loop 

Next