I have used the example of Map Object-data. I try to change the Object-
data definition from a character to integer to do other querys.
How Do I have to Change the Column defenition of the object-data?
Where I have to add the definition "as integer" or "as long"?
Thanks
Gvanaco
Set amap =
ThisDrawing.Application.GetInterfaceObject("AutoCADMap.Application")
'Create OD Table Definition
Set ODfdfs = amap.Projects(ThisDrawing).MapUtil.NewODFieldDefs
' Add Column Headings and Defaults
Set ODfdf = ODfdfs.Add("Index", "Index", "", 0)
Set ODfdf = ODfdfs.Add("pipedia", "pipedia", "", 1)
Set ODfdf = ODfdfs.Add("pipemater", "pipemater", "", 2)
Sub tableproc()
Dim amap As AcadMap
Dim ODfdfs As ODFieldDefs
Dim ODfdf As ODFieldDef
Dim ODtb As ODTable
Dim ODrc As ODRecord
Set amap =
ThisDrawing.Application.GetInterfaceObject("AutoCADMap.Application")
'Create OD Table Definition
Set ODfdfs = amap.Projects(ThisDrawing).MapUtil.NewODFieldDefs
' Add Column Headings and Defaults
Set ODfdf = ODfdfs.Add("Entity", "Entity name", "", 0)
Set ODfdf = ODfdfs.Add("Color", "Object color", acRed, 1)
Set ODfdf = ODfdfs.Add("Layer", "Object layer", "0", 2)
'Ensure Table Does Not Exist
If amap.Projects(ThisDrawing) _
.ODTables.Item("SampleOD") Is Nothing Then
'Register OD Table in the drawing
Set ODtb = amap.Projects(ThisDrawing) _
.ODTables.Add("SampleOD", "Sample Xdata", ODfdfs, True)
'Create OD Record with Defaults
Set ODrc = ODtb.CreateRecord
'Loop Through Entities in Model Space
For Each acadObj In ThisDrawing.ModelSpace
'Fill Records with Entity Data
ODrc.Item(0).Value = acadObj.EntityName
ODrc.Item(1).Value = acadObj.Color
ODrc.Item(2).Value = acadObj.Layer
'Attach Record to Entity
ODrc.AttachTo(acadObj.ObjectID)
Next
Else
'Table Already Exists
MsgBox "Unable to create " & "SampleOD", ,"Object Data Table Error"
End If
End Sub