IsNumeric on Custom Property

IsNumeric on Custom Property

M_Santi
Enthusiast Enthusiast
287 Views
3 Replies
Message 1 of 4

IsNumeric on Custom Property

M_Santi
Enthusiast
Enthusiast

Is there a way to make the custom property gauging required = "YES" if the value of custom property gauging cost contain a numerical value?

 

Thank you.

 

If iProperties.Value("CUSTOM", "GAUGING COST") = IsNumeric(aString) Then 
iProperties.Value("CUSTOM", "GAUGING RERQUIRED") = "YES"

End If 'update all'
iLogicVb.UpdateWhenDone = True

 

0 Likes
Accepted solutions (1)
288 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor

Hi @M_Santi.  You can try it like this, and see if this works as you expect.

Dim oValue
Try 'because this is a 'custom' iProperty, it may not exist
	oValue = iProperties.Value("CUSTOM", "GAUGING COST")
Catch
	MsgBox("The custom iProperty named 'GAUGING COST' was not found.", vbCritical, "iLogic")
	Return
End Try
If oValue IsNot Nothing Then
	Try 'because this is a 'custom' iProperty, it may not exist
		If IsNumeric(oValue) Then
			iProperties.Value("CUSTOM", "GAUGING RERQUIRED") = "YES"
		Else
			iProperties.Value("CUSTOM", "GAUGING RERQUIRED") = "NO"
		End If
	Catch
		MsgBox("The custom iProperty named 'GAUGING RERQUIRED' was not found.", vbCritical, "iLogic")
	End Try
End If

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 4

M_Santi
Enthusiast
Enthusiast

It works, but I have to manually run the rule to get the value of yes or no on "gauging required" when I input the value on "gauging cost". What do I need change to make it so that it runs the rule automatically every time I change the value on the "Gauging cost".

0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Hi @M_Santi.  First, how was that custom iProperty created?  Manually, though the main iProperties dialog, on the Custom tab?  Or was it created automatically by marking a Parameter within the Parameters dialog to Export (Checkmark in the 'Export Parameter' column for that parameter)?

 

If it was made manually, then you will have to open the Event Triggers dialog on the Manage tab, iLogic panel.  Then make sure the tab named 'This Document' is the active one.  Then drag this iLogic rule from the list on the left, over under the 'iProperty Change' event on the right.  Then click OK.

 

If it was created automatically from an exported parameter, and this iLogic rule in an 'internal' one (saved within the Inventor document, not external), then we could likely just include the name of the unquoted name of that parameter somewhere within that iLogic rule.  To do that, make a new, empty line at the top/start of that iLogic rule, then create a 'dummy variable' like "oTrigger = MyParamName" (without the quotes).  The name of that parameter will turn blue (by default), signaling that it is recognized as representing a 'local' parameter (within that same document).  Then, whenever the value of that parameter changes, it will cause this rule to run automatically.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes