Follow

How do I load an existing VOXB file and add axes in Voxler using Python?

This article contains Voxler sample script that is a Python version of AxesModule.bas, which loads an existing VOXB file and adds axes .It then changes all the properties of the axes.

 

To run this script, copy the script below, or click here to download the PY file: AxesModule.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 opens a sample document, creates an AxesModule, 
    the makes a bunch changes to the Axes properties."""

    vox.command("Open", {
        "Path":vox.path() +"\\Samples\\Gold (ScatterPlot).voxb"
    })

    vox.command("CreateModule", {
        "Type":"Axes",
        "AutoConnect":"True",
        "SourceModule":"ScatterPlot"
    })

    # Try this in BASIC, oh my!
    vox.command_sequence("ModifyModule", {"Module":"Axes"}, {
        "AxesXAxisShow":"True",
        "AxesXAxisColor":"light green",
        "AxesXAxisBeg":"20",
        "AxesXAxisEnd":"110",
        "AxesXAxisCross1":"0",
        "AxesXAxisCross2":"50",
        "AxesXAxisPlane":"45",
        "AxesXAxisTitle":"X Axis Title",
        "AxesXAxisShowLabels":"True",
        "AxesXAxisFlipLabelsX":"True",
        "AxesXAxisFlipLabelsY":"True",
        "AxesXAxisLabelBeg":"30",
        "AxesXAxisLabelEnd":"85",
        "AxesXAxisLabelInc":"5",
        "AxesXAxisLabelAngle":"75",
        "AxesXAxisTicksPerLabel":"2",
        "AxesXAxisLabelFormatType":"1",
        "AxesXAxisLabelFormatNumDigits":"3",
        "AxesXAxisLabelFormatPrefix":"X-",
        "AxesXAxisLabelFormatPostfix":" cm",
        "AxesYAxisShow":"True",
        "AxesYAxisColor":"light green",
        "AxesYAxisBeg":"20",
        "AxesYAxisEnd":"110",
        "AxesYAxisCross1":"50",
        "AxesYAxisCross2":"0",
        "AxesYAxisPlane":"45",
        "AxesYAxisTitle":"Y Axis Title",
        "AxesYAxisShowLabels":"True",
        "AxesYAxisFlipLabelsX":"True",
        "AxesYAxisFlipLabelsY":"True",
        "AxesYAxisLabelBeg":"30",
        "AxesYAxisLabelEnd":"85",
        "AxesYAxisLabelInc":"5",
        "AxesYAxisLabelAngle":"75",
        "AxesYAxisTicksPerLabel":"2",
        "AxesYAxisLabelFormatType":"1",
        "AxesYAxisLabelFormatNumDigits":"3",
        "AxesYAxisLabelFormatPrefix":"Y-",
        "AxesYAxisLabelFormatPostfix":" cm",
        "AxesZAxisShow":"True",
        "AxesZAxisColor":"light green",
        "AxesZAxisBeg":"50",
        "AxesZAxisEnd":"100",
        "AxesZAxisCross1":"0",
        "AxesZAxisCross2":"0",
        "AxesZAxisPlane":"45",
        "AxesZAxisTitle":"Z Axis Title",
        "AxesZAxisShowLabels":"True",
        "AxesZAxisFlipLabelsX":"True",
        "AxesZAxisFlipLabelsY":"True",
        "AxesZAxisLabelBeg":"30",
        "AxesZAxisLabelEnd":"85",
        "AxesZAxisLabelInc":"5",
        "AxesZAxisLabelAngle":"75",
        "AxesZAxisTicksPerLabel":"2",
        "AxesZAxisLabelFormatType":"1",
        "AxesZAxisLabelFormatNumDigits":"3",
        "AxesZAxisLabelFormatPrefix":"Z-",
        "AxesZAxisLabelFormatPostfix":" cm",
        "AxesAutoScale":"True",
        "AxesShowGrid":"True",
        "AxesGridColor":"Pale Yellow",
        "AxesGridLineWidth":"3.0",
        "AxesThickness":"2.3",
        "AxesShowArrows":"True",
        "AxesFont":"Times New Roman",
        "AxesLabelHeight":"0.7",
        "AxesTitleHeight":"0.7"
    })


# 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()

 

Updated October 18, 2016

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.