CAD add objects specified data

Users can use two kinds of mechanisms in your application to add objects specified data, these two mechanisms as follows:

Extension data (XDATA)

Extension record

Extended Data

Extended data buffer list is a result, applications can access this list. By data from 1000 to 1071 DXF group codes associated. This mechanism can save space, and such that is added to the object data becomes easy. However, the extended data size must be limited to 16K, and must be of datatype DXF group codes.

May be used McDbObject :: xData () function to get the list of extended data replication in a subject, the prototype of the function is as follows:

1

virtual resbuf* McDbObject::xData(const char* regappname = NULL) const;

May also be used McDbObject :: setXData () function to set the extension data object, the prototype of the function is as follows:

1

virtual Mcad::ErrorStatus McDbObject::setXData(const resbuf* xdata);

setXData function

接口:virtual Mcad::ErrorStatus setXData(const struct resbuf* xdata);

Parameters :

name Explanation
xdata

Extended data list pointer, call Mx when not in use :: mcutRelRb release list

Return value : If successful return Mcad :: eOk.

Reference routine :

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

void CTestCommands::TestDataWrite()

 {

   MrxDbgSelSet mSelset;

   mSelset.userSelect();

   McDbObjectIdArray vId;

   mSelset.asArray(vId);

   

   ID = vId[0];

   

   McDbObjectPointer<McDbText> spText(ID, McDb::kForWrite);

    

   

   CString sAppName = _T("TestExData");

   int iValue = 999;

   

   acdbRegApp(sAppName);

   struct resbuf* pExDataRb = acutBuildList(1001, sAppName, AcDb::kDxfXdInteger16, iValue, 0);

   spText->setXData(pExDataRb);

 }

xData function

接口:virtual struct resbuf*    xData   (LPCTSTR pszRegappName = NULL) const;

Parameters :

name Explanation
pszRegappName

Extended data application name, if extended to all returns empty data

Return value : Returns the extended data list, it does not need to call Mx :: mcutNewRb release of the list.

Reference routine :

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

void CTestCommands::TestDataRead()

 {

   McDbObjectPointer<McDbText> spText(ID, McDb::kForWrite);

   

   struct resbuf* pExDataRb = spText->xData(_T(""));

   

   if (pExDataRb == NULL)

   {

    acutPrintf(_T("\n 没有扩展数据"));

   }

   else

   {

    CTestCommands::printResbufChain(pExDataRb);

   }

 }

Extended Dictionary

Each object can have an extended dictionary that contains an arbitrary target sequence McDbObject.

Guess you like

Origin blog.csdn.net/u013725001/article/details/95317547