本示例使用来自网格诊断的纵横比数据创建自定义等值线图。该脚本使用 DiagnosisManager 类访问网格诊断数据,使用 PlotManager 类创建自定义用户图。
'%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