Customizing Structure Templates

    By default, MarvinSketch contains 12 template groups, as described in the Developer's Guide.

    The Generic and My Templates groups automatically appear on the Advanced Templates toolbar for easier access.

    In this example, the My Templates group contains one molecule: benzene.

    The goal of this example is to customize the template structures of MarvinSketch in the following way:

    • Generic and Rings template groups are set to visible on the toolbar

    • Two wedge bonds are defined in the Extra Templates group, which will also be visible on the toolbar

    • A new template group, Conformers is defined consisting of 6 structures

    The result of this customization can be seen on the picture below. The Conformers and My Templates template groups are not visible on the toolbar in this case.


    The code below is taken from, where the structure templates are customized using the setParams method of the MSketchPane class. Currently this is the only way of defining template groups.

    In the example, the characters *** and :** are used as delimiters.

     sketchPane. setParams ( UserSettings.TOOLBAR_TEMPLATES+ "0=*Generic*chemaxon/marvin/templates/generic.t \n " + UserSettings.TOOLBAR_TEMPLATES+ "1=*Rings*chemaxon/marvin/templates/rings.t \n " + UserSettings.EXTRA_TEMPLATES+ "=chemaxon/marvin/templates/wedgebonds.t \n " + UserSettings.TEMPLATES+ "11=:Conformers:chemaxon/marvin/templates/conformers.t \n " );

    Using the ttmpls parameter, Generic and Rings template groups will appear on the toolbar beside the structures defined by xtmpls.

    The new template group called Conformers is defined with the tmpls parameter, which makes it available in the Template Library.


    In this example we have used the wedgebonds.t. and conformers.t. compressed SDfiles. Note that currently template files can only be in SDfiles or compressed SDfiles formats with .t extension.