To create a script, the script text is typed into the Scripter code window or an existing script is edited. When you want to create a new script, you will most likely start with an empty Scripter window and type the entire script. If you want to perform a routine task such as creating an isosurface module, you can probably open an existing script file and edit the file to meet your specific needs. Voxler comes with several sample scripts that you can modify as desired.
Consider a script that creates an isosurface module:
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 data file
CommandApi.Construct("Import")
CommandApi.Option("AutoConnect", "False")
CommandApi.Option ("DefaultPosition", "True")
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("Gridder3Auto", "true")
CommandApi.Option("Gridder3DoIt", "true")
CommandApi.Do()
'Add a isosurface module
CommandApi.Construct("CreateModule")
CommandApi.Option ("AutoConnect", "True")
CommandApi.Option ("SourceModule", "Gridder")
CommandApi.Option ("Type", "Isosurface")
CommandApi.Do()
End Sub
When you execute the script, Voxler is automatically started and a viewer window is displayed. The data is loaded and the map is created. When the script execution is complete, the Voxler window remains open.
See Also