Hi @Anonymous,
I was just thinking to something else which could work better to your needs.
I think the "undo" command is dangerous and unstable...
So, the goal is to capture current state of your parameters and store then in custom properties. Each time you change a (blue) parameter in your form, it will be compared to a custom property. At the end of the rule, the (blue) parameter is saved in the custom property.
Look at this and please try :
SyntaxEditor Code Snippet
'You must run the rule one time first to create and set the custom properties
'Then you can active the MessageBox below
'Check the parameters values and custom iProperties values
'MessageBox.Show("ParamA = " & ParamA _
'& vbNewLine & "iPropA = " & iProperties.Value("Custom", "ParamA") _
'& vbNewLine & "ParamB = " & ParamB _
'& vbNewLine & "iPropB = " & iProperties.Value("Custom", "ParamB"), "Title")
'Check parameters values
If ParamA < 25 Or ParamA > 100 Then
MessageBox.Show("Please set a value between 25 and 100", "iLogic")
ParamA = iProperties.Value("Custom", "ParamA")
End If
If ParamB < 25 Or ParamB > 100 Then
MessageBox.Show("Please set a value between 25 and 100", "iLogic")
ParamB = iProperties.Value("Custom", "ParamB")
End If
'Create or save current parameters in custom properties
oMyParameter = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
Try
iProperties.Value("Custom", "ParamA") = ParamA
iProperties.Value("Custom", "ParamB") = ParamB
Catch
oMyParameter.AddByExpression ("ParamA", ParamA, UnitsTypeEnum.kMillimeterLengthUnits)
oMyParameter.AddByExpression ("ParamB", ParamB, UnitsTypeEnum.kMillimeterLengthUnits)
End Try
iLogicVb.UpdateWhenDone = True
I think this code will allow you more possibilities to play with your parameters.
Hope this help 
Thomas
Mechanical Designer / Inventor Professional 2025
