Follow

How can I use the ExtractPoints module in a Voxler script?

This article contains a sample script for creating an ExtractPoints module and modifying its properties. The ExtractPoints module will accept both lattices and well data as input, but only the lattice input is shown here. For well-based input, please refer to the How can I import well data into Voxler via automation? knowledge base article.

To run this script:

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

*********

'********************************************************************************************
' ExtractPointsModule.bas
'
' This script creates a ExtractPoints module and modifies its properties.  The
' ExtractPoints module will accept both lattices and well data as input, but only
' the lattice input is shown here.  For well-based input, please refer to the
' WellDataModule.bas script.
'********************************************************************************************

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

 'Create a function lattice the input data source
  CommandApi.Construct ("CreateModule")
  CommandApi.Option("Type", "FunctionLattice")
  CommandApi.Do()

 'Change output to two components
  CommandApi.Construct ("ModifyModule")
  CommandApi.Option ("Module", "FunctionLattice")
  CommandApi.Option ("FunctionLatticeOutComps", "2")
  CommandApi.Do()

 'Update the first component
  CommandApi.Option ("FunctionLatticeExprComp1", "sqrt( x*x + y*y + z*z )")
  CommandApi.Do()

 'Update the second component
  CommandApi.Option ("FunctionLatticeExprComp2", "sqrt( x*x + y*y) * z")
  CommandApi.Do()

 'Attach an ExtractPoints module
 CommandApi.Construct ("CreateModule")
 CommandApi.Option ("AutoConnect", "True")
 CommandApi.Option ("Type", "ExtractPoints")
 CommandApi.Option ("SourceModule", "FunctionLattice")
 CommandApi.Do()

 'Change the number of output components (up to a maximum of 20)
 CommandApi.Construct ("ModifyModule")
 CommandApi.Option ("Module", "ExtractPoints")
 CommandApi.Option ("ExtractPointsOutComps", "2")
 CommandApi.Do()

 'Set the two output components using component names
 CommandApi.Option ("ExtractPointsComp1", "Component 1")
 CommandApi.Do()
 CommandApi.Option ("ExtractPointsComp2", "Component 2")
 CommandApi.Do()

 'Attach a scatter plot to the ExtractPoints output
 CommandApi.Construct ("CreateModule")
 CommandApi.Option ("Type", "ScatterPlot")
 CommandApi.Option ("AutoConnect", "True")
 CommandApi.Option ("SourceModule", "ExtractPoints")
 CommandApi.Do()

 'Show information about the ExtractPoints output
 CommandApi.Option ("Type", "Info")
 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.