Create Entity Link to a Named Object Dictionary

Create Entity Link to a Named Object Dictionary

Anonymous
Not applicable
462 Views
0 Replies
Message 1 of 1

Create Entity Link to a Named Object Dictionary

Anonymous
Not applicable
Sorry for my bad English.

It is possible create a entity link to an Named Object Dictionary?
I try this:

{code}
public void CreateLink(Database db, int number, CAO.KeyValues keyValues)
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
DBDictionary dictNODKey;
try
{
dictNODKey = (DBDictionary)tr.GetObject(_linkNodObjectId, OpenMode.ForWrite);
}
catch
{
this.GetLinkNodObjectId(db);
dictNODKey = (DBDictionary)tr.GetObject(_linkNodObjectId, OpenMode.ForWrite);
}
DBDictionary dictNumber;
try
{
dictNumber = (DBDictionary)tr.GetObject(dictNODKey.GetAt(Convert.ToString(number)), OpenMode.ForWrite);
}
catch
{
dictNODKey.UpgradeOpen();
dictNumber = new DBDictionary();
dictNODKey.SetAt(Convert.ToString(number), dictNumber);
tr.AddNewlyCreatedDBObject(dictNumber, true);
try
{
ObjectId dictNumberId = dictNumber.ObjectId;
// the next line generate a error where dictNumberId is a ObjectId of an Named Object Dictionary
CAO.Link link = _linkTemplate.CreateLink(dictNumberId.OldId, keyValues);
ObjectId linkObjectId = new ObjectId(link.ObjectID);
_lom.Add(number, linkObjectId);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
tr.Commit();
}
}
{code}

and give the folowing error:
"System.Runtime.InteropServices.COMException (0xC022001F): Failed to create link at CAO.LinkTemplateClass.CreateLink(Int32 ObjectID, KeyValues pKeyValues)"

When I create a entity link attaching to an exist block in the drawing the above routine works fine!

Why is not possible attach an entity link to an Named Object Dictionary ( DBDictionary)?

Thanks in advance,

Hanauer
0 Likes
463 Views
0 Replies
Replies (0)