大家好。我有一个问题.所以现在我正在创建带有注释(Mtext)的领导者。
源代码如下。我使用了“pLeader->attattachAnnotation(pMtext->objectID)”,但它不起作用。你能告诉我为什么吗?
关于命令的结果,我还附上了下面的图片。请看。
- void
- cmdKRLE()
- {
- ads_point pt0,pt1, pt2;
- TCHAR Content[100];
- pt0[0] = 0;
- pt0[1] = 0;
- pt0[2] = 0;
- acedInitGet(1, NULL);
- acedGetPoint(pt0, _T("\n Select the first point:"), pt1);
- acedInitGet(1, NULL);
- acedGetPoint(pt1, _T("\n Select the second point:"), pt2);
- acdbUcs2Wcs(pt1, pt1, false);
- acdbUcs2Wcs(pt2, pt2, false);
-
- AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();
- Acad::ErrorStatus es;
- AcDbBlockTableRecordPointer pBtr(pDb->currentSpaceId(), AcDb::kForWrite);
- if (pBtr.openStatus() != Acad::eOk) return;
- struct resbuf DimScale;
- acedGetVar(_T("DIMSCALE"), &DimScale);
- acedGetString(1, _T("\n Input content:"), Content);
- AcDbObjectPointer pMtext;
- pMtext.create();
- pMtext->setContents(Content);
- pMtext->setLayer(_T("TEXT"));
- pMtext->setTextHeight(DimScale.resval.rreal * 3.2);
- pMtext->setLocation(asPnt3d(pt2));
- if (pt2[0] >= pt1[0])
- {
- pMtext->setAttachment(AcDbMText::kBottomLeft);
- }
- else
- {
- pMtext->setAttachment(AcDbMText::kBottomRight);
- }
- es = pBtr->appendAcDbEntity(pMtext);
- if (es != Acad::eOk)
- {
- acutPrintf(_T("\n Can not add Mtext!"));
- return;
- }
- AcDbObjectPointer pLeader;
- pLeader.create();
- pLeader->appendVertex(asPnt3d(pt1));
- pLeader->appendVertex(asPnt3d(pt2));
- es = pBtr->appendAcDbEntity(pLeader);
- if (es != Acad::eOk)
- {
- acutPrintf(_T("\n Can not add Leader!"));
- return;
- }
- pLeader->setLayer(_T("SCALE"));
- pLeader->setDimscale(DimScale.resval.rreal);
- pLeader->attachAnnotation(pMtext->objectId());
- pLeader->evaluateLeader();
- }
os5x00phrr3.PNG
本帖以下内容被隐藏保护;需要你回复后,才能看到! 游客,如果您要查看本帖隐藏内容请 回复 |