Ninguém para me ajudar? nenhuma dica?
É possível criar um entity link com um named object dictionary?
Tentei a rotina abaixo:
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;
// a linha abaixo gera um erro, quando o parâmetro dictNumberId.OldId
// é o objecId de um 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();
}
}
Obtenho o seguinte erro:
"System.Runtime.InteropServices.COMException (0xC022001F): Failed to create link at CAO.LinkTemplateClass.CreateLink(Int32 ObjectID, KeyValues pKeyValues)".
Quando crio um link com uma entidade no desenho ( linha, círculo, bloco, etc.) a rotina acima funciona corretamente.
A função da biblioteca CAO libray CreateLink só funciona com entidades derivadas de entityLink?
Um Named Object Dictionary é derivado de DBOject?
É possível criar um link através de linkTemplate.CreateLink com uma entidade que é um Named Object Dictionary?
Grato,
Hanauer.
Edited by: hanauer on Apr 23, 2010 5:22 PM
Edited by: hanauer on Apr 23, 2010 5:27 PM