This is an example for Contour.
'********************************************************************************************
' ContoursModule.bas
' This script loads a data file and adds a gridder module to it.
' It adds a contour to the gridder module.
' It then changes all the properties of the contours module.
'
' -by SKP 4/2010
'
'********************************************************************************************
Sub Main
'Declares VoxlerApp as an object
Dim VoxlerApp As Object
'Creates an instance of the Voxler application object
'and assigns it to the variable named "VoxlerApp"
Set VoxlerApp = CreateObject("Voxler.Application")
'Make Voxler visible
VoxlerApp.Visible = True
'Access CommandApi
Set CommandApi = VoxlerApp.CommandApi
'Create a new Voxler document
CommandApi.Construct ("New")
CommandApi.DoOnce()
'Load the data file
CommandApi.Construct("Import")
CommandApi.Option("AutoConnect", "False")
CommandApi.Option ("DefaultPosition", "True")
CommandApi.Option ("Path", VoxlerApp.Path+"\Samples\GoldConcentration.dat")
CommandApi.Option ("Filter", "dat")
CommandApi.Option ("Options", "Defaults=1;EatWhitespace=1;Delimiter=Space,tab,comma,semicolon;TextQualifier=doublequote,quote")
CommandApi.Option ("GuiEnabled", "False")
CommandApi.Do()
'Add a gridder module
CommandApi.Construct("CreateModule")
CommandApi.Option ("AutoConnect", "True")
CommandApi.Option ("SourceModule", "GoldConcentration.dat ")
CommandApi.Option ("Type", "Gridder")
CommandApi.Do()
'Grid the data
CommandApi.Construct("ModifyModule")
CommandApi.Option("Module","Gridder")
CommandApi.Option("Gridder3DoIt", "true")
CommandApi.Do()
'Add a contours module
CommandApi.Construct("CreateModule")
CommandApi.Option ("AutoConnect", "True")
CommandApi.Option ("SourceModule", "Gridder")
CommandApi.Option ("Type", "Contours")
CommandApi.Do()
'Change the contour component
CommandApi.Construct ("ModifyModule")
CommandApi.Option ("Module", "Contours")
CommandApi.Option ("ContourComponent", "1")
CommandApi.Do()
'Change the contour line width
'This is a number between 0 and 4
CommandApi.Option ("ContourLineWidth", "1")
CommandApi.Do()
'Change the contour Level Method
'This is 0, 1, 2, or 3
'0 sets it to Automatic, 1 sets it to Min, Max, Count,
'2 sets it to Min, Max, Interval, 3 sets it to Explicit
CommandApi.Option ("ContourSpacing", "1")
CommandApi.Do()
'Change the contour minimum level
'This is only available if ContourSpacing = 1 or 2
CommandApi.Option ("ContourMinLevel", "0")
CommandApi.Do()
'Change the contour maximum level
'This is only available if ContourSpacing = 1 or 2
CommandApi.Option ("ContourMaxLevel", "5")
CommandApi.Do()
'Change the contour level number of levels
'This is only available if ContourSpacing = 0 or 1
'This is a number between 0 and 100
CommandApi.Option ("ContourNumLevels", "10")
CommandApi.Do()
Wait (2)
'Change the contour Level Method
'This is 0, 1, 2, or 3
'0 sets it to Automatic, 1 sets it to Min, Max, Count,
'2 sets it to Min, Max, Interval, 3 sets it to Explicit
CommandApi.Option ("ContourSpacing", "2")
CommandApi.Do()
'Change the contour level interval to 1
'This is only available if ContourSpacing = 2
CommandApi.Option ("ContourLevelInterval", "1")
CommandApi.Do()
Wait (2)
'Change the contour Level Method
'This is 0, 1, 2, or 3
'0 sets it to Automatic, 1 sets it to Min, Max, Count,
'2 sets it to Min, Max, Interval, 3 sets it to Explicit
CommandApi.Option ("ContourSpacing", "3")
CommandApi.Do()
'Change the explicit contour levels shown
'This is only available if ContourSpacing = 3
CommandApi.Option ("ContourExplicit", "1.2, 1.7, 2.1, 2.7, 3.4, 3.9, 4.2")
CommandApi.Do()
'Change the color map for the contours
CommandApi.Option ("ContourColormap", "Rainbow")
CommandApi.Do()
'Show or hide the border around the edge of the contour map
CommandApi.Option ("ContourBorderShow", "True")
CommandApi.Do()
'Change the border thickness around the edge of the contour map
CommandApi.Option ("ContourBorderWidth", "2.3")
CommandApi.Do()
'Change the border color around the edge of the contour map
CommandApi.Option ("ContourBorderColor", "Ruby Red")
CommandApi.Do()
'Display the contour legend
CommandApi.Option ("ContourLegendEnable", "True")
CommandApi.Do()
'Change the legend orientation
'0 is for horizontal, 1 is for vertical
CommandApi.Option ("ContourLegendOrientation", "0")
CommandApi.Do()
'Change the legend X position
'Ranges from 0-1
CommandApi.Option ("ContourLegendXPos", "0.3")
CommandApi.Do()
'Change the legend Y position
'Ranges from 0-1
CommandApi.Option ("ContourLegendYPos", "0.9")
CommandApi.Do()
'Change the legend width
'Ranges from 0-200
CommandApi.Option ("ContourLegendWidth", "20")
CommandApi.Do()
'Change the legend length
'Ranges from 0-1024
CommandApi.Option ("ContourLegendLength", "400")
CommandApi.Do()
'Change the legend title
CommandApi.Option ("ContourLegendTitle", "Legend Title")
CommandApi.Do()
'Change the legend title font size
'Ranges from 4-72
CommandApi.Option ("ContourLegendTitleHeight", "20")
CommandApi.Do()
'Change the number of labels displayed in a legend
CommandApi.Option ("ContourLegendNumLabels", "3")
CommandApi.Do()
'Change the legend to use custom labels
CommandApi.Option ("ContourLegendUseCustomLabels", "True")
CommandApi.Do()
'Set the custom labels for the legend
CommandApi.Option ("ContourLegendCustomLabels", "1.7:low, 2.1:medium, 2.9:intermediate, 3.2:elevated, 3.7:high")
CommandApi.Do()
'Set the height for the legend labels
CommandApi.Option ("ContourLegendLabelHeight", "8")
CommandApi.Do()
'Set the label format type for the legend
CommandApi.Option ("ContourLabelFormatType", "0")
CommandApi.Do()
'Set the number of digits to display on the labels
CommandApi.Option ("ContourLabelFormatNumDigits", "2")
CommandApi.Do()
'Set the legend label prefix
CommandApi.Option ("ContourLabelFormatPrefix", "pre-")
CommandApi.Do()
'Set the legend label postfix
CommandApi.Option ("ContourLabelFormatPostfix", "-post")
CommandApi.Do()
'Set the legend font
CommandApi.Option ("ContourLegendFont", "Arial")
CommandApi.Do()
'Turn on or off antialiasing for the legend
CommandApi.Option ("ContourLegendAntialias", "True")
CommandApi.Do()
'Set the line and text color for the legend
CommandApi.Option ("ContourLegendFGColor", "Blue")
CommandApi.Do()
'Set the background color for the legend
CommandApi.Option ("ContourLegendBGColor", "10% Gray")
CommandApi.Do()
'Turn on or off the display of the legend background
CommandApi.Option ("ContourLegendShowBackground", "True")
CommandApi.Do()
'Change the cutting plane orientation
'Value is 0, 1, 2, or 3 for XY Plane (Axial), XZ Plane (Coronal), YZ Plane (Sagittal), or Custom
CommandApi.Option ("ContourPlaneOrientation", "2")
CommandApi.Do()
'Change the X Normal Direction For the cutting plane
'Only available if ContoursPlaneOrientation is set to 3
CommandApi.Option ("ContourPlaneXNormal", "30")
CommandApi.Do()
'Change the Y Normal Direction For the cutting plane
'Only available if ContoursPlaneOrientation is set to 3
CommandApi.Option ("ContourPlaneYNormal", "30")
CommandApi.Do()
'Change the Z Normal Direction For the cutting plane
'Only available if ContoursPlaneOrientation is set to 3
CommandApi.Option ("ContourPlaneZNormal", "60")
CommandApi.Do()
'Change the offset of the cutting plane from the center of the lattice
CommandApi.Option ("ContourPlaneOffset", "-7.5")
CommandApi.Do()
'Display the cutting plane dragger
CommandApi.Option ("ContourPlaneShowDragger", "True")
CommandApi.Do()
End Sub
See Also