Follow

How can I automate using Voxler's DuplicateFilter module?

This article contains a sample script for loading a data file, adding a duplicate filter to it, changing the legend properties of the duplicate filter, and adding a scatter plot to view the results.

To run this script:

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

*********

'********************************************************************************************
' DuplicateFilterModule.bas
' This script loads a data file and adds a duplicate filter to it.
' It then changes the legend properties of the duplicate filter.
' It then adds a scatter plot to view the results.
'********************************************************************************************

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

 'Load the data file
  CommandApi.Construct("Import")
  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 Duplicate Filter module to remove points that are too close together
  CommandApi.Construct ("CreateModule")
  CommandApi.Option ("Type", "DuplicateFilter")
  CommandApi.Option ("AutoConnect", "True")
  CommandApi.Option ("SourceModule", "GoldConcentration.dat")
  CommandApi.Do()

 'Set the duplicate filter rules for which points to keep
 'Value is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
 'Values equate to All, Average, First, Last, Maximum, Maximum X, Maximum Y, Maximum Z,
 ' Median, Median X, Median Y, Median Z, Midrange, Minimum, Minimum X, Minimum Y, Minimum Z,
 ' None, Random, or Sum
  CommandApi.Construct ("ModifyModule")
  CommandApi.Option ("Module", "DuplicateFilter")
  CommandApi.Option ("DuplicateFilterRule", "8")
  CommandApi.Do()

 'Set the X Tolerance value for the duplicate filter
  CommandApi.Option ("DuplicateFilterXTolerance", "10")
  CommandApi.Do()

 'Set the Y Tolerance value for the duplicate filter
  CommandApi.Option ("DuplicateFilterYTolerance", "15")
  CommandApi.Do()

 'Set the Z Tolerance value for the duplicate filter
  CommandApi.Option ("DuplicateFilterZTolerance", "10")
  CommandApi.Do()

 'Attach a scatter plot to the Duplicate filter
  CommandApi.Construct ("CreateModule")
  CommandApi.Option ("Type", "ScatterPlot")
  CommandApi.Option ("AutoConnect", "True")
  CommandApi.Option ("SourceModule", "DuplicateFilter")
  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.