Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions Form_WorkFlow.vb
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,58 @@ Public Class Form_WorkFlow

End Sub

Private Function CheckVarLimits() As Boolean
Dim Success As Boolean = True

Dim UU As New UtilsUnits(Form_VarHandler.ObjDoc)
Dim ErrorList As New List(Of String)
Dim StepCount As Integer = 1
Dim s As String

If FLP_Events.Controls.Count > 0 Then
For Each StepEvent As UC_WorkFlowEvent In FLP_Events.Controls

For Each tmpRow As DataGridViewRow In StepEvent.DG_Variables.Rows

Dim tmpVariable As Object = tmpRow.Cells("objVar").Value

If UU.HasVariableLimit(tmpVariable) Then
Dim tmpName As String = tmpRow.Cells("Name").Value
Dim tmpValue As Double = tmpRow.Cells("Value").Value
Dim tmpMin As Double = UU.GetValueRangeLowValue(tmpVariable)
Dim tmpMax As Double = UU.GetValueRangeHighValue(tmpVariable)
If tmpValue < tmpMin Then
Success = False
s = String.Format("Event {0}: {1}: Value {2} < minimum limit {3}", StepCount, tmpName, tmpValue, tmpMin)
ErrorList.Add(s)
ElseIf tmpValue > tmpMax Then
Success = False
s = String.Format("Event {0}: {1} Value {2} > maximum limit {3}", StepCount, tmpName, tmpValue, tmpMax)
ErrorList.Add(s)
End If

End If
Next

StepCount += 1
Next
End If

If ErrorList.Count > 0 Then
s = String.Format("Variables outside of limits{0}", vbCrLf)
For Each line As String In ErrorList
s = String.Format("{0}{1}{2}", s, line, vbCrLf)
Next
MsgBox(s, vbOKOnly)
End If

Return Success
End Function

Private Sub BT_Play_Click(sender As Object, e As EventArgs) Handles BT_Play.Click

If Not CheckVarLimits() Then Exit Sub

BT_Skip.Text = "Stop"
BT_Skip.Image = My.Resources._Stop

Expand Down
8 changes: 4 additions & 4 deletions UC_Slider.vb
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ Public Class UC_Slider


If NewWay Then
min = UU.GetValueRangeLowValue(objVar)
max = UU.GetValueRangeHighValue(objVar)

If min = 0 And max = 0 Then
If UU.HasVariableLimit(objVar) Then
min = UU.GetValueRangeLowValue(objVar)
max = UU.GetValueRangeHighValue(objVar)
Else
min = UU.GetVarValue(objVar) - 10
max = UU.GetVarValue(objVar) + 10
End If
Expand Down
14 changes: 14 additions & 0 deletions UtilsUnits.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ Public Class UtilsUnits

End Sub

Public Function HasVariableLimit(objVar As Object) As Boolean
Dim VariableLimit As Boolean = False
Dim LimitValue As SolidEdgeFramework.VariableLimitValueConstant

If TypeOf (objVar) Is SolidEdgeFramework.variable Then
Dim tmpVar = CType(objVar, SolidEdgeFramework.variable)
tmpVar.HasVariableLimit(VariableLimit, LimitValue)
ElseIf TypeOf (objVar) Is SolidEdgeFrameworkSupport.Dimension Then
'Dim tmpDim = CType(objVar, SolidEdgeFrameworkSupport.Dimension)
End If

Return LimitValue = SolidEdgeFramework.VariableLimitValueConstant.igMinMaxLimit
End Function

Public Sub SetValueRangeValues(objVar As Object, min As Double, max As Double)

' Convenience function to set variable ranges in user units, rather than SE internal units.
Expand Down