Text annotations on a 2D view

Hi team.

I currently have a 2D geometry view that shows different cross sectional diagrams that dynamically change from user input. Is there any possible way to show text/dimensions in this view as it would add a lot of value to what we are outputing.

Thanks

Hi, you could make use of Labels to annotate dimensions

@khameeteman thanks for the reply, label looks like exactly what I need.

It seems that Iā€™m using it incorrectly though - any idea what Iā€™m doing wrong here:

dimLabel = Label(Point(0,0,0), "My label", 3, Color(0,0,0))
return GeometryResult(output,[dimLabel])

Which gives this error:

TypeError: argument of type 'int' is not iterable

Thanks in advance :slight_smile:

The signature of the Label object expects a *text argument. The asterisk means that text can contsist of multiple inputs, in this case each input will be shown on a new line, for example:

Label(Point(0, 0, 0), "My label", "is", "awesome")

This means that in your case the ā€œ3ā€ is a wrong type, as Label expects it to be a string. Your IDE should also warn about this. Additional arguments should be passed as keywords, so in your case:

dimLabel = Label(Point(0,0,0), "My label", size_factor=3, color=Color(0,0,0))
1 Like