Follow

How do I create a new VOXB file and add annotations using Python?

This article contains a Voxler sample script of a Python version of AnnotationModule.bas, which creates a new VOXB file and adds an annotation. It then changes all of the properties of the annotation.

 

To run this script, copy the script below, or click here to download the PY file: AnnotationModule.py.

 

*********

"""
Prerequisite Installs:
Voxler  
Python                      http://python.org
Pywin32                     http://sourceforge.net/projects/pywin32/

Optional:
Visual Studio Community     https://www.visualstudio.com/products/visual-studio-community-vs
"""

import voxler
import common


def run(vox, log):
    """This script creates a new VOXB file and adds an annotation.
    It then changes all the properties of the annotation."""

    vox.CreateModule(Type="Annotation")
  
    vox.command_sequence(
        "ModifyModule", 
        {"Module":"Annotation"}, {
        "AnnotationText":           "New Voxler Annotation Automation\nMultiple lines",
        "AnnotationOrigin":         "2",
        "AnnotationXPos":           "0.25",
        "AnnotationYPos":           "0.5",
        "AnnotationJustification":  "1",
        "AnnotationSize":           "20",
        "AnnotationColor":          "Plum",
        "AnnotationFont":           "Times New Roman",
        "AnnotationAntialias":  "False"
    })

# If this is run by itself, then call run().
if __name__ == '__main__':
    vx = None

    try:
        vx = voxler.Voxler()
        run(vx, common)

    finally:
        if vx is not None:
            vx.quit()

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.