Follow

What properties can I change for Voxler's CommandAPI automation object?

This article contains a sample script for changing all the various properties of the commandapi object.


To run this script:

  1. Copy the script below, or click here to download the BAS file: CommandAPI.bas.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Voxler 4\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. 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.
  6. Click Script | Run to run the script.
     

*********

'********************************************************************************************
' CommandAPI.bas
' This script changes all the various properties of the commandapi object.
''********************************************************************************************

' 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()

 'Check for update
  CommandApi.Construct ("CheckForUpdate")
  CommandApi.Option("Silent","false")
  CommandApi.Do()

 'Open an existing file
  CommandApi.Construct ("Open")
  CommandApi.Option ("Path", VoxlerApp.Path+"\Samples\Gold (ScatterPlot).voxb")
  CommandApi.DoOnce()

 'Change color of scatter plot symbols
  CommandApi.Construct ("ModifyModule")
  CommandApi.Option ("Module", "ScatterPlot")
  CommandApi.Option ("ScatterPlotColorMap","Rainbow")
  CommandApi.Do()

 'Add a gridder module and automatically connect to the source
  CommandApi.Construct ("CreateModule")
  CommandApi.Option("AutoConnect","True")
  CommandApi.Option("DefaultPosition", "False")
  CommandApi.Option("SourceModule", "GoldConcentration.dat")
  CommandApi.Option("Type","Gridder")
  CommandApi.Option("XPosition",40)
  CommandApi.Option("YPosition",100)
  CommandApi.Do()

 'Grid the data
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","Gridder")
  CommandApi.Option("Gridder3Auto", "true")
  CommandApi.Option("Gridder3DoIt", "true")
  CommandApi.Do()

 'Add an isosurface
  CommandApi.Construct("CreateModule")
  CommandApi.Option("AutoConnect", "true")
  commandApi.Option("SourceModule","Gridder")
  CommandApi.Option("Type","Isosurface")
  CommandApi.Do()

 'Undoes the create isosurface module
  CommandApi.Undo()

 'Wait 4 seconds so you can see the result
  Wait(4)

 'Redo the create isosurface module command
  CommandApi.Redo()

 'Save
  CommandApi.Construct("Save")
  CommandApi.Option("Path","c:\temp\automation.voxb")
  CommandApi.Do()

End Sub

 

Updated November 3, 2016

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.