TextEntity drawing issues

I’m having issues wrestling with drawing TextEntities in the Rhino viewport. Let me give you some background:

I’m making a sort of custom angular dimension class that is separate from Rhino dimensions because it has some features that are not possible in Rhino. This class contains a TextEntity that displays the dimension information.

The thing is, when I call draw on the TextEntity, it is not giving me the right height or text orientation in the viewport.

When I set up the TextEntity, I have tried different methods of instantiation. (1) One is to useTextEntity.Create, and pass it a DimensionStyle and the other parameters that it requires. (2) The other is to instantiate the empty TextEntity and then populate the relevant properties. I don’t have many properties that I want to control. It’s really just text height, plane, justification, and orientation relative to the camera. When I use Method (1), I instantiate the DimensionStyle and give it a text height, justification, and also set DrawForward to “true”. When I use Method (2), I set the TextEntity’s text height, justification and DrawForward. I’ve never gotten Method (2) to display properly in the viewport (text is not oriented properly relative to camera, and shows up at a default size regardless of the text height I dictate). Method (1) partially works…See my comments on draw methods below:

I’ve tried a couple different draw methods: (A) IGH_PreviewArgs.Display.DrawAnnotation and (B) IGH_PreviewArgs.Display.DrawText , in both cases passing the TextEntity with a color parameter. In (A), the text displays oriented properly to camera but at a default size regardless of the specified text height in the TextEntity (I’ve used the watch list in Visual Studio and the text height is indeed properly set). In (B), the text displays improperly oriented (backwards if viewed from behind), but it is at the correct size.

Any insight is appreciated!

Hopefully, this can help

@xavier.bury My question is about displaying of text in Rhino. That thread is about text to curves.

yeah, i dont script (i do for work, not for fun - GH is scripting fun for me), i thought this might point you in the right direction… Sorry if it didn’t…

1 Like