Inventor General Discussion

Inventor General Discussion

Reply
Member
5 Posts
0 Kudos
Registered: ‎02-19-2013
Post 1 of 3
Accepted Solution

iLogic range between two numbers; not working

467 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*
2,546 Posts
891 Kudos
Registered: ‎09-13-2011
Post 2 of 3

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
5 Posts
0 Kudos
Registered: ‎02-19-2013
Post 3 of 3

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
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!