Inventor General Discussion

Inventor General Discussion

Reply
Member
RemcoVerschuren
Posts: 5
Registered: ‎02-19-2013
Message 1 of 3 (454 Views)
Accepted Solution

iLogic range between two numbers; not working

454 Views, 2 Replies
04-03-2013 03:05 AM

Hi,

 

I would like to use the if else parameter in iLogic to set up a range, but I'm not getting it right.

Maybe you got any idea?

 

What should happen:

 

if the variable 'breedte' is:

 

-       0 up to 3800; thats OK

- 3800 up to 4000; thats not OK, use 3800 instead

- 4000 and up; thats OK

 

Therefore I wrote this script, but when I enter a number between 3800 and 4000 (like 3900), the MessageBox appears (thats good), but the size of my solid results in 3900, instead of 3800.

 

breedte = InputBox("What is the breedte?", "Hoofdmaten", "")
	Parameter("skelet.ipt.breedte")=breedte

If breedte <= 3800 Then
  breedte = breedte

Else If breedte >= 4000 Then
  breedte = breedte

Else If (breedte >= 3801) AndAlso (breedte <= 4000) Then
  breedte = 3800
  MessageBox.Show("This breedte is not possible." & hoogte & vbCr & "The value of 3800 will be used instead.", "Problem message", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk)
  
End If

 

 

Well I would write this as :

 

breedte = InputBox("What is the breedte?", "Hoofdmaten", "")
If breedte > 3800 and breedte < 4000 Then
breedte = 3800
MessageBox.Show("This breedte is not possible." & hoogte & vbCr & "The value of 3800 will be used instead.", "Problem message", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk)
End If
Parameter("skelet.ipt.breedte")=breedte

 

I think the issue is from setting the value in your skeleton part before you did your error check.

*Expert Elite*
mrattray
Posts: 2,538
Registered: ‎09-13-2011
Message 2 of 3 (437 Views)

Re: iLogic range between two numbers; not working

04-03-2013 04:27 AM in reply to: RemcoVerschuren

Well I would write this as :

 

breedte = InputBox("What is the breedte?", "Hoofdmaten", "")

If breedte > 3800 and breedte < 4000 Then
  breedte = 3800
  MessageBox.Show("This breedte is not possible." & hoogte & vbCr & "The value of 3800 will be used instead.", "Problem message", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk)
End If

Parameter("skelet.ipt.breedte")=breedte

 

I think the issue is from setting the value in your skeleton part before you did your error check.

Mike (not Matt) Rattray

Member
RemcoVerschuren
Posts: 5
Registered: ‎02-19-2013
Message 3 of 3 (430 Views)

Re: iLogic range between two numbers; not working

04-03-2013 04:35 AM in reply to: mrattray

Great!

Moving the Parameter rule is solving the problem.

 

Thanks mrattray :smileywink:

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.