KB no longer maintained - Voxler is a retired product. Golden Software retired products are still supported, but no longer receive new features or updates. Many of Voxler's features are moving to Surfer . Please contact support@goldensoftware.com with any questions. |
This article contains a sample script for creating a test lattice, adding a Slice module, and changing the properties of the Slice.
To run this script:
- Copy the script below, or click here to download the BAS file: SliceModule.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.
*********
'******************************************************************************************** ' SliceModule.bas ' This script creates a test lattice. ' It adds a Slice module and changes the properties of the Slice. '******************************************************************************************** ' 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 test lattice CommandApi.Construct ("CreateModule") CommandApi.Option("Type", "TestLattice") CommandApi.Do() 'Add a Slice module to the test lattice CommandApi.Construct ("CreateModule") CommandApi.Option ("Type", "Slice") CommandApi.Option ("AutoConnect", "True") CommandApi.Option ("SourceModule", "TestLattice") CommandApi.Do() 'Add a Contours module to the slice CommandApi.Construct ("CreateModule") CommandApi.Option ("Type", "Contours") CommandApi.Option ("AutoConnect", "True") CommandApi.Option ("SourceModule", "Slice") CommandApi.Do() 'Change the Slice cutting plane orientation 'Value is 0, 1, 2, or 3 for XY Plane (Axial), XZ Plane (Coronal), YZ Plane (Sagittal), or Custom CommandApi.Construct ("ModifyModule") CommandApi.Option ("Module", "Slice") CommandApi.Option ("LatticeSlicePlaneOrientation", "3") CommandApi.Do() 'Change the X Normal Direction For the Slice cutting plane 'Only available if LatticeSlicePlaneOrientation is set to 3 CommandApi.Option ("LatticeSlicePlaneXNormal", "30") CommandApi.Do() 'Change the Y Normal Direction For the Slice cutting plane 'Only available if LatticeSlicePlaneOrientation is set to 3 CommandApi.Option ("LatticeSlicePlaneYNormal", "30") CommandApi.Do() 'Change the Z Normal Direction For the Slice cutting plane 'Only available if LatticeSlicePlaneOrientation is set to 3 CommandApi.Option ("LatticeSlicePlaneZNormal", "60") CommandApi.Do() 'Change the offset of the cutting plane from the center of the lattice CommandApi.Option ("LatticeSlicePlaneOffset", "-0.5") CommandApi.Do() 'Display the cutting plane dragger CommandApi.Option ("LatticeSlicePlaneShowDragger", "True") CommandApi.Do() 'Turn on/off the slice trilinear interpolation CommandApi.Option ("LatticeSliceInterpolate", "True") CommandApi.Do() 'Change the number of nodes in the X direction of the output slice CommandApi.Option ("LatticeSliceXResolution", "50") CommandApi.Do() 'Change the number of nodes in the Y direction of the output slice CommandApi.Option ("LatticeSliceYResolution", "34") CommandApi.Do() 'Show/hide the border around the edge of the slice plane CommandApi.Option ("LatticeSliceBorderShow", "True") CommandApi.Do() 'Change the border line width around the slice plane 'Value is between 0 and 4 CommandApi.Option ("LatticeSliceBorderWidth", "2.3") CommandApi.Do() 'Change the border line color around the slice plane 'Value is a color name CommandApi.Option ("LatticeSliceBorderColor", "Sky Blue") CommandApi.Do() End Sub
Updated March 13, 2018
Comments
0 comments
Please sign in to leave a comment.