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 streamlines module to it, and then changing all the properties of the streamlines module.
To run this script:
- Copy the script below, or download the attached BAS file: StreamlinesModule.bas.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Voxler 4\Scripter.
- Double click on Scripter.exe to launch Scripter.
- If you copied this script, press Ctrl+A to select all of the existing lines, then press Ctrl+V to paste the copied script over those existing lines. 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.
*********
'******************************************************************************************** ' StreamlinesModule.bas ' This script loads a test lattice and adds a streamlines module to it. ' It then changes all the properties of the streamlines 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() 'Load the test lattice CommandApi.Construct("CreateModule") CommandApi.Option ("Type", "TestLattice") CommandApi.Do() 'Add a streamlines module CommandApi.Construct("CreateModule") CommandApi.Option ("AutoConnect", "True") CommandApi.Option ("SourceModule", "TestLattice") CommandApi.Option ("Type", "StreamLines") CommandApi.Do() 'Change the StreamLinesStreamMethod '0, 1, or 2 for Points, Spheres, or Lines CommandApi.Construct("ModifyModule") CommandApi.Option ("Module", "StreamLines") CommandApi.Option ("StreamLinesStreamMethod", "0") CommandApi.Do() 'Turn on or off the AutoCalc Step Interval feature CommandApi.Option ("StreamLinesAutoStep", "True") CommandApi.Do() 'Change the Step Interval CommandApi.Option ("StreamLinesStepSize", "0.3") CommandApi.Do() 'Change the Number of Steps CommandApi.Option ("StreamLinesNumSteps", "50") CommandApi.Do() 'Change the Point Size 'This option is only available when StreamLinesStreamMethod is set to 0 'Varies between 0 and 48 CommandApi.Option ("StreamLinesPointSize", "2") CommandApi.Do() 'Change the Sphere Size 'This option is only available when StreamLinesStreamMethod is set to 1 'Varies from 0 to 1 CommandApi.Option ("StreamLinesSphereSize", "0.1") CommandApi.Do() 'Change the Sphere Quality 'This option is only available when StreamLineStreamMethod is set to 1 'Varies from 0 to 1, 1 is high quality CommandApi.Option ("StreamLinesSphereQuality", "0.8") CommandApi.Do() 'Change the line width 'This option is only available when StreamLineStreamMethod is set to 2 'Varies between 0 and 4 CommandApi.Option ("StreamLinesLineWidth", "2.1") CommandApi.Do() 'Change the direction streamlines are traced from the seed point 'Options are 0, 1, or 2 - Forward, Backward, or Both CommandApi.Option ("StreamLinesDirection", "1") CommandApi.Do() 'Change the Minimum velocity CommandApi.Option ("StreamLinesMinVelocity", "0.2") CommandApi.Do() 'Change the Color Method to Fixed CommandApi.Option ("StreamLinesColorMethod","0") CommandApi.Do() 'Change the Fixed color to Desert Blue CommandApi.Option ("StreamLinesColor", "Desert Blue") CommandApi.Do() Wait (2) 'Change the Color Method to Fixed CommandApi.Option ("StreamLinesColorMethod","1") CommandApi.Do() 'Change the color map CommandApi.Option ("StreamLinesColormap", "Rainbow") CommandApi.Do() 'Change the line seed method 'Value is 0, 1, 2, 3 for Line, Ring, Square, or Point Set 'If PointSet, must have another input containing the points CommandApi.Option ("StreamLinesSeedMethod","2") CommandApi.Do() 'Change the number of seeds CommandApi.Option ("StreamLinesNumSeeds", "54") CommandApi.Do() 'Change the X component of the normal CommandApi.Option ("StreamLinesXNormal", "30") CommandApi.Do() 'Change the Y component of the normal CommandApi.Option ("StreamLinesYNormal", "30") CommandApi.Do() 'Change the Z component of the normal CommandApi.Option ("StreamLinesZNormal", "45") CommandApi.Do() 'Change the X position of the seed point center CommandApi.Option ("StreamLinesXPos", "0.7") CommandApi.Do() 'Change the Y position of the seed point center CommandApi.Option ("StreamLinesYPos", "0.2") CommandApi.Do() 'Change the Z position of the seed point center CommandApi.Option ("StreamLinesZPos", "0.6") CommandApi.Do() 'Change the X Scale factor of the seed plane CommandApi.Option ("StreamLinesXScale", "7") CommandApi.Do() 'Change the Y Scale factor of the seed plane CommandApi.Option ("StreamLinesYScale", "2") CommandApi.Do() 'Show or hide the seed plane dragger CommandApi.Option ("StreamLinesShowDragger", "True") CommandApi.Do() Wait (2) 'Reset the seed plane to the default CommandApi.Option ("StreamLinesResetDragger", "True") CommandApi.Do() 'Display the StreamLines legend CommandApi.Option ("StreamLinesLegendEnable", "True") CommandApi.Do() 'Change the legend orientation '0 is for horizontal, 1 is for vertical CommandApi.Option ("StreamLinesLegendOrientation", "0") CommandApi.Do() 'Change the legend X position 'Ranges from 0-1 CommandApi.Option ("StreamLinesLegendXPos", "0.3") CommandApi.Do() 'Change the legend Y position 'Ranges from 0-1 CommandApi.Option ("StreamLinesLegendYPos", "0.9") CommandApi.Do() 'Change the legend width 'Ranges from 0-200 CommandApi.Option ("StreamLinesLegendWidth", "20") CommandApi.Do() 'Change the legend length 'Ranges from 0-1024 CommandApi.Option ("StreamLinesLegendLength", "400") CommandApi.Do() 'Change the legend title CommandApi.Option ("StreamLinesLegendTitle", "Legend Title") CommandApi.Do() 'Change the legend title font size 'Ranges from 4-72 CommandApi.Option ("StreamLinesLegendTitleHeight", "20") CommandApi.Do() 'Change the number of labels displayed in a legend CommandApi.Option ("StreamLinesLegendNumLabels", "3") CommandApi.Do() 'Change the legend to use custom labels CommandApi.Option ("StreamLinesLegendUseCustomLabels", "True") CommandApi.Do() 'Set the custom labels for the legend CommandApi.Option ("StreamLinesLegendCustomLabels", "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 ("StreamLinesLegendLabelHeight", "8") CommandApi.Do() 'Set the label format type for the legend CommandApi.Option ("StreamLinesLabelFormatType", "0") CommandApi.Do() 'Set the number of digits to display on the labels CommandApi.Option ("StreamLinesLabelFormatNumDigits", "2") CommandApi.Do() 'Set the legend label prefix CommandApi.Option ("StreamLinesLabelFormatPrefix", "pre-") CommandApi.Do() 'Set the legend label postfix CommandApi.Option ("StreamLinesLabelFormatPostfix", "-post") CommandApi.Do() 'Set the legend font CommandApi.Option ("StreamLinesLegendFont", "Arial") CommandApi.Do() 'Turn on or off antialiasing for the legend CommandApi.Option ("StreamLinesLegendAntialias", "True") CommandApi.Do() 'Set the line and text color for the legend CommandApi.Option ("StreamLinesLegendFGColor", "Blue") CommandApi.Do() 'Set the background color for the legend CommandApi.Option ("StreamLinesLegendBGColor", "10% Black") CommandApi.Do() 'Turn on or off the display of the legend background CommandApi.Option ("StreamLinesLegendShowBackground", "True") CommandApi.Do() End Sub
Updated February 9, 2018
Comments
0 comments
Please sign in to leave a comment.