Inkscape import/export plugins
This page describes how to edit th2-files with Inkscape.
File convertors from TH2 to SVG and vice versa act as Inkscape import/export plugins.
Warning: This overwrites the previously published th2_output plugin! Make sure not to have old copies of th2_output.py or th2_output.inx in a different extensions directory (system/user).
The latest developer versions are on Thomas's Github - check the link below.
Not every therion map element is supported for editing, but the plugins try to preserve these elements. Unsupported are in particular:
- Areas, there is no equivalent concept in Inkscape. Areas will not be visible on canvas but stored in XML-comments (use the XML editor to check if you are curious) and exported again as they are.
- Lines with line point options, orientation or l-size. These lines will be visible on canvas but are read-only (cannot be grabbed with the mouse).
The export plugin tries to translate as much information as possible into therion options. It maps font size to label scale, text left/right alignment to label align.
Download
- Inkscape (vector drawing application, at least version 0.47 is required)
- latest version (import/export/annotation plugins for th2 format)
- previous versions (import/export/annotation plugins for th2 format)
Installation
See README.txt
Basic Concepts
Scraps and Layers
When opening a th2 file with Inkscape, each scrap is put into a separate layer. The name of the layer is the therion scrap-id.
There are two special layers (hidden by default), one with annotated symbols for copy&paste and one with background images.
When saving as th2, there is an option to treat layers as scraps, otherwise everything is merged into one single scrap. The special layers (symbols, images) are not exported!
Lines and Points
The concept of a line is pretty much the same in Inkscape and Therion, except that Inkscape does not support line point options.
There is no point element in Inkscape, but points are imported as “clones” of predefined symols. For any line that is annotated as point (see below) the bounding-box center will be calculated and exported as point, this applies also to line-derived shapes like circles.
Label points are imported as on-canvas text, likewise are remark, station-name, dimensions, height, passage-height, altitude and date. The on-canvas text is written back to the corresponding -text or -value attribute on export.
Annotation of drawing elements
The therion line or point type and the therion options are stored with the inkscape:label attribute. This can be edited with the “Label” entry of the “Object Properties” dialog. The other items in this dialog (ID, Title, Description) have no effect on th2-export, in particular the ID is not the therion “-id” attribute!
Example of a line annotation:
line wall -subtype pebbles
Example of a point annotation:
point continuation -text "need 20m rope"
Changing the annotation in the Object Properties dialog will not update any visual style (like line types etc.), unless the file is saved and reloaded.
Annotation can also be performed with dialogs from the “Extenstions > Therion > Set …” menues, this affects elements that are selected on canvas. Most visual style associations will be updated as well from this dialogs.
Problematic Inkscape Operations
Some operations on paths drop the inkscape:label attribute. For example:
- Path > Simplify
- Path > Object to Path
- Path > Combine / Break Apart
So you have to restore the label manually after performing such operations.