Automation Example - LatticeMath

 

This is an example for LatticeMath.

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

' MathModule.bas

' This script creates a function lattice.

' It adds a math module and changes the properties of the math 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 component to the function lattice

  CommandApi.Construct ("ModifyModule")

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

  CommandApi.Option ("FunctionLatticeOutComps", "2")

  CommandApi.Do()

 

 'Set the component 2 equation

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

  CommandApi.Do()

 

 'Add a math module to the function lattice

  CommandApi.Construct ("CreateModule")

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

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

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

  CommandApi.Do()

 

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

  CommandApi.Construct ("ModifyModule")

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

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

  CommandApi.Do()

 

 'Change the X axis minimum value for the interpolated lattice created by the Math module

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

  CommandApi.Do()

 

 'Change the X axis maximum value for the interpolated lattice created by the Math module

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

  CommandApi.Do()

 

 'Change the Y axis minimum value for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathYMin", "0.1")

  CommandApi.Do()

 

 'Change the Y axis maximum value for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathYMax", "0.9")

  CommandApi.Do()

 

 'Change the Z axis minimum value for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathZMin", "0.1")

  CommandApi.Do()

 

 'Change the Z axis maximum value for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathZMax", "0.4")

  CommandApi.Do()

 

 'Change the number of nodes in the X direction for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathXNum", "40")

  CommandApi.Do()

 

 'Change the number of nodes in the Y direction for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathYNum", "40")

  CommandApi.Do()

 

 'Change the number of nodes in the Z direction for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathZNum", "40")

  CommandApi.Do()

 

 'Change the output type for the interpolated lattice created by the Math module

 'Value is 0, 1, 2, 3, 4, 5, 6, 7, 8

 'for Signed 8 bits, Unsigned 8 bits, signed 16 bits, Unsigned 16 bits, Signed 32 bits,

 'Unsigned 32 bits, Signed 64 bits, Float (32 bits), Double (64 bits)

  CommandApi.Option ("LatticeMathOutType", "7")

  CommandApi.Do()

 

 'Change the number of output components for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathOutComps", "20")

  CommandApi.Do()

 

 'Change the equation for the component 1 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp1", "A1")

  CommandApi.Do()

 

 'Change the equation for the component 2 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp2", "A2")

  CommandApi.Do()

 

 'Change the equation for the component 3 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp3", "A1+A2")

  CommandApi.Do()

 

 'Change the equation for the component 4 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp4", "A1*A1")

  CommandApi.Do()

 

 'Change the equation for the component 5 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp5", "A1+A2*A1")

  CommandApi.Do()

 

 'Change the equation for the component 6 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp6", "A1-A2")

  CommandApi.Do()

 

 'Change the equation for the component 7 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp7", "A2-A1")

  CommandApi.Do()

 

 'Change the equation for the component 8 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp8", "A1*A1*A1")

  CommandApi.Do()

 

 'Change the equation for the component 9 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp9", "A2*A2")

  CommandApi.Do()

 

 'Change the equation for the component 10 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp10", "A2*A2*A2")

  CommandApi.Do()

 

 'Change the equation for the component 11 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp11", "A2+A1*A2")

  CommandApi.Do()

 

 'Change the equation for the component 12 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp12", "A1")

  CommandApi.Do()

 

 'Change the equation for the component 13 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp13", "A1")

  CommandApi.Do()

 

 'Change the equation for the component 14 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp14", "A1")

  CommandApi.Do()

 

 'Change the equation for the component 15 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp15", "A1")

  CommandApi.Do()

 

 'Change the equation for the component 16 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp16", "A1")

  CommandApi.Do()

 

 'Change the equation for the component 17 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp17", "A1")

  CommandApi.Do()

 

 'Change the equation for the component 18 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp18", "A1")

  CommandApi.Do()

 

 'Change the equation for the component 19 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp19", "A1")

  CommandApi.Do()

 

 'Change the equation for the component 20 for the interpolated lattice created by the Math module

  CommandApi.Option ("LatticeMathExprComp20", "A1")

  CommandApi.Do()

 

End Sub

 

 

See Also

Automation Model

LatticeMath