Follow

How can I import well data into Voxler via automation?

This article contains a sample script for importing data into a WellData module and modifying its properties. The wells are loaded from three sheets from an Excel workbook to demonstrate how complex well data can be loaded from multiple sources and appended to an existing well node.

To run this script:

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

*********

'********************************************************************************************
' WellDataModule.bas
'
' This imports 3 seperate data tables and assigns the correct columns. It then
' connects a WellData module and a WellRender module.  The
' wells are loaded from three sheets from an Excel workbook to demonstrate
' how complex well data can be loaded from multiple sources and appended to
' an existing well node.
'********************************************************************************************

' 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 well data from three sheets.  The first sheet contains the collars, the
  'second sheet contains the trajectories, and the third sheet contains example data.

  'Import the Collars table and set the columns____________________________________________________________________________________________________

  'Import the Collars table
  CommandApi.Construct ("Import")
  CommandApi.Option ("Path", VoxlerApp.Path+"Samples\SampleWellData.xlsx")
  CommandApi.Option ("Options", "Defaults=1;Sheet=Collars")
  CommandApi.Option ("GuiEnabled", "False")
  CommandApi.Do()

  'Set OutputType for the Collars table to Wells (0 = Points, 1= Wells)
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Collars")
  CommandApi.Option ("GuiEnabled", "True")
  CommandApi.Option ("ProgressEnabled", "True")
  CommandApi.Option ("UndoRedoEnabled", "True")
  CommandApi.Option ("OutputType", "1")
  CommandApi.Do()

  'Set WellSheetType for the Collars table to Collars (0 = All, 1 = Collars, 2 = Dir Survey, 3 = From/To, 4 = Logs/Curves, 5 = XYZ path)
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Collars")
  CommandApi.Option ("WellSheetType", "1")
  CommandApi.Do()

  'Set Well ID (WellColID) For Collars table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Collars")
  CommandApi.Option ("WellColID", "1")
  CommandApi.Do()

  'Set Top X column (WellColTopX) For Collars table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Collars")
  CommandApi.Option ("WellColTopX", "1")
  CommandApi.Do()

  'Set Top Y column (WellColTopY) For Collars table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Collars")
  CommandApi.Option ("WellColTopY", "2")
  CommandApi.Do()

  'Set Top Z column (WellColTopZ) For Collars table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Collars")
  CommandApi.Option ("WellColTopZ", "3")
  CommandApi.Do()

  'Set Azimuth column (WellColAz) For Collars table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Collars")
  CommandApi.Option ("WellColAz", "4")
  CommandApi.Do()

  'Set Vertical Direction to Dip (WellColVertType) For Collars table (0 = Dip, 1 = Inclination)
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Collars")
  CommandApi.Option ("WellColVertType", "0")
  CommandApi.Do()

  'Set Dip column (WellColVertDip) For Collars table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Collars")
  CommandApi.Option ("WellColVertDip", "5")
  CommandApi.Do()

  'Set Azimuth column (WellColTotalDepth) For Collars table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Collars")
  CommandApi.Option ("WellColTotalDepth", "6")
  CommandApi.Do()

  'Import the Trajectories table and set the columns____________________________________________________________________________________________________

  'Import the Trajectories table
  CommandApi.Construct ("Import")
  CommandApi.Option ("Path", VoxlerApp.Path+"Samples\SampleWellData.xlsx")
  CommandApi.Option ("Options", "Defaults=1;Sheet=Trajectories")
  CommandApi.Option ("GuiEnabled", "False")
  CommandApi.Do()

  'Set OutputType for the Trajectories table to Wells (0 = Points, 1= Wells)
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Trajectories")
  CommandApi.Option ("GuiEnabled", "True")
  CommandApi.Option ("ProgressEnabled", "True")
  CommandApi.Option ("UndoRedoEnabled", "True")
  CommandApi.Option ("OutputType", "1")
  CommandApi.Do()

  'Set WellSheetType for the Trajectories table to Dir Survey (0 = All, 1 = Collars, 2 = Dir Survey, 3 = From/To, 4 = Logs/Curves, 5 = XYZ path)
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Trajectories")
  CommandApi.Option ("WellSheetType", "2")
  CommandApi.Do()

  'Set Well ID (WellColID) For Trajectories table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Trajectories")
  CommandApi.Option ("WellColID", "1")
  CommandApi.Do()

  'Set Azimuth column (WellColAz) For Trajectories table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Trajectories")
  CommandApi.Option ("WellColAz", "2")
  CommandApi.Do()

  'Set Vertical Direction to Inclination (WellColVertType) For Trajectories table (0 = Dip, 1 = Inclination)
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Trajectories")
  CommandApi.Option ("WellColVertType", "1")
  CommandApi.Do()

  'Set Dip column (WellColVertInc) For Trajectories table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Trajectories")
  CommandApi.Option ("WellColVertInc", "2")
  CommandApi.Do()

  'Set Measured Depth column (WellColVertDip) For Trajectories table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Trajectories")
  CommandApi.Option ("WellColMeasDepth", "1")
  CommandApi.Do()

  'Import the Samples table and set the columns____________________________________________________________________________________________________

  'Import the Samples table
  CommandApi.Construct ("Import")
  CommandApi.Option ("Path", VoxlerApp.Path+"Samples\SampleWellData.xlsx")
  CommandApi.Option ("Options", "Defaults=1;Sheet=Samples")
  CommandApi.Option ("GuiEnabled", "False")
  CommandApi.Do()

  'Set OutputType for the Samples table to Wells (0 = Points, 1= Wells)
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Samples")
  CommandApi.Option ("GuiEnabled", "True")
  CommandApi.Option ("ProgressEnabled", "True")
  CommandApi.Option ("UndoRedoEnabled", "True")
  CommandApi.Option ("OutputType", "1")
  CommandApi.Do()

  'Set WellSheetType for the Samples table to From/To Logs (0 = All, 1 = Collars, 2 = Dir Survey, 3 = From/To, 4 = Logs/Curves, 5 = XYZ path)
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Samples")
  CommandApi.Option ("WellSheetType", "3")
  CommandApi.Do()

  'Set From column (WellColFrom) For Samples table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Samples")
  CommandApi.Option ("WellColFrom", "1")
  CommandApi.Do()

  'Set To column (WellColTo) For Samples table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Samples")
  CommandApi.Option ("WellColTo", "2")
  CommandApi.Do()

  'Set number of logs (WellColLogCount) For Samples table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Samples")
  CommandApi.Option ("WellColLogCount", "2")
  CommandApi.Do()

  'Set the first log column (ColLog-1) For Samples table
  CommandApi.Construct("ModifyModule")
  CommandApi.Option("Module","SampleWellData.xlsx - Samples")
  CommandApi.Option ("ColLog-1", "2")
  CommandApi.Option ("ColLog-2", "4")
  CommandApi.Do()

  'Create WellData and WellRender modules and connect them to the data__________________________________________________________________________

  'Add a WellData module using the CreateModule Construct command
  CommandApi.Construct ("CreateModule")
  CommandApi.Option("AutoConnect","False")
  CommandApi.Option("DefaultPosition", "True")
  CommandApi.Option("SourceModule", "SampleWellData.xlsx - Collars")
  CommandApi.Option("Type","WellData")
  CommandApi.Do()

  'Connect the Weldata and data modules
  CommandApi.Construct ("ConnectModules")
  CommandApi.Option("SourceModule", "SampleWellData.xlsx - Collars")
  CommandApi.Option("TargetModule", "WellData")
  CommandApi.Do()

  CommandApi.Construct ("ConnectModules")
  CommandApi.Option("SourceModule", "SampleWellData.xlsx - Trajectories")
  CommandApi.Option("TargetModule", "WellData")
  CommandApi.Option("TargetPort", "2")
  CommandApi.Do()

  CommandApi.Construct ("ConnectModules")
  CommandApi.Option("SourceModule", "SampleWellData.xlsx - Samples")
  CommandApi.Option("TargetModule", "WellData")
  CommandApi.Option("TargetPort", "3")
  CommandApi.Do()

  'Add a WellRender module using the CreateModule Construct command
  CommandApi.Construct ("CreateModule")
  CommandApi.Option("AutoConnect","True")
  CommandApi.Option("DefaultPosition", "True")
  CommandApi.Option("SourceModule", "WellData")
  CommandApi.Option("Type","WellRender")
  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.