AcDbField creation and evaluation
Comments
-
Here is a test I wrote a while back, maybe you can change out the mtext for an attribute.. hope it gives you some ideas : )
[code]
static void Brx_doit(void)
{
AcDbObjectId fieldId;
const TCHAR pRawCode[] = _T("%<<a href="file://\\AcVar">\\AcVar CDATE>% not a field %<<a href="file://\\AcVar">\\AcVar CTAB>%");
AcDbDatabase *pDatabase = acdbHostApplicationServices()->workingDatabase();
AcDbMText *pText = new AcDbMText();
pText->setDatabaseDefaults(pDatabase);
AcDbField *pField = new AcDbField(pRawCode,true);
pField->postInDatabase(pDatabase);
pText->setField(_T("TEXT"),pField,fieldId);
pField->evaluate(AcDbField::kPreview,pDatabase);
pField->close();
AcDbBlockTableRecordPointer pSpace(pDatabase->currentSpaceId(),AcDb::kForWrite);
pSpace->appendAcDbEntity(pText);
pText->close();
}[/code]
0