Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IsNumeric on Custom Property

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
M_Santi
114 Views, 3 Replies

IsNumeric on Custom Property

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

 

3 REPLIES 3
Message 2 of 4
WCrihfield
in reply to: M_Santi

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)

Message 3 of 4
M_Santi
in reply to: WCrihfield

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".

Message 4 of 4
WCrihfield
in reply to: M_Santi

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)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report