- UID
- 34979
- 积分
- 38
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-3-12
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
想用ARX程序创建引线标注, 觉得创建一个AcDbMText和一个AcDbLeader,但是如何把两者绑定和定位呢?哪位指点一下?
自己找到了答案,和大家共享
ads_point ads_ptBase, ads_ptRes;
AcGePoint3d ptLBegin, ptLEnd;
AcDbLeader* pLabel;
AcDbMText* pText;
AcDbBlockTable *pBlockTab;
AcDbBlockTableRecord *pBlockTabRec;
if(ads_getpoint(NULL, NULL, ads_ptBase) != RTNORM)
return;
ptLBegin[0] = ads_ptBase[0];
ptLBegin[1] = ads_ptBase[1];
if(ads_getpoint(ads_ptBase, NULL, ads_ptRes) != RTNORM)
return;
ptLEnd[0] = ads_ptRes[0];
ptLEnd[1] = ads_ptRes[1];
acdbCurDwg()->getBlockTable(pBlockTab, AcDb::kForWrite);
pBlockTab->getAt(ACDB_MODEL_SPACE, pBlockTabRec, AcDb::kForWrite);
pText = new AcDbMText;
pText->setTextHeight(1);
pText->setAttachment(AcDbMText::AttachmentPoint::kBottomLeft);
pText->setLocation(ptLEnd);
pText->setContents("Привет");
pBlockTabRec->appendAcDbEntity(idTmp, pText);
pText->close();
pLabel = new AcDbLeader;
pLabel->appendVertex(ptLBegin);
pLabel->appendVertex(ptLEnd);
pBlockTabRec->appendAcDbEntity(idRetVal, pLabel);
pLabel->close();
pBlockTab->close();
pBlockTabRec->close();
acdbOpenAcDbEntity(pEnt, idRetVal, AcDb::kForWrite);
AcDbLeader::cast(pEnt)->attachAnnotation(idTmp);
AcDbLeader::cast(pEnt)->evaluateLeader();
pEnt->close(); |
|