本文整理汇总了C++中AcDbDatabase::addAcDbObject方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbDatabase::addAcDbObject方法的具体用法?C++ AcDbDatabase::addAcDbObject怎么用?C++ AcDbDatabase::addAcDbObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbDatabase
的用法示例。
在下文中一共展示了AcDbDatabase::addAcDbObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acdbHostApplicationServices
void
createObjs()
{
AcDbObjectId objIdA, objIdB, objIdC;
AcDbDictionary *pNamedobj;
AcDbDictionary *pDict = NULL;
AcDbDatabase *pCurDwg = acdbHostApplicationServices()->workingDatabase();
// Create object C with a dummy integer data value of 3.
//
AsdkOwnerDemo *pObjC = new AsdkOwnerDemo(3);
// Append object C to database without setting an owner.
//
pCurDwg->addAcDbObject(objIdC, pObjC);
pObjC->close();
// Create object B with a dummy integer data value of 2.
//
AsdkOwnerDemo *pObjB = new AsdkOwnerDemo(2);
// Append object B to the database without setting an owner.
//
pCurDwg->addAcDbObject(objIdB, pObjB);
// Now set up ownership for object C. The
// AsdkOwnerDemo::setIdData() function takes the
// objectId parameter and copies it into the
// AcDbHardOwnershipId data member. This places the
// object ID in a position to be filed out/in via the
// dwgInFields/dwgOutFields/dxfInFields/dxfOutFields
// member functions. This constitutes primary
// "ownership." The AsdkOwnerDemo::setIdData() function
// also calls each owned object's setOwnerId() member
// function to set the backpointer and establish the
// full two-way ownership link.
//
pObjB->setIdData(objIdC);
pObjB->close();
// Create object A with a dummy integer data value of 1.
//
AsdkOwnerDemo *pObjA = new AsdkOwnerDemo(1);
// Next, add objA to a dictionary in the named object
// dictionary. This will establish ownership for objA,
// set the ownership backlink, and add it to the
// database.
//
pCurDwg->getNamedObjectsDictionary(pNamedobj,
AcDb::kForWrite);
// Get a pointer to the ASDK_DICT dictionary. If it
// doesn't exist, then create it and add it to the
// named object dictionary.
//
if (pNamedobj->getAt("ASDK_DICT", (AcDbObject*&) pDict,
AcDb::kForWrite) == Acad::eKeyNotFound)
{
pDict = new AcDbDictionary;
AcDbObjectId DictId;
pNamedobj->setAt("ASDK_DICT", pDict, DictId);
}
pNamedobj->close();
// add object A to the ASDK_DICT dictionary
//
pDict->setAt("OBJA", pObjA, objIdA);
pDict->close();
// Now set up ownership for object B.
//
pObjA->setIdData(objIdB);
pObjA->close();
}