Automation Example - LatticeMerge

 

This is an example for LatticeMerge.

'********************************************************************************************

' MergeModule.bas

' This script creates two function lattices.

' It adds a merge module and changes the properties of the merge module.

'

'                                    -by SKP 4/2010

'

'********************************************************************************************

Sub Main

 

  'Declares VoxlerApp as an object

  Dim VoxlerApp As Object

 

 'Creates an instance of the Voxler application object

 'and assigns it to the variable named "VoxlerApp"

  Set VoxlerApp = CreateObject("Voxler.Application")

 

 '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

  CommandApi.Construct ("CreateModule")

  CommandApi.Option("Type", "FunctionLattice")

  CommandApi.Option ("AutoConnect", "False")

  CommandApi.Do()

 

 'Add a second function lattice

  CommandApi.Construct ("CreateModule")

  CommandApi.Option ("Type", "FunctionLattice")

  CommandApi.Option ("AutoConnect", "False")

  CommandApi.Do()

 

 'Set the function lattice 2 equation

  CommandApi.Construct ("ModifyModule")

  CommandApi.Option ("Module", "FunctionLattice2")

  CommandApi.Option ("FunctionLatticeExprComp1", "2*x+y+0.5*z")

  CommandApi.Do()

 

 'Add a merge module to the function lattice

  CommandApi.Construct ("CreateModule")

  CommandApi.Option ("Type", "Merge")

  CommandApi.Option ("AutoConnect", "True")

  CommandApi.Option ("SourceModule", "FunctionLattice")

  CommandApi.Do()

 

 'Connect the merge module to the second function lattice

  CommandApi.Construct ("ConnectModules")

  CommandApi.Option ("SourceModule", "FunctionLattice 2")

  CommandApi.Option ("TargetModule", "Merge")

  CommandApi.Option ("TargetPort", "1")

  CommandApi.Do()

 

 'Turn on/off the "Calculate from Inputs" option for the Merge module

  CommandApi.Construct ("ModifyModule")

  CommandApi.Option ("Module", "Merge")

  CommandApi.Option ("LatticeMergeAuto", "False")

  CommandApi.Do()

 

 'Set the X Axis minimum value for the Merge module

  CommandApi.Option ("LatticeMergeXMin", "0.2")

  CommandApi.Do()

 

 'Set the X Axis maximum value for the Merge module

  CommandApi.Option ("LatticeMergeXMax", "0.6")

  CommandApi.Do()

 

 'Set the Y Axis minimum value for the Merge module

  CommandApi.Option ("LatticeMergeYMin", "0.2")

  CommandApi.Do()

 

 'Set the Y Axis maximum value for the Merge module

  CommandApi.Option ("LatticeMergeYMax", "0.6")

  CommandApi.Do()

 

 'Set the Z Axis minimum value for the Merge module

  CommandApi.Option ("LatticeMergeZMin", "0.2")

  CommandApi.Do()

 

 'Set the Z Axis maximum value for the Merge module

  CommandApi.Option ("LatticeMergeZMax", "0.6")

  CommandApi.Do()

 

 'Set the number of nodes in the X direction for the Merge module

  CommandApi.Option ("LatticeMergeXNum", "30")

  CommandApi.Do()

 

 'Set the number of nodes in the Y direction for the Merge module

  CommandApi.Option ("LatticeMergeYNum", "30")

  CommandApi.Do()

 

 'Set the number of nodes in the Z direction for the Merge module

  CommandApi.Option ("LatticeMergeZNum", "30")

  CommandApi.Do()

 

 'Set the resample method for the Merge module

 'Value is 0 or 1 for Nearest Neighbor or Trilinear

  CommandApi.Option ("LatticeMergeResample", "1")

  CommandApi.Do()

 

 'Set the overlap method for the Merge module

 'Value is 0, 1, 2, 3, 4, 5, 6 for Average, Count, First, Last, Maximum, Median, or Minimum

  CommandApi.Option ("LatticeMergeOverlap", "5")

  CommandApi.Do()

 

End Sub

 

 

See Also

Automation Model

LatticeMerge