ODTable from entity

ODTable from entity

Anonymous
Not applicable
547 Views
2 Replies
Message 1 of 3

ODTable from entity

Anonymous
Not applicable
Is there a way to determine the ODTable from an entity. Is there another
way other than looping through all the tables and records to get the table
name. In other words can I get an entity's record without hard coding the
table name as in the following example.

Function getObjectData(ent)
Dim amap As AcadMap
Dim ODrcs As ODRecords
Dim acadObj As AcadObject
Dim prj As Project
Dim rec As Object


Set amap = ThisDrawing.Application. _
GetInterfaceObject("AutoCADMap.Application")

Set prj = amap.Projects(ThisDrawing)
prj.ProjectOptions.DontAddObjectsToSaveSet = True

Set ODrcs = amap.Projects.Item(ThisDrawing). _
ODTables.Item(, "STREET_CL").GetODRecords

'get the attribute data for this entity
If ODrcs.Init(ent, True, False) = True And _
Not ODrcs.IsDone Then
Set rec = ODrcs.Record
Else
'If there is no attribute data for this entity then
'Turn it red and do the next one

obj.Color = acRed
obj.Update
End If
Set getObjectData = rec
End Function


Lou Ball
[email protected]
0 Likes
548 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
"Lou Ball" wrote in message
news:[email protected]...
> Is there a way to determine the ODTable from an entity. Is there another
> way other than looping through all the tables and records to get the table
> name. In other words can I get an entity's record without hard coding the
> table name as in the following example.
>

Hello Lou,

You can allocate an od record iterator for *all*
tables rather than a single table. This is
available from the ODTables.GetODRecords instead
of the individual ODTable.GetODRecords

The Map Automation API even has a small example
of its use.

Cheers-

rdh.
0 Likes
Message 3 of 3

Anonymous
Not applicable
Richard,

Thanks for your reply.
Actually I tried using the GetODRecords method but was getting a record for
the entity from the wrong table.
When I use GetODRecords am I not searching *all* records in *all* tables?
It seems that the entity itself has no method or property that refers to
object data. Is that true?

Lou

"Richard D. Howard [Autodesk GIS]" wrote in
message news:[email protected]...
>
> "Lou Ball" wrote in message
> news:[email protected]...
> > Is there a way to determine the ODTable from an entity. Is there
another
> > way other than looping through all the tables and records to get the
table
> > name. In other words can I get an entity's record without hard coding
the
> > table name as in the following example.
> >
>
> Hello Lou,
>
> You can allocate an od record iterator for *all*
> tables rather than a single table. This is
> available from the ODTables.GetODRecords instead
> of the individual ODTable.GetODRecords
>
> The Map Automation API even has a small example
> of its use.
>
> Cheers-
>
> rdh.
>
>
0 Likes