AcDbField creation and evaluation



Can someone please explain/give example how can one create AcDbField as a part of a block attribute and evaluate it? I wrote a code that works in AutoCAD. For Bricscad, compilation goes well, everything as expected, but on execution the application doesn't behave the same as it does in AutoCAD.

Thank you.

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]

This discussion has been closed.