Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

iLogic

jamie.nelson.cubex
Contributor

iLogic

jamie.nelson.cubex
Contributor
Contributor

Hello,

 

I am stuck using inventor iLogic, I understand the action I want iLogic to perform but I am unsure of how to make it do what I want. 

 

I am designing a headbox for one of our products, the headbox has a standard size of 210mmH x 210mmW. However, the headbox changes in size depending on the size of other components (the guides). 

 

The rule i have created so far looks like this:

If structural_opening_width = < 2500 Then 

headbox_depth = 125

headbox_length - 150

End If

 

The issue seems to be with the < sign. Can anyone advise on how to make this work so that if the structural opening is less than 2500 then the part will change to the sizes detailed above? 

 

The next issue to tackle will be that the next size of the headbox is between two sizes, the code might look like this: 

 

If structural_opening_width =  2501>x<5000 Then 

headbox_depth = 150

headbox_length - 150

End If

0 Likes
Reply
260 Views
3 Replies
Replies (3)

J-Camper
Advisor
Advisor

So you aren't using the less than or equal to correctly. See modified code below:

If structural_opening_width <= 2500 'less than or equal to
	headbox_depth = 125
	headbox_length = 150
Else If structural_opening_width <= 5000 'less than or equal to, but does not match the first condition
	headbox_depth = 125
	headbox_length = 150
Else 'None of the conditions matched. Some people don't like using this kind of statement, but it's fine for this kind of aplication
	
End If

 

I added comments to help clarify things, but and if statement will step through each chaeck and act on the first match.  So the first condition is opening being less than or equal to 2500, if that fails it checks the next condition, in this case it is opening is less than or equal to 5000. [and failed the first condition, so the opening is greater than 2500]

 

You keep adding Else If [condition] for each condition you want to check, then you can either end there or add an open Else "Condition", which is only entered if none of the previous condtions work.

 

If you have any other questions feel free to ask.

0 Likes

jamie.nelson.cubex
Contributor
Contributor

Thanks, that seems to have sorted out the initial issue.

 

However, I have run into another problem. I need to add more If statements that will modify the size of the headbox (i have attached the table below to detail what is required). I have created the following code that seems to work for the first four statements, but the sizes do not change as they should.  

 

Is there a better code what i need? 

 

If 	s_o_width <=2500 AndAlso s_o_height <=1500
	headbox_depth = 125
	headbox_length = 150
	
Else If s_o_width >2500.01 <5000 AndAlso s_o_height <=1500
	headbox_depth = 150
	headbox_length = 150
	
Else If s_o_width <=2500 AndAlso s_o_height >1500.01 <3000
	headbox_depth = 150
	headbox_length = 150
	
Else If s_o_width >2500.01 <5000  AndAlso s_o_height >1500.0 <3000
	headbox_depth = 180
	headbox_length = 180

Else If s_o_width <= 2500 AndAlso s_o_height >3000.01 <6000
	headbox_depth = 180
	headbox_length = 180

Else If s_o_width >2500.01 <5000 AndAlso s_o_height >3000.01 <6000
	headbox_depth = 210
	headbox_length = 210
	
Else If s_o_width <= 2500 AndAlso s_o_height >6000.01 <9000
	headbox_depth = 210
	headbox_length = 210
	
Else If s_o_width >2500.01 <5000 AndAlso s_o_height >6000.01 <9000
	headbox_depth = 230
	headbox_length = 230
	
Else If s_o_width <= 2500 AndAlso s_o_height >9000.01 <12000
	headbox_depth = 230
	headbox_length = 230

Else If s_o_width >2500.01 <5000 Andalso s_o_height >9000.01 <12000
	headbox_depth = 250
	headbox_length = 250
	
End If

 

 

0 Likes

J-Camper
Advisor
Advisor

This would be a good one to use nested If Statements:

'Nesting If Statements Example:

If s_o_width <= 2500 'If Level 1
	
	If  s_o_height <= 1500 'If Level 2-A
		headbox_depth = 125
		headbox_length = 150
		
	Else If s_o_height <= 3000 'Else If Level 2-A
		headbox_depth = 150
		headbox_length = 150
		
	Else If s_o_height <= 6000 'Else If Level 2-A
		headbox_depth = 180
		headbox_length = 180
		
	Else If s_o_height <= 9000 'Else If Level 2-A	
		headbox_depth = 210
		headbox_length = 210
		
	Else If s_o_height <= 12000 'Else If Level 2-A	
		headbox_depth = 230
		headbox_length = 230
		
	Else 'Else Level 2-A
		MessageBox.Show("s_o_height is Greater than 12000")
		
	End If	'End Level 2-A
	
Else If s_o_width < 5000 'Else If Level 1
	
	If  s_o_height <= 1500 'If Level 2-B
		headbox_depth = 150
		headbox_length = 150
		
	Else If s_o_height <= 3000 'Else If Level 2-B
		headbox_depth = 180
		headbox_length = 180
		
	Else If s_o_height <= 6000 'Else If Level 2-B
		headbox_depth = 210
		headbox_length = 210
		
	Else If s_o_height <= 9000 'Else If Level 2-B	
		headbox_depth = 230
		headbox_length = 230
		
	Else If s_o_height <= 12000 'Else If Level 2-B	
		headbox_depth = 250
		headbox_length = 250
		
	Else 'Else Level 2-B
		MessageBox.Show("s_o_height is Greater than 12000")
		
	End If	'End Level 2-B
	
Else 'Else Level 1
	MessageBox.Show("s_o_width is Greater than 5000")
	
End If 'End Level 1

 

If level 1 handles the 2 width options and then there is a level 2 if statement in each to handle the 5 height options. 

 

Let me know if you have any questions, or if this is not working as intended

0 Likes