Automation Example - Light

 

This is an example for Light.

'********************************************************************************************

' LightModule.bas

' This script opens an existing Voxler file and adds a light module.

' It then changes all the properties of the light module.

'

'                                    -by SKP 4/2010

'

'********************************************************************************************

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()

 

 'Add a light module

  CommandApi.Construct("CreateModule")

  CommandApi.Option ("AutoConnect", "False")

  CommandApi.Option ("Type", "Light")

  CommandApi.Do()

 

 'Set the light type

 'This is either 0, 1, or 2 for directional, point, or spot light

  CommandApi.Construct ("ModifyModule")

  CommandApi.Option("Module", "Light")

  CommandApi.Option ("LightType", "2")

  CommandApi.Do()

 

 'Change the light color

  CommandApi.Option ("LightColor", "Soft Pink")

  CommandApi.Do()

 

 'Show the light dragger

  CommandApi.Option ("LightDragger", "True")

  CommandApi.Do()

 

 'Set the Light X direction

 'Available where lighttype is 0 or 2

  CommandApi.Option ("LightXDirection", "-0.5")

  CommandApi.Do()

 

 'Set the light Y direction

 'Available where lighttype is 0 or 2

  CommandApi.Option ("LightYDirection", "0.5")

  CommandApi.Do()

 

 'Set the light Z direction

 'Available where lighttype is 0 or 2

  CommandApi.Option ("LightZDirection", "-0.5")

  CommandApi.Do()

 

 'Set the light X position

 'Available where lighttype is 1 or 2

  CommandApi.Option ("LightXPosition", "6000")

  CommandApi.Do()

 

 'Set the light Y position

 'Available where lighttype is 1 or 2

  CommandApi.Option ("LightYPosition", "7000")

  CommandApi.Do()

 

 'Set the light Z position

 'Available where lighttype is 1 or 2

  CommandApi.Option ("LightZPosition", "3000")

  CommandApi.Do()

 

 'Set the light cutoff value

 'Available where lighttype is 2

  CommandApi.Option ("LightCutoff", "30")

  CommandApi.Do()

 

 'Set the light drop off value

 'Available where lighttype is 2

  CommandApi.Option ("LightDropoff", "0.8")

  CommandApi.Do()

 

End Sub

 

 

See Also

Automation Model

Light module