This article contains a sample script for creating a function lattice, adding a math module, and changing the properties of the math module.

To run this script:

- Copy the script below, or click here to download the BAS file: MathModule.BAS
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Voxler 4\Scripter.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- 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*. - Click
**Script | Run**to run the script.

***********

'******************************************************************************************** ' MathModule.bas ' This script creates a function lattice. ' It adds a math module and changes the properties of the math module. '******************************************************************************************** ' 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() 'Create a function lattice CommandApi.Construct ("CreateModule") CommandApi.Option("Type", "FunctionLattice") 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", "20") CommandApi.Do() 'Change the number of nodes in the Y direction for the interpolated lattice created by the Math module CommandApi.Option ("LatticeMathYNum", "20") CommandApi.Do() 'Change the number of nodes in the Z direction for the interpolated lattice created by the Math module CommandApi.Option ("LatticeMathZNum", "20") 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

*Updated May 30, 2018*

## Comments

0 comments

Please sign in to leave a comment.