明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1311|回复: 2

[求助]版主救命啊!为什么不能这样?

[复制链接]
发表于 2004-7-9 11:41:00 | 显示全部楼层 |阅读模式
我想把数据存到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);//(能这样吗?)
。。。。
。。。。
读出来是怎么样读的?我找了相关资料都没有,救救我啊,版主!!!!
dispbbs.asp?BoardID=14&ID=19010&replyID=10168&skin=1有个例子,但是它是对某一具体的对象进行操作的,而我们操作的是当前的图形。
发表于 2004-7-9 17:01:00 | 显示全部楼层
可以参考一下这个例子: 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[X] = sp.x;
lwrleft[Y] = sp.y;
lwrleft[Z] = 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[X], pTemp->resval.rpoint[Y]);
acutRelRb(prbX);
}
 楼主| 发表于 2004-7-20 08:14:00 | 显示全部楼层
非常感谢spaceh! prbX = pObj->xData(appname);能不能换成pRb = appTable->xData(appname);能这样吗?这样又怎么办呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 06:22 , Processed in 0.142074 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表