'@ '@ Note: The script/macro is provided 'as-is' and cannot be liable for any problems caused. '@ '@ DESCRIPTION '@ This command will find min and max value of a result set, and number of nodes with result, '@ and compare with entities selected '@ Put cavity nodes on a separate layer, or save selection list, for easy selection when using '@ this macro. '@ '@ SYNTAX '@ nodes_filled '@ '@ PARAMETERS '@ ResultID , set in script '@ '@ DEPENDENCIES/LIMITATIONS '@ limited error checking '@ '@ NOTES / HISTORY '@ Date Comment '@ 2014-06-25 created by nordhb '@@ Option Explicit SetLocale "en-us" Dim Synergy, Viewer,SD Dim SelectList, ListSize, Nodes_in_List Dim ResultID, ResultName Dim PlotManager, IndpValues, Indp, nodeID,Value, Plot Set Synergy = CreateObject("synergy.Synergy") Synergy.SetUnits "METRIC" Set Viewer = Synergy.Viewer If Viewer Is Nothing Then MsgBox "Please, select a study.",,"Error" WScript.Quit End If '--- Graphics selection. Set SD = Synergy.StudyDoc() Set SelectList = SD.Selection ListSize = SelectList.Size Nodes_in_List = 0 ' Assign Result ID ResultID = 1610 '** Fill time ResultName = "Fill Time" ' Read Result Data Set PlotManager = Synergy.PlotManager() Set Plot = PlotManager.FindPlotByName2("Fill time", "Fill time") If Plot Is Nothing Then MsgBox "Fill time result not available." & vbLF & vbLF & "Select a study with Fill time result.",,"Error" WScript.Quit End If Set IndpValues = Synergy.CreateDoubleArray() PlotManager.GetIndpValues ResultID, IndpValues Dim Min, Max, Count Min = 1.0E20 Max = -1.0E20 Count= 0 Set PlotManager = Synergy.PlotManager() Set Indp = Synergy.CreateDoubleArray() Set nodeID = Synergy.CreateIntegerArray() Set Value = Synergy.CreateDoubleArray() PlotManager.GetScalarData ResultID, Indp, nodeID, Value Dim Result, vbArray, Count_result, Entities_w_result Dim J Count_result = 0 vbArray = Value.ToVBSArray For J = 0 To UBound(vbArray) Result = vbArray(J) If (Result > Max) Then Max = Result If (Result < Min) Then Min = Result If (Result => 0) Then Count_result = Count_result + 1 End If Next Entities_w_result = ListSize - Count_result If Entities_w_result < 0 Then Entities_w_result = 0 End If MsgBox "Analysing result: " & ResultName & vbLF & vbLF & _ "Minimum is: " & Cstr(FormatNumber(Min,3)) & vbLF & _ "Maximum is: " & Cstr(FormatNumber(Max,3)) & vbLF & vbLF & _ "Entities selected = " & ListSize & vbLF & _ "Nodes having results : " & UBound(vbArray) + 1 & vbLF & vbLF & _ "Entities with No results : " & Entities_w_result & vbLF,,"Information" ' "Nodes with result => 0 : " & Count_result & vbLF & _