Automation Example - Isosurface

 

This is an example for Isosurface.

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

' IsosurfaceModule.bas

' This script loads a data file and adds a gridder module to it.

' It adds an isosurface to the gridder module.

' It then changes all the properties of the isosurface.

'

'                                    -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 data file

  CommandApi.Construct("Import")

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

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

  CommandApi.Option ("Path", VoxlerApp.Path+"\Samples\GoldConcentration.dat")

  CommandApi.Option ("Filter", "dat")

  CommandApi.Option ("Options", "Defaults=1;EatWhitespace=1;Delimiter=Space,tab,comma,semicolon;TextQualifier=doublequote,quote")

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

  CommandApi.Do()

 

 'Add a gridder module

  CommandApi.Construct("CreateModule")

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

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

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

  CommandApi.Do()

 

 'Grid the data

  CommandApi.Construct("ModifyModule")

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

  CommandApi.Option("Gridder3Auto", "true")

  CommandApi.Option("Gridder3DoIt", "true")

  CommandApi.Do()

 

 'Add a isosurface module

  CommandApi.Construct("CreateModule")

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

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

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

  CommandApi.Do()

 

 'Change the isosurface component

  CommandApi.Construct ("ModifyModule")

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

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

  CommandApi.Do()

 

 'Change the isosurface drawing style

 'This is a number 0, 1, or 2

 '0 indicates shaded, 1 is lines only, and 2 is points

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

  CommandApi.Do()

 

 'Change the isosurface "Side to Draw" style

 'This is a number 0, 1, or 2

 '0 indicates front and back, 1 is front only, and 2 is back only

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

  CommandApi.Do()

 

 'Change the isosurface isovalue

  CommandApi.Option ("IsosurfaceIsovalue", "3.9")

  CommandApi.Do()

 

 'Change the coloring of the isosurface to a fixed color

 '0 = fixed, 1 = by data

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

  CommandApi.Do()

 

 'Change the fixed color to light green

  CommandApi.Option ("IsosurfaceColor", "light green")

  CommandApi.Do()

 

  Wait (2)

 

 'Change the isosurface drawing style

 'This is a number 0, 1, or 2

 '0 indicates shaded, 1 is lines only, and 2 is points

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

  CommandApi.Do()

 

 'Change the coloring of the isosurface to a fixed color

 '0 = fixed, 1 = by data

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

  CommandApi.Do()

 

 'Change the color map to rainbow

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

  CommandApi.Do()

 

 'Change the isosurface specular color

  CommandApi.Option ("IsosurfaceSpecularColor", "magenta")

  CommandApi.Do()

 

 'Change the isosurface Specular Intensity - value between 0 and 1

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

  CommandApi.Do()

 

 'Change the Isosurface Shininess  - value between 0 and 1

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

  CommandApi.Do()

 

 'Change the Isosurface Opacity  - value between 0 and 1

  CommandApi.Option ("IsosurfaceOpacity", "0.4")

  CommandApi.Do()

 

 'Display the Isosurface legend

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

  CommandApi.Do()

 

 'Change the legend orientation

 '0 is for horizontal, 1 is for vertical

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

  CommandApi.Do()

 

 'Change the legend X position

 'Ranges from 0-1

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

  CommandApi.Do()

 

 'Change the legend Y position

 'Ranges from 0-1

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

  CommandApi.Do()

 

 'Change the legend width

 'Ranges from 0-200

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

  CommandApi.Do()

 

 'Change the legend length

 'Ranges from 0-1024

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

  CommandApi.Do()

 

 'Change the legend title

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

  CommandApi.Do()

 

 'Change the legend title font size

 'Ranges from 4-72

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

  CommandApi.Do()

 

 'Change the number of labels displayed in a legend

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

  CommandApi.Do()

 

 'Change the legend to use custom labels

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

  CommandApi.Do()

 

 'Set the custom labels for the legend

  CommandApi.Option ("IsosurfaceLegendCustomLabels", "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 ("IsosurfaceLegendLabelHeight", "8")

  CommandApi.Do()

 

 'Set the label format type for the legend

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

  CommandApi.Do()

 

 'Set the number of digits to display on the labels

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

  CommandApi.Do()

 

 'Set the legend label prefix

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

  CommandApi.Do()

 

 'Set the legend label postfix

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

  CommandApi.Do()

 

 'Set the legend font

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

  CommandApi.Do()

 

 'Turn on or off antialiasing for the legend

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

  CommandApi.Do()

 

 'Set the line and text color for the legend

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

  CommandApi.Do()

 

 'Set the background color for the legend

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

  CommandApi.Do()

 

 'Turn on or off the display of the legend background

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

  CommandApi.Do()

 

 'Calculate the volume contained by the isosurface

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

  CommandApi.Do()

 

End Sub

 

 

See Also

Automation Model

Isosurface