void Additional_Class::addXdata( AcDbObjectId entID, CString xdataStr, CString xdataNameStr ) { AcDbEntity * pEnt; struct resbuf * pRb; if(Acad::eOk != acdbOpenAcDbEntity(pEnt, entID, AcDb::kForWrite)) { pEnt->close(); return; } TCHAR * tempTchar = CString2TCHAR(xdataNameStr); //TCHAR strAppName[] = tempTchar; acdbRegApp(tempTchar); TCHAR * typeName = CString2TCHAR(xdataStr); struct resbuf * pTemp; pTemp = pEnt->xData(tempTchar); pRb = acutBuildList(AcDb::kDxfRegAppName, tempTchar, AcDb::kDxfXdAsciiString, typeName, RTNONE); pEnt->setXData(pRb); acutRelRb(pRb); pEnt->close(); return; }
static void shYDsysXDataDel() { ads_name ssName; if(RTNORM == acedSSGet(":S", NULL, NULL, NULL, ssName)) { AcDbObjectId tempObjId; ads_name ssTemp; long nLen=0; if(RTNORM != acedSSLength(ssName,&nLen)) return; for(int j=0; j<nLen; j++) { if(RTNORM == acedSSName(ssName,j,ssTemp)) continue; if(Acad::eOk != acdbGetObjectId(tempObjId, ssTemp)) continue; AcDbEntity* pEnt = NULL; if(Acad::eOk == acdbOpenObject(pEnt,tempObjId,AcDb::kForWrite)) { resbuf* pHead = pEnt->xData(NULL); if(pHead == NULL) { pEnt->close(); continue; } resbuf* pNext =pHead->rbnext; if(pNext == NULL) { acutRelRb(pHead); pEnt->close(); continue; } while(pNext != NULL) { acutRelRb(pHead); pHead = pNext; pNext = pNext->rbnext; } pEnt->setXData(NULL); pEnt->close(); } } acedSSFree(ssName); } }