SOLVED: For anyone looking into this thread in the future, this has been solved in Rhino 6 with a C# script (courtesy of qythium). See posts from 24th of April which contain a working definition.
Note warnings from obsolete code are still present but do not prevent operation.
ORIGINAL POST
Hi all,
Wondering if anyone has come across a 3D text tag that can be produced, then manipulated inside grasshopper? I know Grasshopper has a built in 3D text tag, but it has no output for further manipulation.
With Rhino 5 I have been using the FabTools âText 3D Advancedâ along with his âText Contourâ component, which exports curves that represent your text.
@LyndonJ, same problem here, actually even worse, some of my text goes upside down when I explode the text inside rhino.
Our problem would be solved with a curve output, right?
@DavidRutten, what do I need to do not to have my numbers upside down? Command bar says Curves from text may orient differently than text in viewports because of Annotation style settings. There is an option inside Annotation style settings but for me, it doesnât do anything. On the screenshot you can see text on overhanging surfaces of a climbing wall. I want the text aligned the way I define inside Grasshopper.
Plus can we please get a curve output on the 3D Text Tag?
Yes, we can bake text and extrude it to solids. But isnât the whole point of Grasshopper that we can actually automate everything? That much for the person whoâs telling me I need to bake the text in order to select it, extrude in 20 different directions and subtract from another few solids to get my text engravedâŚ
I donât know yet what bugs got fixed in R6 but from nearly a week of experience with it (after four years with R5), Iâm seeing bugs and unpleasant surprises at every turn!!
I think this qualifies as a forward-compatibility bug in Rhino 6 - looking at the error messages in the FabTools 3D Text Advanced component, itâs trying to set the property Rhino.Geometry.TextEntity.AnnotativeScalingEnabled which does not exist in RH6.
At the least the property should still be there and raise a âX is obsoleteâ compiler warning, even if it does nothing?
Hereâs a simple C# script I wrote a while back that should work on all platforms - it returns the exploded text contours which you can manipulate like any regular curves:
martinsiegrist Thanks for your reply, did you want to upload your model and GH script and I will take a look? I have never had issues with upside down text before, and have used it extensively. Wouldnât solve the automation issue but qythiumâs post might sort us out!.
qythium Thank you for uploading the script I will have a go with that today and let you know how it goes.
Your script was exactly what I was looking for, thank you. I have not yet tried it on a large scale (The work I am doing involves several thousand characters, automated notes against a geotechnical model, a model of under-ground conditions from drilling etc).
I had a go with an arbitrary plane and few bits of text, and it functioned but I noted the justification was not working. It seems to suffer the same issues that the FabTools plugins suffered from. See below:
FabTools components actually appear to be password-protected clusters and donât need a gha plugin to be installed, Iâve included one in the file as well.
As noted by LindonJ above TextEntity.Justification is also broken - looks like itâs been replaced by the new properties TextHorizontalAlignment and TextVerticalAlignment but should really still function as a sort of obsoleted alias.
In general, I think that by now most of us who work with Grasshopper on a daily basis recognize certain pros and cons. Tools within plugins such as fabtools or elefront are often really close to existing, native Grasshopper tools. The goal should be to improve these lacking native tools. Thanks @DavidRutten
@martinsiegrist I agree, if we could get some of these functions as native components that would be the best - But in the mean time we will make do with what we can. I think qythiumâs script is almost there - I made some minor edits to output both text, and contours (which i will re-upload here if we get it working) - but havenât been able to correct the text justification as yet.
@ qythium Could you give me an example of how the TextHorizontalAlignment and TextVerticalAlignment can be used in your script? I tried replacing:
Error (CS1061): âRhino.Geometry.TextEntityâ does not contain a definition for âTextAlignâ and no extension method âTextAlignâ accepting a first argument of type âRhino.Geometry.TextEntityâ could be found (are you missing a using directive or an assembly reference?) (line 96)
Iâm new to C# (usually fall back on VBA⌠since i dont do alot of programming). If you could advise how to edit the â_text.Justificationâ line to function in Rhino 6 that would be most appreciated.
and the list is curiously incomplete - no MiddleOfBoundingBox, TopOfBottom, etc? I wouldnât be surprised if the enum->int mappings get shuffled around in a future update, best to go with
The code amendments corrected the justification. I had a go at adding a Rhino text-object output as well - as I prefer to bake text when working inside Rhino - and usually only bake the curves before I export to 3D PDF.
Edited code is copied below, see the line in bold - This doesnât seem to result in text that can be previewed on-screen (or baked).
Is there any way to make the text entity also visible in the Rhino viewport?
Component.Name = "Text Contours 3D";
Component.Params.First(p => p.Name == "J").Description = @"
0: Top Left
1: Top Center
2: Top Right
3: Middle Left
4: Middle Center
5: Middle Right
6: Bottom Left
7: Bottom Center
8: Bottom Right";
Component.Params.First(p => p.Name == "style").Description = @"
0: Regular
1: Bold
2: Italic
3: Bold Italic";
bool bold = style == 1 || style == 3;
bool italic = style == 2 || style == 3;
int tmb = 1 << (16 + 2 - J / 3);
int lcr = 1 << (J % 3);
TextEntity _text = new TextEntity();
_text.Plane = Pl;
_text.Text = (T == null) ? "" : T;
_text.TextHeight = (S <= 0) ? 1 : S;
_text.FontIndex = RhinoDoc.ActiveDoc.Fonts.FindOrCreate(font, bold, italic);
_text.TextHorizontalAlignment = (TextHorizontalAlignment) (J % 3);
switch (J / 3) {
case 0:
_text.TextVerticalAlignment = TextVerticalAlignment.Top;
break;
case 1:
_text.TextVerticalAlignment = TextVerticalAlignment.Middle;
break;
default:
_text.TextVerticalAlignment = TextVerticalAlignment.Bottom;
break;
}
martinsiegrist
In case you did not already solve your text baking upside down issue - I believe this is caused by the oriented plane you are feeding the text module.
Rhino 6 will automatically adjust text so its legible regardless of the angle from which you view. When baking as curves - it reverts to its âtrue formâ.
I have just been through this with my own project, and have solved it using a combination of dot product, cross product and angles between a master vector and each plane.
Feel free to upload your script if you would like me to take a look.
Rhino 6 will automatically adjust⌠that might be great for standard plans and such but what I wish is that this auto function can be deactivated. The deactivation currently does not work for me. Please @DavidRutten make it workâŚ
Actually this issue is also not about baking. Take a look at the 4° overhanging surface on the image in my post from 4 days ago. The text is grouped with the surface. I can rotate the whole group and once a text orientation goes beyond 12 o clock, the number flips. It remains legible. Since Iâm creating modeling sheets, I need a bunch of surfaces connected to each other and I simply donât want Rhino to decide any text orientation what so ever.
Of course the orientation issue is caused by the plane Iâm feeding. The orientations are correct in my 3D model and correct in my unrolled Grasshopper model.
Iâm aware of how a number should be legible on a plan but let me deactivate this. Thanks
Thank you for your plugin, it is really nice! I just came across one problem and I hope you know how to fit it: all the text I engrave is mirrored. If I make a plain with text for the top view, the text is readable in bottom viewâŚ
It sounds like a simpel plain problem but I just canât figure it outâŚ