Model is not Update After entering wrong value

Model is not Update After entering wrong value

Pratik.Ksoni
Advocate Advocate
592 Views
7 Replies
Message 1 of 8

Model is not Update After entering wrong value

Pratik.Ksoni
Advocate
Advocate

Hello,

 

in my 3D model i have put some limitation in Enter Value, if i add any exceed value then it show message but problem is when i enter incorrect value then it takes incorrect value and when i run the rule then only it update with correct one.

i am looking for when i enter any incorrect value then it shows message and do not take incorrect value.

 

Please guide me.

 

Thanks

Pratik

0 Likes
Accepted solutions (1)
593 Views
7 Replies
Replies (7)
Message 2 of 8

b_sharanraj
Advocate
Advocate

Hi @Pratik.Ksoni

 

Try the below Sample Code once 🙂

 

If Param_X > 100 Then

MessageBox.Show("Message", "Title")
'50 is assumed as Default Value if User Enters more than 100
Param_X = 50 End If

 

Regards

B.Sharan Raj

0 Likes
Message 3 of 8

Pratik.Ksoni
Advocate
Advocate

Thanks for reply,

 

it works but i am in the requirement of when we enter any incorrect value then model should not be take this value,

say for example if 50 is default value and if i enter 100 then it will take 100 value and update and when i run the rule then it update with rule.

 

i hope that can clear.

 

Thanks

0 Likes
Message 4 of 8

b_sharanraj
Advocate
Advocate

In that Case add a Additional Temporary Parameter (Temp_Param_X) and a New Rule with a Event Trigger of After Open Document

 

'With Event Trigger of After Opening Document Option
Temp_Param_X
= Param_X 

 

and the below code you know where to add 🙂

 

If Param_X > 100 Then

MessageBox.Show("Message", "Title")
'Value which ever earlier in the specific part will be back so nothing change will happen in model
Param_X = Temp_Param_X End If

 

Regards

B.Sharan Raj

0 Likes
Message 5 of 8

b_sharanraj
Advocate
Advocate

In that Case add a Additional Temporary Parameter (Temp_Param_X) and a New Rule with a Event Trigger of After Open Document

 

'With Event Trigger of After Opening Document Option
Temp_Param_X
= Param_X 

 

and the below code you know where to add 🙂

 

If Param_X > 100 Then

MessageBox.Show("Message", "Title")
'Value which ever earlier in the specific part will be back so nothing change will happen in model
Param_X = Temp_Param_X End If

 

Regards

B.Sharan Raj

0 Likes
Message 6 of 8

Pratik.Ksoni
Advocate
Advocate

Hi,

 

Please see attached example.

 

in this if you enter incorrect value i.e. smaller than 9 then it will show message and model also update with incorrect value but it will not take correct value.

when you run the rule then only it will be update.

 

Thanks

 

0 Likes
Message 7 of 8

Anonymous
Not applicable

It sounds like you need a while loop. Try this:

 

While    SINKLOCATION_LH<9
    SINKLOCATION_LH = InputBox("SINKLOCATION_LH has incorrect value. Please enter value equal to or greater than 9", "SINKLOCATION_LH", "9")
End While

While    SINKLOCATION_FRONT<9
    SINKLOCATION_FRONT = InputBox("SINKLOCATION_FRONT has incorrect value. Please enter value equal to or greater than 9", "SINKLOCATION_FRONT", "9")
End While

Parameter("COUNTERTOP:1", "SINKLOCATION_LH")=SINKLOCATION_LH
Parameter("COUNTERTOP:1", "SINKLOCATION_FRONT")=SINKLOCATION_FRONT

ThisDoc.Document.Rebuild()
RuleParametersOutput()
iLogicVb.RunRule("Rule0")
iLogicVb.UpdateWhenDone = True 
trigger = iTrigger0

 

0 Likes
Message 8 of 8

b_sharanraj
Advocate
Advocate
Accepted solution

Try this code once 🙂

 

 

 

Temp_SINKLOCATION_LH = Parameter("COUNTERTOP:1", "SINKLOCATION_LH")
Temp_SINKLOCATION_FRONT = Parameter("COUNTERTOP:1", "SINKLOCATION_FRONT") 

While SINKLOCATION_LH < 9
    MessageBox.Show("INCORRECT VALUE", "SINKLOCATION_LH")
    SINKLOCATION_LH = Temp_SINKLOCATION_LH
End While

While SINKLOCATION_FRONT < 9
    MessageBox.Show("INCORRECT VALUE", "SINKLOCATION_FRONT")
    SINKLOCATION_FRONT = Temp_SINKLOCATION_FRONT
End While

Parameter("COUNTERTOP:1", "SINKLOCATION_LH") = SINKLOCATION_LH
Parameter("COUNTERTOP:1", "SINKLOCATION_FRONT") = SINKLOCATION_FRONT

ThisDoc.Document.Rebuild()
InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True 

 

Regards

B.Sharan Raj