老师,这种引线标注,上下都有文字的接口有吗?
下面的代码演示了如何创建引线标注,像您截图中的引线标注,应该是通过标注样式来订制的,您可以试着设置成您dgn文件中的标注样式看一下效果:
double g_1mu = ISessionMgr::GetActiveDgnModelP()->GetModelInfoCP()->GetUorPerMeter(); DgnFilePtr pActiveDgnFile = ISessionMgr::GetActiveDgnFile(); DimensionStylePtr pDimStyle = DimensionStyle::GetByName(L"Notes",*pActiveDgnFile); DgnTextStylePtr textStyle = DgnTextStyle::GetSettings(*pActiveDgnFile); EditElementHandle noteElem, leaderElement; TextBlockPropertiesPtr txtBlockProp= TextBlockProperties::Create(*textStyle,*(ACTIVEMODEL->AsDgnModelP())); ParagraphPropertiesPtr paragraphProperties= ParagraphProperties::Create(*textStyle, *(ACTIVEMODEL->AsDgnModelP())); RunPropertiesPtr runProp= RunProperties::Create(*textStyle, *(ACTIVEMODEL->AsDgnModelP())); TextBlockPtr text= TextBlock::Create(*txtBlockProp,*paragraphProperties,*runProp, *(ACTIVEMODEL->AsDgnModelP())); text->AppendText(L"AAAA"); DPoint3d insertPt = { 0 }; NoteCellHeaderHandler::StdDPointVector noteLeaderPoints; noteLeaderPoints.push_back(insertPt); insertPt.x = 10000; noteLeaderPoints.push_back(insertPt); NoteCellHeaderHandler::CreateNote(noteElem, leaderElement, *text,*pDimStyle, true, *ACTIVEMODEL, noteLeaderPoints); IDimensionEdit* iDimEdit = dynamic_cast<IDimensionEdit*>(&leaderElement.GetHandler()); EditElementHandle lineEeh; DPoint3d ptArr[5] = { {0,2 * g_1mu,0},{10 * g_1mu,0,0},{15 * g_1mu,0,0} ,{20 * g_1mu,0,0} ,{25 * g_1mu,5 * g_1mu,0} }; LineStringHandler::CreateLineStringElement(lineEeh, NULL, ptArr, 5, true, *ACTIVEMODEL); lineEeh.AddToModel(); AssocPoint assocPt1; AssociativePoint::InitKeypoint(assocPt1, 1, 5, 0, 1); AssociativePoint::SetRoot(assocPt1, lineEeh.GetElementId(), 0); if (SUCCESS != iDimEdit->SetPoint(leaderElement, NULL, &assocPt1, 0)) { return; } iDimEdit->SetRotationMatrix(leaderElement, RotMatrix::FromIdentity()); NoteCellHeaderHandler::AddToModel(noteElem, leaderElement,*(ACTIVEMODEL->AsDgnModelP()));