CreateModules

 

The Construct method tells Voxler which command to create. The Construct method is accessed from the CommandApi object. The CreateModule type allows the Voxler program to add a new module to the Network Manager. This is similar to the Network Menu commands.

 

The Construct method must be used in combination the Option method and the Do or DoOnce method to create an object.

 

Syntax

object.Construct(“CreateModule”)

 

Construct Type

CreateModule

 

Parameter

Type

Description

AutoConnect

Boolean

True connects the new module to the source module

DefaultPosition

Boolean

True places the module in the Network Manager at the default position.  False allows you to specify the position with the XPosition and YPosition values.

SourceModule

string

Name of the source module

SourceModuleID

unsigned

Numeric ID of the source module

SourcePort

unsigned

The zero-based port index of the source module output port

Type

string

The type of module being created.

XPosition

integer

The numeric X location of the module in the Network Manager if DefaultPosition is set to False. In Pixels.

YPosition

integer

The numeric Y location of the module in the Network Manager if the DefaultPosition is set to False. In Pixels.

 

XPosition and YPosition are in pixels. A position of 0, 0 places the module at the top left corner of the Network Manager.  

 

Example

This example opens the Gold (ScatterPlot) example file. It adds a Gridder module at a specific Network Manager location. The Gridder module is automatically connected to the Data module.

 

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\Gold (ScatterPlot).voxb")

  CommandApi.DoOnce()

 

'Add a gridder module at a specific location. Automatically connect to the data.

  CommandApi.Construct ("CreateModule")

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

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

  CommandApi.Option("SourceModule", "GoldConcentration.dat")

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

  CommandApi.Option("XPosition",40)

  CommandApi.Option("YPosition",100)

  CommandApi.Do()

 

End Sub

 

Used by: CommandApi object

 

 

See Also

Automation Model

Construct Method