2013 map get objectdata record and values from table by name or selection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I'm looking for help getting the objectdata record values from a selected table. I'm able to loop thru the list of tables and also select a table to be current, however I can't seem to get the records to displayed display, it tried ex: get records, but that didn't work, not sure why.
any ideas where I'm going work. I'm ultimate goal would be to select an Ent object in the dwg and connect to it's table to display the properties fields and values attached so I can edit them much list a properties dialog box, end the end I'd like to query the values in the table to display a layer and style.
any help, links or material I can read would be wonderful.
Thank you
John
ex: get records
odTable = acTableList.Item("obstacle")
Dim odrecords As ObjectData.Records = odTable.GetObjectTableRecords(Convert.ToUInt32(0), id, Constants.OpenMode.OpenForWrite, True)
Dim odRecord As ObjectData.Record = odrecords(0)
MsgBox(odRecord.Count())
MsgBox(odRecord.Item(0).StrValue)
<CommandMethod("readodatatables")> _
PublicSub readodatatables()
Dim ed AsEditor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor()
Dim db AsDatabase = HostApplicationServices.WorkingDatabase
Dim civilDoc AsCivilDocument = CivilApplication.ActiveDocument
Dim acaddoc AsDocument = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim mapApp AsMapApplication
mapApp = HostMapApplicationServices.Application
Dim activeProj As Project.ProjectModel
activeProj = mapApp.ActiveProject
Dim ODtablename AsString
Dim mytrans AsTransaction = db.TransactionManager.StartTransaction
Try
Dim acBlkTbl AsBlockTable
acBlkTbl = mytrans.GetObject(db.BlockTableId, OpenMode.ForRead)
Dim acBlkTblRec AsBlockTableRecord
acBlkTblRec = mytrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
Dim BTMSpace AsBlockTableRecord = acBlkTbl(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForWrite)
Dim acMapApp AsMapApplication = HostMapApplicationServices.Application
Dim acActiveProject As Project.ProjectModel = acMapApp.ActiveProject
Dim acTableList AsTables = acActiveProject.ODTables
Dim odTable As Autodesk.Gis.Map.ObjectData.Table
ForEach ODTables In acTableList.GetTableNames()
acTableList.GetTableNames.ToString()
ODtablename = ODTables
MsgBox("Table Name = " & ODtablename)
Next
MsgBox("number of tables in table list = " + acTableList.TablesCount.ToString)
odTable = acTableList.Item("obstacle")
MsgBox("Selected table =" + odTable.Name)
Catch exc As Autodesk.Gis.Map.MapException
EndTry
mytrans.Commit()
mytrans.Dispose()
EndSub