Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Adding entities to groups

0 views
Skip to first unread message

Manon Perreault

unread,
Nov 8, 1999, 3:00:00 AM11/8/99
to
Hi!
I'm new in writing ARX programs and I need information on how to
add entities to groups. Here's a simplified sample of what my code looks
like:

//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

unread,
Nov 9, 1999, 3:00:00 AM11/9/99
to
Thank you it was indeed the problem. I've should have asked sooner!!!

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.


0 new messages