Author Topic: Find Xrecord  (Read 1754 times)

0 Members and 1 Guest are viewing this topic.

cadpro

  • Guest
Find Xrecord
« on: October 27, 2011, 02:58:21 PM »
Hi,

I have a drawing that has many entities. Some of them contains xrecords. How do I find them? Please help.

Thanks

Jeff H

  • Needs a day job
  • Posts: 6151
Re: Find Xrecord
« Reply #1 on: October 28, 2011, 12:21:58 AM »
I guess just checking each entities ExtensionDictionary for the Xrecord

bargool

  • Guest
Re: Find Xrecord
« Reply #2 on: October 28, 2011, 03:32:13 AM »
Here I'm checking for Xrecords and writing their contents to List. AppRecordKey is string constant contains name of Xrecord that I need
Code: [Select]
List<string> groups = new List<string>();
Entity entity = transaction.GetObject(id, OpenMode.ForRead) as Entity;
if (entity != null)
{
if (entity.ExtensionDictionary != ObjectId.Null)
{
using (DBDictionary dict = transaction.GetObject(
entity.ExtensionDictionary, OpenMode.ForRead) as DBDictionary)
{
if (dict.Contains(AppRecordKey))
{
Xrecord xrecord = transaction.GetObject(dict.GetAt(AppRecordKey), OpenMode.ForRead) as Xrecord;
ResultBuffer buffer = xrecord.Data;
foreach (TypedValue recordValue in buffer)
{
groups.Add(recordValue.Value.ToString());
}
}
}
}
}

Jeff H

  • Needs a day job
  • Posts: 6151
Re: Find Xrecord
« Reply #3 on: October 28, 2011, 04:57:16 AM »
Depending on what he is doing you can also get and update with OverRules

bargool

  • Guest
Re: Find Xrecord
« Reply #4 on: October 28, 2011, 05:05:10 AM »
with OverRules
Wow! Thank you for new subject to understand and use!