2. Decoration Objects

2.1. Introduction

When preparing figures for an article or for a presentation, it is often necessary to add text, arrows, etc. to the figure. This can be done with most image processing programs and also with common presentation programs, but often it is more convenient to have such functionality present in the post-processor itself. In view of this, two simple objects are available in baspl++, the Text and the Line object.

These objects are of 2-dimensional nature, as they work with Scene coordinates. Scene coordinates have values of (0, 0) in the lower left corner and values of (1, 1) in the upper right corner. Thus, the Text and the Line objects are independent of any Part orientation.

Both objects have comprehensive on-line documentation, type

>>> help(Text)
>>> help(Line)

Also, both objects have a graphical user interface by which all settings and parameters can be inspected and changed.

2.2. The Text Object

This object is capable of displaying text over multiple lines. The lines can be left-justified, centered (default), or right-justified. The whole text can be vertically aligned at top, at bottom, or centered. The font (both proportional and monospace fonts are supported) and the colour can be chosen as well.

The Text object is not a replacement for a word processor; it is rather meant as a simple means to annotate graphical data. It does not break the lines automatically (line breaks must be specified by the user), and it supports only one font and one colour for the whole text (of course, different Text objects can use different fonts and different colours).

The best way to use Text objects is to create and edit them with the GUI. When everything looks fine,

create_script()

will dump all Python commands necessary to reproduce the current display. For example (the text is displayed at the upper left corner):

t = Text('ABCDabcd 123', (0.00, 1.00), halign='left', valign='top')

The Text object's editor contains a large area where the text can be entered. When done, the "Update" button must be clicked.

2.3. The Line Object

With the Line object, straight lines and single- or double-ended arrows can be drawn. The start and end positions, the width, the colour, the arrow type, and the tip size of the arrows can be set. The Line object is created in the same way as shown for the Text object in the previous section. The most intuitive way is to adjust the line start and end position by means of the GUI, and then calling

create_script()

which will dump all Python commands necessary to reproduce the current display:

l = Line((0.60, 0.76), (0.60, 0.63), arrowtype='end')