Share

API example: Customized aspect ratio plot

This example creates a custom contour plot using aspect ratio data from mesh diagnostics. The script uses the DiagnosisManager class for access to mesh diagnostics data, and the PlotManager class to create the custom user plot.

'%RunPerInstance
'@
'@ DESCRIPTION
'@ Take the Standard Aspect Ratio Plot and convert it into a contour plot
'@
'@ SYNTAX
'@ CustomAspect
'@
'@ PARAMETERS
'@ none
'@
'@ DEPENDENCIES/LIMITATIONS
'@ Assumes a study file is open within synergy
'@ none
'@
'@ History
'@ Created DRA 9/8/2006
'@@
Option Explicit
SetLocale("en-us")
Dim SynergyGetter, Synergy
On Error Resume Next
Set SynergyGetter = GetObject(CreateObject("WScript.Shell").ExpandEnvironmentStrings("%SAInstance%"))
On Error GoTo 0
If (Not IsEmpty(SynergyGetter)) Then
  Set Synergy = SynergyGetter.GetSASynergy
Else
  Set Synergy = CreateObject("synergy.Synergy")
End If
Synergy.SetUnits "METRIC"

Dim DiagnosisManager, PlotManager
Dim Elems, AR, ARPlot

' Get aspect ratio diagnostics
Set Elems = Synergy.CreateIntegerArray()
Set AR = Synergy.CreateDoubleArray()
Set DiagnosisManager = Synergy.DiagnosisManager()
DiagnosisManager.GetAspectRatioDiagnosis 0.0, 0.0, True, Elems, AR
Set DiagnosisManager = Nothing

' Create user plot
Set PlotManager = Synergy.PlotManager()
Set ARPlot = PlotManager.CreateUserPlot()
ARPlot.SetDataType "ELDT"
ARPlot.SetName "Aspect ratio by contours"
ARPlot.AddScalarData 0.0, Elems, AR
ARPlot.Build

MsgBox "Script Complete"
Wscript.Quit

Was this information helpful?