ODTables.GetODRecords method

AutoCAD Map 3D ActiveX

ODTables.GetODRecords method

Gets the collection of all records in the project.

GetODRecords( ) As ODRecords

Returns the collection.

Includes all the records in all the tables in the project. Note that the ODRecords collection iterates the records of only one object at a time, as set by ODRecords.Init. If you get ODRecords through an ODTables collection, you can iterate the object records regardless of which table they are from, as shown in the following example. If you get ODRecords through an ODTable object, you can iterate only those object records from that table.

The following example builds on sample code for creating object data tables. For more information, click . First, run the sample code for creating object data tables twice. Change the name of the table from SampleOD to SampleOD2 before running it the second time. Next, run the following code to iterate through records from multiple tables attached to each object in the drawing.

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 

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