Follow

How can I attach multiple modules to one another in Voxler via automation?

This article contains a sample script for loading an existing VOXB file, gridding the data, adding an Isosurface, adding contours, adding a clip plane, and connecting multiple modules to it. It then changes some the properties of the clip plane.

To run this script:

  1. Copy the script below, or click here to download the BAS file: MultipleClipPlaneModule.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.
     

*********

'********************************************************************************************
' MultipleClipPlaneModule.bas
' This script loads an existing VOXB file, grids the data, adds an Isosurface,
' adds contours, adds a clip plane, and connects multiple modules to it.
' It then changes some the properties of the clip plane.
'********************************************************************************************

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

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

'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 Number of Contour Levels
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module", "Contours")
  CommandApi.Option("ContourNumLevels", "20")
  CommandApi.Do()

'Add a Isosurface module
  CommandApi.Construct("CreateModule")
  CommandApi.Option ("AutoConnect", "True")
  CommandApi.Option ("SourceModule", "Gridder")
  CommandApi.Option ("Type", "Isosurface")
  CommandApi.Do()

'Add aClipPlane
  CommandApi.Construct ("CreateModule")
  CommandApi.Option ("Type", "ClipPlane")
  CommandApi.Option ("AutoConnect", "True")
  CommandApi.Option ("SourceModule", "ScatterPlot")
  CommandApi.Do()

'Connect multiple modules to ClipPlane
  CommandApi.Construct("ConnectModules")
  CommandApi.Option("SourceModule", "Contours")
  CommandApi.Option("TargetModule", "ClipPlane")
  CommandApi.Option("TargetPort", "1")
  CommandApi.Do()

  CommandApi.Option("SourceModule", "Isosurface")
  CommandApi.Option("TargetPort", "2")
  CommandApi.Do()

 'Alter the axis that the clip plane is showing - clip along X
  CommandApi.Construct ("ModifyModule")
  CommandApi.Option ("Module", "ClipPlane")
  CommandApi.Option ("ClipPlaneOrientation", "0")
  CommandApi.Do()

  Wait (2)

 'Alter the axis that the clip plane is showing - clip along Y
  CommandApi.Option ("ClipPlaneOrientation", "1")
  CommandApi.Do()

  Wait (2)

 'Alter the axis that the clip plane is showing - clip along Z
  CommandApi.Option ("ClipPlaneOrientation", "2")
  CommandApi.Do()

  Wait (2)

 'Alter the axis that the clip plane is showing - clip Custom angle
  CommandApi.Option ("ClipPlaneOrientation", "3")
  CommandApi.Do()
  
 'Set the custom clip orientation
  CommandApi.Option ("ClipPlaneXDir", "1")
  CommandApi.Do()
  CommandApi.Option ("ClipPlaneYDir", "1")
  CommandApi.Do()
  CommandApi.Option ("ClipPlaneZDir", "2")
  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.