acdbBindXrefs in an external database
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to bind all the xref in a database that is created by my application. The following function runs without any error, but the xref are not binded.
I have checked the function in the working database, it works perfectly.
I have also tried calling the function after and before saving the new database with the same result.
What is wrong in this function ?
void BindAllXrefs(AcDbDatabase* pDatabase)
{
Acad::ErrorStatus es;
AcDbDatabase* pCurDb = acdbHostApplicationServices()->workingDatabase();
acdbHostApplicationServices()->setWorkingDatabase(pDatabase);
AcDbXrefGraph graphXref;
if ((es = acedGetCurDwgXrefGraph(graphXref)) == Acad::eOk)
{
AcDbObjectIdArray xrefBlkIds;
for (int idx=1; idx < graphXref.numNodes(); idx++)
{
AcDbXrefGraphNode *nodeXref = graphXref.xrefNode(idx);
if (nodeXref)
{
AcDbObjectId btrId = nodeXref->btrId();
xrefBlkIds.append(btrId);
}
}
es = acdbBindXrefs( pDatabase, xrefBlkIds, true, false, false);
}
acdbHostApplicationServices()->setWorkingDatabase(pCurDb);
}
Thanks,
Marc