KB no longer maintained - Voxler is a retired product. Golden Software retired products are still supported, but no longer receive new features or updates. Many of Voxler's features are moving to Surfer . Please contact support@goldensoftware.com with any questions. |
This article contains a sample script for loading a test lattice, adding a VectorPlot module to it, and then changing all the properties of the VectorPlot module.
To run this script:
- Copy the script below, or click here to download the BAS file: VectorPlotModule.bas.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Voxler 4\Scripter.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
- Click Script | Run to run the script.
*********
'******************************************************************************************** ' 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. '******************************************************************************************** ' If Voxler is running, retrieve the current instance of Voxler. Otherwise, ' create a new instance of Voxler. Function VoxlerApplication() On Error Resume Next Set VoxlerApplication = GetObject(, "Voxler.Application") If Err.Number <> 0 Then Set VoxlerApplication = CreateObject("Voxler.Application") End If On Error GoTo 0 End Function Sub Main 'Retrieve running instance of Voxler or create a new instance of Voxler Dim VoxlerApp As Object Set VoxlerApp = VoxlerApplication() 'Make Voxler visible VoxlerApp.Visible = True 'Access CommandApi Set CommandApi = VoxlerApp.CommandApi 'Create a new Voxler document CommandApi.Construct ("New") CommandApi.DoOnce() 'Create a test lattice CommandApi.Construct("CreateModule") 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% Black") CommandApi.Do() 'Turn on or off the display of the legend background CommandApi.Option ("VectorPlotLegendShowBackground", "True") CommandApi.Do() End Sub
March 13, 2018
Comments
0 comments
Please sign in to leave a comment.