@aitorerana wrote:
Hi,
I’ve a problem with mi Rhino C++ plugin.
I want to set some attibutes to some objects. I found this code and aparently the first part works propertly (I think) but to ensure I want to catch that user string and print it. The ref and obj are from an array and it loops okey.const CRhinoObjRef& ref = gv.Object(i); const CRhinoObject* obj = ref.Object(); if (!obj) return failure; ON_wString key = L"test"; ON_wString text = L"sample text"; // Part 1 start CRhinoObjectAttributes attribs = obj->Attributes(); attribs.SetUserString(key, text); context.m_doc.ModifyObjectAttributes(ref, attribs); // Part 1 end // Parte 2 start ON_wString textStr; attribs.GetUserString(key, textStr); ON_wString userTextStr; userTextStr.Format(L"UserText: %s\n", textStr); RhinoApp().Print(userTextStr); // Parte 2 end
Thanks.
Posts: 3
Participants: 2