This is an example for VolRender.
'********************************************************************************************
' 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.
'
' -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 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% Gray")
CommandApi.Do()
'Turn on or off the display of the legend background
CommandApi.Option ("VolRenderLegendShowBackground", "True")
CommandApi.Do()
End Sub
See Also