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 loading an existing VOXB file and changing the view rotations.
To run this script:
- Copy the script below, or click here to download the BAS file: ViewerPosition.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.
*********
'******************************************************************************************** ' ViewerPosition.bas ' This script loads an existing VOXB file and changes the view rotations. '******************************************************************************************** ' 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() 'Open an existing file CommandApi.Construct ("Open") CommandApi.Option ("Path", VoxlerApp.Path+"\Samples\Inversion (Isosurfaces).voxb") CommandApi.DoOnce() 'Add text showing the orientation CommandApi.Construct("CreateModule") CommandApi.Option ("Type", "Annotation") CommandApi.Do() 'Modify the text CommandApi.Construct("ModifyModule") CommandApi.Option ("Module", "Annotation") CommandApi.Option ("AnnotationText", "Left") CommandApi.DoOnce() 'Change the Viewer direction to Left CommandApi.Construct("ViewDirection") CommandApi.Option ("ViewDirection", "Left") CommandApi.Do() 'Wait 3 seconds Wait(3) 'Change the Viewer direction to Top CommandApi.Construct("ViewDirection") CommandApi.Option ("ViewDirection", "Top") CommandApi.Do() 'Update the annotation CommandApi.Construct ("ModifyModule") CommandApi.Option ("Module", "Annotation") CommandApi.Option ("AnnotationText", "Top") CommandApi.DoOnce() 'Wait 3 seconds Wait(3) 'Change the Viewer direction to Right CommandApi.Construct("ViewDirection") CommandApi.Option ("ViewDirection", "Right") CommandApi.Do() 'Update the annotation CommandApi.Construct ("ModifyModule") CommandApi.Option ("Module", "Annotation") CommandApi.Option ("AnnotationText", "Right") CommandApi.DoOnce() 'Wait 3 seconds Wait(3) 'Change the Viewer direction to Bottom CommandApi.Construct("ViewDirection") CommandApi.Option ("ViewDirection", "Bottom") CommandApi.Do() 'Update the annotation CommandApi.Construct ("ModifyModule") CommandApi.Option ("Module", "Annotation") CommandApi.Option ("AnnotationText", "Bottom") CommandApi.DoOnce() 'Wait 3 seconds Wait(3) 'Change the Viewer direction to Front CommandApi.Construct("ViewDirection") CommandApi.Option ("ViewDirection", "Front") CommandApi.Do() 'Update the annotation CommandApi.Construct ("ModifyModule") CommandApi.Option ("Module", "Annotation") CommandApi.Option ("AnnotationText", "Front") CommandApi.DoOnce() 'Wait 3 seconds Wait(3) 'Change the Viewer direction to Back CommandApi.Construct("ViewDirection") CommandApi.Option ("ViewDirection", "Back") CommandApi.Do() 'Update the annotation CommandApi.Construct ("ModifyModule") CommandApi.Option ("Module", "Annotation") CommandApi.Option ("AnnotationText", "Back") CommandApi.DoOnce() 'Wait 3 seconds Wait(3) 'Change the Viewer direction to Default CommandApi.Construct("ViewDirection") CommandApi.Option ("ViewDirection", "Default") CommandApi.Do() 'Update the annotation CommandApi.Construct ("ModifyModule") CommandApi.Option ("Module", "Annotation") CommandApi.Option ("AnnotationText", "Default") CommandApi.DoOnce() 'Sets the view so that the objects in the viewer window fit the screen size CommandApi.Construct ("ViewFittoWindow") CommandApi.Do() 'Sets the viewer window size CommandApi.Construct("ViewSize") CommandApi.Option ("XSize", "500") CommandApi.Option ("YSize", "500") CommandApi.Do() End Sub
Updated March 13, 2018
Comments
0 comments
Please sign in to leave a comment.