[求助]版主救命啊!为什么不能这样?
我想把数据存到Table里,不知这样为什么不行?struct resbuf *pRb, *pTemp;
AcDbSymbolTable * appTable;
char * appName="smartTest";
char * resString="abcdefgffff"; AcDbDatabase *pDb=acdbHostApplicationServices()->workingDatabase();
pDb->getRegAppTable(appTable,AcDb::kForWrite);
pRb = appTable->xData(appName);//(能这样吗?)
。。。。
。。。。
读出来是怎么样读的?我找了相关资料都没有,救救我啊,版主!!!!
这有个例子,但是它是对某一具体的对象进行操作的,而我们操作的是当前的图形。**** Hidden Message ***** 可以参考一下这个例子: void addXdata()
{
struct resbuf* prbX;
char appname[] = {"SPACEH"};
char windotype[] = {"Rect"};
ads_name ename;
AcDbObjectId entId;
AcDbObject* pObj;
AcGePoint2d sp(getWindowStartPoint());
ads_point lwrleft;
lwrleft = sp.x;
lwrleft = sp.y;
lwrleft = 0.0;
acdbRegApp("SPACEH");
prbX = acutBuildList(AcDb::kDxfRegAppName, appname,
AcDb::kDxfXdAsciiString, windotype,
AcDb::kDxfXdInteger32, getWindowRows(),
AcDb::kDxfXdInteger32, getWindowCols(),
AcDb::kDxfXdReal, getWindowLength(),
AcDb::kDxfXdReal, getWindowHeight(),
AcDb::kDxfXdWorldXCoord, lwrleft,
RTNONE);
// Get the last entity
acdbEntLast(ename);
// Get the entity object ID
acdbGetObjectId(entId, ename);
// Open the enity for a write operation
acdbOpenObject(pObj, entId, AcDb::kForWrite);
// Add the extended entity data to the entity
pObj->setXData(prbX);
pObj->close();
acutRelRb(prbX);
}
void printXdata()
{
struct resbuf* prbX;
struct resbuf* pTemp;
char appname[] = {"SPACEH"};
ads_name ename;
AcDbObjectId entId;
AcDbObject* pObj;
// Get the last entity
acdbEntLast(ename);
// Get the entity object ID
acdbGetObjectId(entId, ename);
// Open the enity for a write operation
acdbOpenObject(pObj, entId, AcDb::kForRead);
// Add the extended entity data to the entity
prbX = pObj->xData(appname);
pObj->close();
// Print out the extended entity data
// Here I know the order of the extended entity data
pTemp = prbX;
// Bypass the application name
pTemp = pTemp->rbnext;
acutPrintf("\nWindow Type = %s", pTemp->resval.rstring);
pTemp = pTemp->rbnext;
acutPrintf("\nRows = %d", pTemp->resval.rint);
pTemp = pTemp->rbnext;
acutPrintf("\nCols = %d", pTemp->resval.rint);
pTemp = pTemp->rbnext;
acutPrintf("\nLength = %.2lf", pTemp->resval.rreal);
pTemp = pTemp->rbnext;
acutPrintf("\nHeight = %.2lf", pTemp->resval.rreal);
pTemp = pTemp->rbnext;
acutPrintf("\nStart Point = (%.2lf, %.2lf)", pTemp->resval.rpoint, pTemp->resval.rpoint);
acutRelRb(prbX);
} 非常感谢spaceh!
prbX = pObj->xData(appname);能不能换成pRb = appTable->xData(appname);能这样吗?这样又怎么办呢?
页:
[1]