The Construct method tells Voxler which command to create. The Construct method is accessed from the CommandApi object. The ViewDirection type sets the Viewer window to one of the predefined view directions. This is similar to the View | Defined Views commands.
The Construct method must be used in combination with the Option method and the Do or DoOnce method to create an object.
Syntax
object.Construct(“ViewDirection”)
Construct Type
ViewDirection
Parameter |
Type |
Description |
ShowWindow |
String |
Set the ShowWindow option to Front, Back, Left, Right, Top, Bottom, or Default |
Example
This example opens the Helens (ContourMap) example file. It adds a text box that changes to show the orientation. It then changes the view direction.
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")
Set VoxlerApp = GetObject(,"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()
'Add text showing the orientation
CommandApi.Construct("CreateModule")
CommandApi.Option ("AutoConnect", "False")
CommandApi.Option ("DefaultPosition", "True")
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()
End Sub
Used by: CommandApi object
See Also