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 VolRender module to it, and changing all the properties of the VolRender module.
To run this script:
- Copy the script below, or click here to download the BAS file: VolRenderModule.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.
*********
'******************************************************************************************** ' VolRenderModule.bas ' This script loads a test lattice and adds a VolRender module to it. ' It then changes all the properties of the VolRender 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 VolRender module CommandApi.Construct("CreateModule") CommandApi.Option ("AutoConnect", "True") CommandApi.Option ("SourceModule", "TestLattice") CommandApi.Option ("Type", "VolRender") CommandApi.Do() 'Change the volrender component CommandApi.Construct("ModifyModule") CommandApi.Option ("Module", "VolRender") CommandApi.Option ("VolRenderComponent", "2") CommandApi.Do() 'Change the volrender drawing style 'Value is 0 or 1 for 2D Textures or 3D Textures CommandApi.Option ("VolRenderDrawStyle", "1") CommandApi.Do() 'Change the volrender color map CommandApi.Option ("VolRenderColormap", "Rainbow") CommandApi.Do() 'Change the number of slices 'Option only available if VolRenderDrawStyle is set to 1 CommandApi.Option ("VolRenderNumSlices","200") CommandApi.Do() 'Change the opacity of the volrender 'Varies between 0 and 1. 0 is fully transparent, 1 is fully opaque CommandApi.Option ("VolRenderOpacity", "0.7") CommandApi.Do() 'Change the method used to combine voxels along the viewing rays 'Value is 0, 1, or 2 for Maximum Intensity, Sum Intensity, or Alpha Blending CommandApi.Option ("VolRenderComposition","2") CommandApi.Do() 'Change the interpolation method 'Value is 0 or 1, for Nearest Neighbor or Trilinear CommandApi.Option ("VolRenderInterpolation", "1") CommandApi.Do() 'Turn off paletted textures for volrender CommandApi.Option ("VolRenderUsePalette", "False") CommandApi.Do() 'Display the VolRender legend CommandApi.Option ("VolRenderLegendEnable", "True") CommandApi.Do() 'Change the legend orientation '0 is for horizontal, 1 is for vertical CommandApi.Option ("VolRenderLegendOrientation", "0") CommandApi.Do() 'Change the legend X position 'Ranges from 0-1 CommandApi.Option ("VolRenderLegendXPos", "0.3") CommandApi.Do() 'Change the legend Y position 'Ranges from 0-1 CommandApi.Option ("VolRenderLegendYPos", "0.9") CommandApi.Do() 'Change the legend width 'Ranges from 0-200 CommandApi.Option ("VolRenderLegendWidth", "20") CommandApi.Do() 'Change the legend length 'Ranges from 0-1024 CommandApi.Option ("VolRenderLegendLength", "400") CommandApi.Do() 'Change the legend title CommandApi.Option ("VolRenderLegendTitle", "Legend Title") CommandApi.Do() 'Change the legend title font size 'Ranges from 4-72 CommandApi.Option ("VolRenderLegendTitleHeight", "20") CommandApi.Do() 'Change the number of labels displayed in a legend CommandApi.Option ("VolRenderLegendNumLabels", "3") CommandApi.Do() 'Change the legend to use custom labels CommandApi.Option ("VolRenderLegendUseCustomLabels", "True") CommandApi.Do() 'Set the custom labels for the legend CommandApi.Option ("VolRenderLegendCustomLabels", "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 ("VolRenderLegendLabelHeight", "8") CommandApi.Do() 'Set the label format type for the legend CommandApi.Option ("VolRenderLabelFormatType", "0") CommandApi.Do() 'Set the number of digits to display on the labels CommandApi.Option ("VolRenderLabelFormatNumDigits", "2") CommandApi.Do() 'Set the legend label prefix CommandApi.Option ("VolRenderLabelFormatPrefix", "pre-") CommandApi.Do() 'Set the legend label postfix CommandApi.Option ("VolRenderLabelFormatPostfix", "-post") CommandApi.Do() 'Set the legend font CommandApi.Option ("VolRenderLegendFont", "Arial") CommandApi.Do() 'Turn on or off antialiasing for the legend CommandApi.Option ("VolRenderLegendAntialias", "True") CommandApi.Do() 'Set the line and text color for the legend CommandApi.Option ("VolRenderLegendFGColor", "Blue") CommandApi.Do() 'Set the background color for the legend CommandApi.Option ("VolRenderLegendBGColor", "10% Black") CommandApi.Do() 'Turn on or off the display of the legend background CommandApi.Option ("VolRenderLegendShowBackground", "True") CommandApi.Do() End Sub
Updated July 9, 2018
Comments
0 comments
Please sign in to leave a comment.