This is an example for WellData and WellRender.
'********************************************************************************************
' WellDataModule.bas
'
' This imports data into a WellData module and modifies 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.
'********************************************************************************************
' 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()
'Add a bounding box for reference
CommandApi.Construct ("CreateModule")
CommandApi.Option ("Type", "BoundingBox")
CommandApi.Option ("AutoConnect", "True")
CommandApi.Option ("SourceModule", "WellData")
CommandApi.Do()
'Display the data using a default WellRender node
CommandApi.Option ("Type", "WellRender")
CommandApi.Do()
CommandApi.Construct ("ModifyModule")
CommandApi.Option ("Module", "WellRender")
CommandApi.Option ("WellRenderShowLabels", "True")
CommandApi.Do()
'Label the wells by their name and modify some label properties
CommandApi.Construct ("ModifyModule")
CommandApi.Option ("Module", "WellRender")
CommandApi.Option ("WellRenderShowLabels", "True")
CommandApi.Do()
CommandApi.Option ("WellRenderXOffset", "20")
CommandApi.Do()
CommandApi.Option ("WellRenderYOffset", "30")
CommandApi.Do()
CommandApi.Option ("WellRenderShowLeaderLines", "True")
CommandApi.Do()
'Modify path properties
CommandApi.Option ("WellRenderPathColor", "Yellow")
CommandApi.Do()
CommandApi.Option ("WellRenderPathSize", "3")
CommandApi.Do()
Wait(5)
'Show interval data. Logs for interval color, interval size, path color, path size,
'etc., are retrieved by their name.
CommandApi.Option ("WellRenderIntDataLog", "MnO")
CommandApi.Do()
'Set the color method and log, use 0 for fixed color or 1 for color by log value
CommandApi.Option ("WellRenderIntDataColorMethod", "1")
CommandApi.Do()
CommandApi.Option ("WellRenderIntDataColorLog", "MnO")
CommandApi.Do()
'Change the color map
CommandApi.Option ("WellRenderIntDataColormap", "Rainbow")
CommandApi.Do()
'Set the size method and log, use 0 for fixed size or 1 for size by log value
CommandApi.Option ("WellRenderIntDataSizeMethod", "1")
CommandApi.Do()
CommandApi.Option ("WellRenderIntDataSizeLog", "TiO2")
CommandApi.Do()
'Turn the interval display on
CommandApi.Option ("WellRenderShowIntData", "True")
CommandApi.Do()
Wait(5)
'Turn two wells off. Note the use of the optional parameter on CommandApi.Option
'to identify the well.
CommandApi.Option ("WellRenderShowWell", "False", "Well=MW-5")
CommandApi.Do()
CommandApi.Option ("WellRenderShowWell", "False", "Well=MW-2")
CommandApi.Do()
End Sub
See Also