//The first thing I do is create my new group
AcDbGroup *pGroup = new AcDbGroup;
AcDbObjectId groupObjectId;
AcDbDictionary *pGroupDict = NULL;
acdbCurDwg()->getGroupDictionary(pGroupDict, AcDb::kForWrite);
pGroupDict->setAt( "test", pGroup, groupObjectId );
pGroupDict->close() ;
pGroup->close() ;
/***********************************************************************/
Later on, I create a text entity and want to add it to my group:
AcDbBlockTable *pDbTable;
acdbCurDwg()->getBlockTable(pDbTable, AcDb::kForWrite);
AcDbBlockTableRecord *pDbRecord;
pDbTable->getAt(ACDB_MODEL_SPACE, pDbRecord, AcDb::kForWrite) ;
pDbTable->close()
// I want to get the group I created earlier
AcDbDictionary *pGroupDict = NULL;
AcDbObjectId groupId;
AcDbGroup *pGroup;
pDb->getGroupDictionary(pGroupDict, AcDb::kForWrite);
pGroupDict->getAt("Test", (AcDbObject*&)pGroup, AcDb::kForWrite);
pGroupDict->close();
//Creation of my text entity
AcDbText *logtxt = new AcDbText;
logtxt->setTextString("Test");
pDbRecord->appendAcDbEntity(logtxt);
//It works fine until I get to the append part- I get the message :
// INTERNAL ERROR: !dbgroupi.cpp@495 : eWasOpenForWrite
pGroup->append(logtxt->objectId());
logtxt->close();
pDbRecord->close();
pGroup->close();
/*********************************************************************/
I don't understand why I get this message (eWasOpenForWrite) because I
carrefully close every object. Have any ideas?
Manon Perreault
Manon
Perreault
Art Cooney wrote:
> You need to close the text entity before you add it to the group.
>
> Whenever you call a method that takes an objectId "A", it's a pretty
> safe bet that that method expects the object with objectId "A" to be
> closed. If the method did not expect the object to be closed, then it
> would have an object pointer argument instead of an objectId argument.