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 data file, adding a Gridder module to it, adding a Contour module to the Gridder module, and changing all the properties of the Contour module.
To run this script:
- Copy the script below, or click here to download the BAS file: ContoursModule.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.
*********
'******************************************************************************************** ' 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. '******************************************************************************************** ' 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 data file CommandApi.Construct("Import") 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
Updated September 6, 2018
Comments
0 comments
Please sign in to leave a comment.