The Construct method tells Voxler which command to create. The Construct method is accessed from the CommandApi object. The Export type allows the Voxler program to export an existing model from the Viewer window. This is similar to the File | Export command.
The Construct method must be used in combination with the Option method and the Do or DoOnce method to create an object.
There are two subtleties to exporting a module. First, exporting a file depends upon the correct module ID being selected. If you wish to export the full viewer window, the Module ID must always be 0. To export any other module, select the appropriate module ID. This idea is reiterated in the example scripts. Second, what file formats you can export to depends upon the file format of the imported file. Information about file formats is listed in Voxler's help.
Syntax
object.Construct("Export")
Construct Type
Export
Parameter |
Type |
Description |
ClearOptions |
Boolean |
If True, clear all filter options before adding a new option. If False, a new option will be concatenated to existing options. |
Filter |
Optional filter id. |
|
Module |
string |
Name of the module to be exported |
ModuleID |
unsigned |
Numeric ID of the module to be exported |
Option |
String |
One or more (key, value) pairs to be passed to the filter. Packed as "key=value", with multiple pairs semicolon-separated. |
Options |
String |
One or more (key, value) pairs to be passed to the filter. Packed as "key=value", with multiple pairs semicolon-separated. |
Path |
String |
The full path to the export file. Only one path can be specified. |
PersistOptions |
Boolean |
If True, persist filter options in the registry. If False, do not save options. |
Example
This example opens an existing VOXB file and exports it to a BMP file.
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
'Open an existing file
CommandApi.Construct ("Open")
CommandApi.Option ("Path", VoxlerApp.Path+"\Samples\Helens (ContourMap).voxb")
CommandApi.DoOnce()
'Export the viewer window to a bitmap
'Change the export Path to one that exists on your computer
CommandApi.Construct("Export")
CommandApi.Option("GuiEnabled", "False")
CommandApi.Option("ClearOptions", "False")
CommandApi.Option("Filter", "bmp")
CommandApi.Option("Options", "Height=418; Width=576")
CommandApi.Option("Path", "C:/path/to/example/file.bmp")
CommandApi.Option("PersistOptions", "True")
CommandApi.Option("ModuleId", "0")
CommandApi.Do()
End Sub
Used by: CommandApi object
See Also