Rhino compute AddText / Text3d / workaround no active doc

I read that there exists no concept of active document when using rhino.compute (Accessing active Document - #2 by fraguada)

I want to generate some three dimensional text within a grasshopper definition, but all of the methods I tried failed so far:
python component calling ObjectTable.AddText Method (Text3d), c# equivalent also needs active doc
Wombat text outlines component
OpenNest Text component
These either don’t return values with compute or raise an error.

I would prefer using rhino / grasshopper for generating the 3d text/ curves - does anyone have an idea what else I could try?

Thanks

EDIT: sorry, I wasn’t aware of this thread with a similar topic: Text Outline C# Script for Grasshopper not working in Rhino Compute

Hi @martinborst1,

You might try using Curve.CreateTextOutlines.

– Dale

1 Like

Hello Dale, thanks for your answer.
Your approach is the only one that works with compute to my knowledge.
In the meantime I also tried the TextEntity class, which also doesn’t work with compute.

The disadvantage of using Curve.CreateTextOutlines is that it generates lowercase letters as smaller capital letters. It is okay for now, but not exactly what I was looking for.

2021-06-29 11_46_59-Window
2021-06-29 11_47_08-Window

This only happens if smallCapsScale is set to something other than 1.0.

– Dale

1 Like

Hello @martinborst1, have you see this sample: rhino-developer-samples/compute/js/SampleGHText at 7 · mcneel/rhino-developer-samples · GitHub

It uses TextEntity and a headless doc to set up a Dimension Style.

1 Like