I am replacing a call to mdlText_create with a TextBlock. I am trying to set the location of the text with the SetUserOrigin method, but the text is not created at that location. Am I using the correct method or am I doing something else wrong? I am including the code I use to create a text element and a line element. The line is created in the correct location but the text is not.
Private void text_test() { Dpoint3d ptTemp; ptTemp.x = 13307591.40; ptTemp.y = 994947.00; ptTemp.z = 291.70; //create text element TextBlockPropertiesPtr tbProps = TextBlockProperties::Create(*DgnTextStyle::GetActive(), *ISessionMgr::GetActiveDgnModelP()); tbProps->SetIsViewIndependent(true); ParagraphPropertiesPtr paraProps = ParagraphProperties::Create(*DgnTextStyle::GetActive(), *ISessionMgr::GetActiveDgnModelP()); paraProps->SetJustification(Bentley::DgnPlatform::TextElementJustification::CenterBaseline); RunPropertiesPtr runProps = RunProperties::Create(*DgnTextStyle::GetActive(), *ISessionMgr::GetActiveDgnModelP()); TextBlockPtr textBlock = TextBlock::Create(*tbProps, *paraProps, *runProps, *ISessionMgr::GetActiveDgnModelP()); textBlock->GetRunPropertiesForAddR().SetFontSize(DPoint2d::From(10.0,10.0)); textBlock->SetUserOrigin(ptTemp); textBlock->AppendText(L"test"); EditElementHandle eeh; TextHandlerBase::CreateElement(eeh, NULL, *textBlock); MSElementP tmpElement; tmpElement = eeh.GetElementP(); mdlElement_display(tmpElement, DgnPlatform::DRAW_MODE_Normal); mdlElement_add(tmpElement); //create line element Dpoint3d testLine[2]; testLine[0].x = ptTemp.x; testLine[0].y = ptTemp.y; testLine[0].z = ptTemp.z; testLine[1].x = ptTemp.x + 1.0; testLine[1].y = ptTemp.y; testLine[1].z = ptTemp.z; mdlLine_create(&element, NULL, testLine); mdlElement_display(&element, DgnPlatform::DRAW_MODE_Normal); mdlElement_add(&element); }
Thanks for your help.
Warren