If parameter is greater than zero then run this rule

If parameter is greater than zero then run this rule

kwilson_design
Collaborator Collaborator
414 Views
2 Replies
Message 1 of 3

If parameter is greater than zero then run this rule

kwilson_design
Collaborator
Collaborator

In short, I'm trying to trigger a custom iProperty to be used is a parameter called "Total_Length" is greater than zero, or 0.000 to be specific. 

 

I have a an existing rule that is called "Calculate ERP Amount Conversion" and it's a simple code that writes to a custom iProperty named ERP Amount that I'm also rounding down to 3 place decimal.

iProperties.Value("Custom", "ERP Amount") = Parameter("ERP_Amount_Conversion")
iProperties.Value("Custom", "ERP Amount") = Round(Parameter("ERP_Amount_Conversion"), 3)

Anyways, what I'm trying to do is that if a user parameter named "Total_Length" is greater than zero, then run the above code, otherwise allow the custom iProperty "ERP Amount" to remain editable for manual data entry instead of relying on the data from the user parameter. Hope that makes sense lol.

 

It seems pretty straight forward, and I'm sure it is, but I'm running into a syntax snag when trying to do this with If Then End If statements. There may be a better way to achieve what I'm trying to do in the original code for all I know and I'm open to any suggestions.

 

If Parameter("Total_Length") > 0.000
	Then 
iLogicVb.RunRule("Calculate ERP Amount If Total_Length is extrusion")
End If

Above is what I've got so far but I'm getting the syntax error on Line 2.

 

Rule Compile Errors in Catch, in Test.ipt

Error on Line 2 : Syntax error.

Regards,
Kenny
If this post solved your issue please mark "Accept as Solution". It helps everyone...really!
0 Likes
415 Views
2 Replies
Replies (2)
Message 2 of 3

BM_Ashraf
Advocate
Advocate

Hi @kwilson_design 

 

Try this

If Total_Length > 0 Then 
  iLogicVb.RunRule("Calculate ERP Amount If Total_Length is extrusion")
End If 
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.

Blue Mech

Add-ins for Inventor!

Message 3 of 3

kwilson_design
Collaborator
Collaborator

Thanks @BM_Ashraf that fixed it. 

Regards,
Kenny
If this post solved your issue please mark "Accept as Solution". It helps everyone...really!
0 Likes