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