Automation Example - StreamLines

 

This is an example for StreamLines.

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

' StreamlinesModule.bas

' This script loads a test lattice and adds a streamlines module to it.

' It then changes all the properties of the streamlines 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

 

 'Create a new Voxler document

  CommandApi.Construct ("New")

  CommandApi.DoOnce()

 

 'Load the test lattice

  CommandApi.Construct("CreateModule")

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

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

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

  CommandApi.Do()

 

 'Add a streamlines module

  CommandApi.Construct("CreateModule")

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

  CommandApi.Option ("SourceModule", "TestLattice")

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

  CommandApi.Do()

 

 'Change the StreamLinesStreamMethod

 '0, 1, or 2 for Points, Spheres, or Lines

  CommandApi.Construct("ModifyModule")

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

  CommandApi.Option ("StreamLinesStreamMethod", "0")

  CommandApi.Do()

 

 'Turn on or off the AutoCalc Step Interval feature

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

  CommandApi.Do()

 

 'Change the Step Interval

  CommandApi.Option ("StreamLinesStepSize", "0.3")

  CommandApi.Do()

 

 'Change the Number of Steps

  CommandApi.Option ("StreamLinesNumSteps", "50")

  CommandApi.Do()

 

 'Change the Point Size

 'This option is only available when StreamLinesStreamMethod is set to 0

 'Varies between 0 and 48

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

  CommandApi.Do()

 

 'Change the Sphere Size

 'This option is only available when StreamLinesStreamMethod is set to 1

 'Varies from 0 to 1

  CommandApi.Option ("StreamLinesSphereSize", "0.1")

  CommandApi.Do()

 

 'Change the Sphere Quality

 'This option is only available when StreamLineStreamMethod is set to 1

 'Varies from 0 to 1, 1 is high quality

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

  CommandApi.Do()

 

 'Change the line width

 'This option is only available when StreamLineStreamMethod is set to 2

 'Varies between 0 and 4

  CommandApi.Option ("StreamLinesLineWidth", "2.1")

  CommandApi.Do()

 

 'Change the direction streamlines are traced from the seed point

 'Options are 0, 1, or 2 - Forward, Backward, or Both

  CommandApi.Option ("StreamLinesDirection", "1")

  CommandApi.Do()

 

 'Change the Minimum velocity

  CommandApi.Option ("StreamLinesMinVelocity", "0.2")

  CommandApi.Do()

 

 'Change the Color Method to Fixed

  CommandApi.Option ("StreamLinesColorMethod","0")

  CommandApi.Do()

 

 'Change the Fixed color to Desert Blue

  CommandApi.Option ("StreamLinesColor", "Desert Blue")

  CommandApi.Do()

 

  Wait (2)

 

 'Change the Color Method to Fixed

  CommandApi.Option ("StreamLinesColorMethod","1")

  CommandApi.Do()

 

 'Change the color map

  CommandApi.Option ("StreamLinesColormap", "Rainbow")

  CommandApi.Do()

 

 'Change the line seed method

 'Value is 0, 1, 2, 3 for Line, Ring, Square, or Point Set

 'If PointSet, must have another input containing the points

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

  CommandApi.Do()

 

 'Change the number of seeds

  CommandApi.Option ("StreamLinesNumSeeds", "54")

  CommandApi.Do()

 

 'Change the X component of the normal

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

  CommandApi.Do()

 

 'Change the Y component of the normal

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

  CommandApi.Do()

 

 'Change the Z component of the normal

  CommandApi.Option ("StreamLinesZNormal", "45")

  CommandApi.Do()

 

 'Change the X position of the seed point center

  CommandApi.Option ("StreamLinesXPos", "0.7")

  CommandApi.Do()

 

 'Change the Y position of the seed point center

  CommandApi.Option ("StreamLinesYPos", "0.2")

  CommandApi.Do()

 

 'Change the Z position of the seed point center

  CommandApi.Option ("StreamLinesZPos", "0.6")

  CommandApi.Do()

 

 'Change the X Scale factor of the seed plane

  CommandApi.Option ("StreamLinesXScale", "7")

  CommandApi.Do()

 

 'Change the Y Scale factor of the seed plane

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

  CommandApi.Do()

 

 'Show or hide the seed plane dragger

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

  CommandApi.Do()

 

  Wait (2)

 

 'Reset the seed plane to the default

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

  CommandApi.Do()

 

 'Display the StreamLines legend

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

  CommandApi.Do()

 

 'Change the legend orientation

 '0 is for horizontal, 1 is for vertical

  CommandApi.Option ("StreamLinesLegendOrientation", "0")

  CommandApi.Do()

 

 'Change the legend X position

 'Ranges from 0-1

  CommandApi.Option ("StreamLinesLegendXPos", "0.3")

  CommandApi.Do()

 

 'Change the legend Y position

 'Ranges from 0-1

  CommandApi.Option ("StreamLinesLegendYPos", "0.9")

  CommandApi.Do()

 

 'Change the legend width

 'Ranges from 0-200

  CommandApi.Option ("StreamLinesLegendWidth", "20")

  CommandApi.Do()

 

 'Change the legend length

 'Ranges from 0-1024

  CommandApi.Option ("StreamLinesLegendLength", "400")

  CommandApi.Do()

 

 'Change the legend title

  CommandApi.Option ("StreamLinesLegendTitle", "Legend Title")

  CommandApi.Do()

 

 'Change the legend title font size

 'Ranges from 4-72

  CommandApi.Option ("StreamLinesLegendTitleHeight", "20")

  CommandApi.Do()

 

 'Change the number of labels displayed in a legend

  CommandApi.Option ("StreamLinesLegendNumLabels", "3")

  CommandApi.Do()

 

 'Change the legend to use custom labels

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

  CommandApi.Do()

 

 'Set the custom labels for the legend

  CommandApi.Option ("StreamLinesLegendCustomLabels", "1.7:low, 2.1:medium, 2.9:intermediate, 3.2:elevated, 3.7:high")

  CommandApi.Do()

 

 'Set the height for the legend labels

  CommandApi.Option ("StreamLinesLegendLabelHeight", "8")

  CommandApi.Do()

 

 'Set the label format type for the legend

  CommandApi.Option ("StreamLinesLabelFormatType", "0")

  CommandApi.Do()

 

 'Set the number of digits to display on the labels

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

  CommandApi.Do()

 

 'Set the legend label prefix

  CommandApi.Option ("StreamLinesLabelFormatPrefix", "pre-")

  CommandApi.Do()

 

 'Set the legend label postfix

  CommandApi.Option ("StreamLinesLabelFormatPostfix", "-post")

  CommandApi.Do()

 

 'Set the legend font

  CommandApi.Option ("StreamLinesLegendFont", "Arial")

  CommandApi.Do()

 

 'Turn on or off antialiasing for the legend

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

  CommandApi.Do()

 

 'Set the line and text color for the legend

  CommandApi.Option ("StreamLinesLegendFGColor", "Blue")

  CommandApi.Do()

 

 'Set the background color for the legend

  CommandApi.Option ("StreamLinesLegendBGColor", "10% Gray")

  CommandApi.Do()

 

 'Turn on or off the display of the legend background

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

  CommandApi.Do()

 

End Sub

 

 

See Also

Automation Model

StreamLines Module