Creating text-shaped curves from secondary thread


#1

Hi

I’m trying to create text-shaped curves. The only solutions I have found so far is to call the TextObject script from the code.

This is working fine, but the problem is when I try to execute the script from secondary thread. Because the script is drawing in the main document, this is not possible.

How can I achieve this from secondary thread? I just need to create the curves, not necessarily to draw them. Are there SDK functions for creating text-shaped curves?


(Giulio Piacentino) #2

Hi Mende,

may I ask which language you are asking about?
Also, may I ask if the secondary thread issue is absolutely paramount to your plug-in logic?

Thanks,

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#3

Hi Piac

I’m working in Rhino Plug-In written in C++. And yes, I have to use a second thread.

In the past days, I made some progress.

I have created object from the CRhineAnnotationText class, and using its Explode function I’m able to get the text-shaped curves for the text.
I have noticed that Explode function is working only if the object is added to the document.

CRhinoAnnotationText *objectText = new CRhinoAnnotationText(); objectText->SetTextHeight(30); objectText->SetString(textToShow); objectText->SetFontIndex(RhinoApp().ActiveDoc()->m_font_table.FindOrCreateFont(wFont, style & 1, style & 2)); ON_SimpleArray<ON_Curve*> textCurves; objectText->Explode(textCurves); //textCurves remains empty after this function execution.

For the function Explode to work, I have to add the object to the active doc (call the function RhinoApp().ActiveDoc()->AddObject(objectText) before Explode)

Is it safe to add objects to the document from other but the primary thread? If not how to make the function Explode to work without adding object to the document. Or can you recommend some other way to achieve this.