iLogic InputBox, how avoid failure when cancel

iLogic InputBox, how avoid failure when cancel

BRLMCHKD
Advocate Advocate
581 Views
1 Reply
Message 1 of 2

iLogic InputBox, how avoid failure when cancel

BRLMCHKD
Advocate
Advocate

Hi.

I would like help to solve my problem
rule / model error if I click 'cancel' in 'Enter value' prompt
The button is in itself inappropriate because I have already clicked 'yes'
in the 'Attention' prompt.

Attached my part, and screen cast showing my problem

Thanks /BRLMCHKD 🙂

By the way, going on 3 weeks holiday from this afternoon 🙂

0 Likes
582 Views
1 Reply
Reply (1)
Message 2 of 2

Curtis_Waguespack
Consultant
Consultant

Hi @BRLMCHKD

 

Maybe something like this (see attached example  2017 part)

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

iLogicVb.UpdateWhenDone = True


Answer = MessageBox.Show("Include machining?", "iLogic", _
MessageBoxButtons.YesNo,MessageBoxIcon.Question)

'get the current parameter value
oCurrentValue = MachDiameter

'set variable to nothing as default
oMsg = ""


Set_Diameter: 

If Answer = vbYes Then

	'set boolean
	Machined = True 
	
	'show feature
	Feature.IsActive("Extrusion3") = Machined
	ThisApplication.ActiveView.Update()

	oDia = InputBox("Enter machining diameter" _
	& vbLf & "( Allowable diameter range: 0.65 to 0.95 )" _
	& vbLf & vbLf & oMsg, _
	"iLogic", oCurrentValue) 	
	
	
	If oDia = "" Then
		'handle null results of Cancel button
		Machined = False 'reset boolean
		Goto Set_Feature
	ElseIf IsNumeric(oDia) = False Then
		'handle non numeric value
		oMsg = "Value must be numeric" _
		& vbLf & "You entered: " & oDia
		Goto Set_Diameter
	ElseIf oDia < 0.65 Or oDia > 0.95 Then
		'handle zero or negative values
		oMsg = "Value not in range." _
		& vbLf & "You entered: " & oDia
		Goto Set_Diameter
	End If	
	
	'set parameter to use input value
	MachDiameter = oDia	
	
ElseIf Answer = vbNo Then
	Machined = False 'set boolean
	Goto Set_Feature
End If


Set_Feature:
	Feature.IsActive("Extrusion3") = Machined

EESignature