This is an example for VectorPlot.
'********************************************************************************************
' VectorPlotModule.bas
' This script loads a test lattice and adds a VectorPlot module to it.
' It then changes all the properties of the VectorPlot 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 test lattice
CommandApi.Construct("CreateModule")
CommandApi.Option("AutoConnect", "False")
CommandApi.Option ("DefaultPosition", "True")
CommandApi.Option ("Type", "TestLattice")
CommandApi.Do()
'Add a VectorPlot module
CommandApi.Construct("CreateModule")
CommandApi.Option ("AutoConnect", "True")
CommandApi.Option ("SourceModule", "TestLattice")
CommandApi.Option ("Type", "VectorPlot")
CommandApi.Do()
'Change the VectorPlot orientation
'Value is 0, 1, 2, or 3 for XY Plane, XZ Plane, YZ Plane or All
CommandApi.Construct("ModifyModule")
CommandApi.Option ("Module", "VectorPlot")
CommandApi.Option ("VectorPlotOrientation", "2")
CommandApi.Do()
'Change the number of nodes to skip between vectors
'This is an integer value between 1 and the number of nodes in the lattice in that direction
CommandApi.Option ("VectorPlotFrequency", "7")
CommandApi.Do()
'Change the Slice being shown
'This option is only available when VectorPlotOrientation is set to 0, 1, or 2
'Value is an integer number between 1 and the number of nodes in the lattice in that direction
CommandApi.Option ("VectorPlotSlice", "3")
CommandApi.Do()
'Change the vector plot style
'Value is 0, 1, 2, 3, 4, or 5 for Line, Arrow2, Arrow4, ArrowCross, ArrowSolid, or Fade
CommandApi.Option ("VectorPlotVectorStyle", "3")
CommandApi.Do()
'Change the Color Method to Fixed
'Value is 0, 1, or 2 for Fixed, Colormap, or Scalar
CommandApi.Option ("VectorPlotColorMethod","0")
CommandApi.Do()
'Change the Fixed color to Desert Blue
CommandApi.Option ("VectorPlotColor", "Desert Blue")
CommandApi.Do()
Wait (2)
'Change the Color Method to Colormap
CommandApi.Option ("VectorPlotColorMethod","1")
CommandApi.Do()
'Change the color map
CommandApi.Option ("VectorPlotColormap", "Rainbow")
CommandApi.Do()
Wait (2)
'Connect the VectorPlot and TestLattice as the scalar import
CommandApi.Construct("ConnectModules")
CommandApi.Option ("SourceModule", "TestLattice")
CommandApi.Option ("TargetModule","VectorPlot")
CommandApi.Option ("TargetPort", "1")
CommandApi.Do()
'Change the Color Method to Scalar
CommandApi.Construct("ModifyModule")
CommandApi.Option ("Module", "VectorPlot")
CommandApi.Option ("VectorPlotColorMethod","2")
CommandApi.Do()
'Change the color map
CommandApi.Option ("VectorPlotColormap", "Rainbow")
CommandApi.Do()
'Change the component being shown in the vector plot
'This option is only available when VectorPlotColorMethod is set to 2
'Value is the component number
CommandApi.Option ("VectorPlotColorComponent","1")
CommandApi.Do()
'Change the plot scale method
'Value is 0, 1, or 2 for Linear, Square Root, or Logarthmic
CommandApi.Option ("VectorPlotScaleMethod", "1")
CommandApi.Do()
'Change the minimum scale value
'Value is between 0 and 5
'is the length of the smallest vector symbols
CommandApi.Option ("VectorPlotMinScale", "0.7")
CommandApi.Do()
'Change the maximum scale value
'Value is between 0 and 5
'is the length of the largest vector symbols
CommandApi.Option ("VectorPlotMaxScale", "3.7")
CommandApi.Do()
'Change the arrow head scale size
'Value is between 0 and 5
CommandApi.Option ("VectorPlotHeadScale", "0.34")
CommandApi.Do()
'Change the base symbol size
'Value is between 0 and 48 (in points)
CommandApi.Option ("VectorPlotDotSize", "4")
CommandApi.Do()
'Reverse the orientation of the vector symbols
CommandApi.Option ("VectorPlotReverse", "True")
CommandApi.Do()
'Change the line width of the vectors
CommandApi.Option ("VectorPlotLineWidth", "0.6")
CommandApi.Do()
'Display the VectorPlot legend
CommandApi.Option ("VectorPlotLegendEnable", "True")
CommandApi.Do()
'Change the legend orientation
'0 is for horizontal, 1 is for vertical
CommandApi.Option ("VectorPlotLegendOrientation", "0")
CommandApi.Do()
'Change the legend X position
'Ranges from 0-1
CommandApi.Option ("VectorPlotLegendXPos", "0.3")
CommandApi.Do()
'Change the legend Y position
'Ranges from 0-1
CommandApi.Option ("VectorPlotLegendYPos", "0.9")
CommandApi.Do()
'Change the legend width
'Ranges from 0-200
CommandApi.Option ("VectorPlotLegendWidth", "20")
CommandApi.Do()
'Change the legend length
'Ranges from 0-1024
CommandApi.Option ("VectorPlotLegendLength", "400")
CommandApi.Do()
'Change the legend title
CommandApi.Option ("VectorPlotLegendTitle", "Legend Title")
CommandApi.Do()
'Change the legend title font size
'Ranges from 4-72
CommandApi.Option ("VectorPlotLegendTitleHeight", "20")
CommandApi.Do()
'Change the number of labels displayed in a legend
CommandApi.Option ("VectorPlotLegendNumLabels", "3")
CommandApi.Do()
'Change the legend to use custom labels
CommandApi.Option ("VectorPlotLegendUseCustomLabels", "True")
CommandApi.Do()
'Set the custom labels for the legend
CommandApi.Option ("VectorPlotLegendCustomLabels", "0.07:low, 0.21:medium, 0.45:intermediate, 0.72:elevated, 0.97:high")
CommandApi.Do()
'Set the height for the legend labels
CommandApi.Option ("VectorPlotLegendLabelHeight", "8")
CommandApi.Do()
'Set the label format type for the legend
CommandApi.Option ("VectorPlotLabelFormatType", "0")
CommandApi.Do()
'Set the number of digits to display on the labels
CommandApi.Option ("VectorPlotLabelFormatNumDigits", "2")
CommandApi.Do()
'Set the legend label prefix
CommandApi.Option ("VectorPlotLabelFormatPrefix", "pre-")
CommandApi.Do()
'Set the legend label postfix
CommandApi.Option ("VectorPlotLabelFormatPostfix", "-post")
CommandApi.Do()
'Set the legend font
CommandApi.Option ("VectorPlotLegendFont", "Arial")
CommandApi.Do()
'Turn on or off antialiasing for the legend
CommandApi.Option ("VectorPlotLegendAntialias", "True")
CommandApi.Do()
'Set the line and text color for the legend
CommandApi.Option ("VectorPlotLegendFGColor", "Blue")
CommandApi.Do()
'Set the background color for the legend
CommandApi.Option ("VectorPlotLegendBGColor", "10% Gray")
CommandApi.Do()
'Turn on or off the display of the legend background
CommandApi.Option ("VectorPlotLegendShowBackground", "True")
CommandApi.Do()
End Sub
See Also