- UID
- 658062
- 积分
- 2147
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2008-10-22
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
这是一个用 Transient 绘制 graphics 例子
http://adndevblog.typepad.com/autocad/2012/04/using-transient-graphics.html
实际测试中发现 Dim 部分实体仅能显示 文字,标注线、箭头等无法显示,是不是这个类只能显示简单实体?Dim的源是匿名块,外加了一个反应器
测试环境 Windows 7 32bit + Autocad 2014
- AcArray<AcDbEntity *> _markers;
- AcArray<int> _viewportNumbers;
- static void ClearTransientGraphics()
- {
- AcGiTransientManager* pTransientManager = acgiGetTransientManager();
- UINT64 num = _markers.logicalLength();
- if (num > 0)
- {
- for (int i= 0;i<num;i++)
- {
- AcDbEntity *pEnt = _markers[i];
- pTransientManager->eraseTransient
- (
- pEnt,
- _viewportNumbers
- );
- delete pEnt;
- }
- _markers.removeAll();
- //_markers.erase(viewid);
- }
- static void asdkMyGroupMyCommand () {
- // Put your command code here
- AcDbDatabase *pDb=acdbHostApplicationServices()->workingDatabase();
- ClearTransientGraphics();
- ads_point sp,ep;
- if (acedGetPoint(NULL,_T("\nFirst Point:"),sp)!=RTNORM)
- {
- return;
- }
- if (acedGetPoint(sp,_T("\nSecond Point: "),ep)!=RTNORM)
- {
- return;
- }
- AcDbTransactionManager* pTM = pDb->transactionManager();
- AcTransaction *pTransaction = pTM->startTransaction();
- AcGiTransientManager* pTransientManager = acgiGetTransientManager();
- struct resbuf res;
- acedGetVar(L"CVPORT", &res);
- _viewportNumbers.append(res.resval.rint);
- AcGePoint3d gSp,gEp;
- gSp=asPnt3d(sp);
- gEp=asPnt3d(ep);
- ads_real angle=acutAngle(sp,ep);
- AcDbRotatedDimension *pDim=new AcDbRotatedDimension();
- //AcDbObjectPointer<AcDbRotatedDimension> pDim;
- //pDim.create();
- pDim->setXLine1Point(gSp);
- pDim->setXLine2Point(gEp);
- pDim->setRotation(angle);
- pDim->setDimLinePoint(gSp);
- pDim->setDimtxt(10.0);
- _markers.append(pDim);
- AcDbLine *pLine=new AcDbLine();
- pLine->setStartPoint(gSp);
- pLine->setEndPoint(gEp);
- pLine->setColorIndex(1);
- _markers.append(pLine);
- AcGiTransientManager *pGM= acgiGetTransientManager();
- pGM->addTransient(pDim, kAcGiMain,128,_viewportNumbers);
- pGM->addTransient(pLine, kAcGiMain,128,_viewportNumbers);
- pTM->endTransaction();
- }
- virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
- // TODO: Add your code here
- // You *must* call On_kUnloadAppMsg here
- AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;
- ClearTransientGraphics();
- // TODO: Unload dependencies here
- return (retCode) ;
- }
复制代码 附件为 Debug |
|