My code in V5 as following, but I don’t know how to convert that to V6, because there is no CRhinoAnnotationText on V6.
In the CRhinoAnnotationText* text_object
I want to SetAnnotation, SetTextHeight, SetString, SetPlane, SetJustification and SetFontIndex.
//my code in v5
CRhinoAnnotationText* CCommandSample::AddAnnotationText(const ON_3dPoint& pt, const wchar_t* text, double height, const wchar_t* font, int style, double rotate, ON_Annotation2::eTextJustification Justification)
{
CRhinoAnnotationText* text_object = new CRhinoAnnotationText;
ON_wString wText(text);
if (wText.IsEmpty())
return text_object;
if (height <= 0)
height = 1.0;
ON_wString wFont(font);
if (wFont.IsEmpty())
wFont = L"Arial";
if (style < 0 || style > 3)
style = 0;
ON_Plane plane = ON_xy_plane;
plane.SetOrigin(pt);
plane.Rotate(rotate, ON_zaxis);
ON_TextEntity2* text_entity = new ON_TextEntity2;
text_object->SetAnnotation(*text_entity);
text_object->SetTextHeight(height);
text_object->SetString(wText);
text_object->SetPlane(plane);
text_object->SetJustification(Justification);
int idx = ::RhinoApp().ActiveDoc()->m_font_table.FindOrCreateFont(wFont, style & 1, style & 2);
text_object->SetFontIndex(idx);
return text_object;
}