Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Writing iLogic Code For Patterns

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
ASchlaack
275 Views, 3 Replies

Writing iLogic Code For Patterns

I have a part I need to pattern but the number of times it is patterned is related to a length parameter...

 

If <= 60 in then don't pattern

If 60>X>=120 in then pattern twice

If 120>X>=180 in then pattern three times

If 180>X>=240 in then pattern four times

 

That's what I need to do using the rule... how would this rule be written?

Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram
3 REPLIES 3
Message 2 of 4
ASchlaack
in reply to: ASchlaack

****ADDED****
The length on the part I'm patterning also needs to be controlled...

If <= 60 in then don't pattern AND length = X-6
If 60>X>=120 in then pattern twice AND length = X-9
If 120>X>=180 in then pattern three times AND length = X-12
If 180>X>=240 in then pattern four times AND length = X-15
Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram
Message 3 of 4
MegaJerk
in reply to: ASchlaack

Does this code do it? 

 

''' Things you'll need. 
''' (3) parameters
''' ----------------------------------------------
''' --	Parameter Name -- Type   -- Unit ---------
''' ----------------------------------------------
''' -- someLength      -- Number -- in	 ---------
''' -- finalLength     -- Number -- in	 ---------
''' -- someQty	       -- Number -- ul	 ---------
''' ----------------------------------------------

''' Create the above parameters in your model.
''' The code below should do what you're after. 
''' change the value of 'someLength' to see
''' the changes to your finalLength and Qty!

finalLength = someLength - 6.0
Select Case finalLength

	Case <=60 
		someQty = 1
	Case > 60, <= 120
		someQty = 2 
	Case > 120, <= 180
		someQty = 3
	Case > 180, <= 240 'So there is nothing after 240? 
		someQty = 4
	Case Else
		someQty = 1 '??? Whatever value you want. 
End Select 

 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 4 of 4
ASchlaack
in reply to: MegaJerk

I do believe this code wil work, however I didn't end up using it. I was able to write another that worked. Thank you.

 

If LENGTH <= 60 in Then
		GUARD_PATTERN = 1 ul
		Parameter("15-1-0000 - GUARD_HOLDER:1", "WIDTH") = LENGTH-6.5 in
	End If
	
If LENGTH > 60 And LENGTH <= 120 in Then
		GUARD_PATTERN = 2 ul
		Parameter("15-1-0000 - GUARD_HOLDER:1", "WIDTH") = (LENGTH-10 in)/2
	End If
	
If LENGTH > 120 And LENGTH <= 180 in Then
		GUARD_PATTERN = 3 ul
		Parameter("15-1-0000 - GUARD_HOLDER:1", "WIDTH") = (LENGTH-13.5 in)/3
	End If
	
If LENGTH > 180 And LENGTH <= 240 in Then
		GUARD_PATTERN = 4 ul
		Parameter("15-1-0000 - GUARD_HOLDER:1", "WIDTH") = (LENGTH-17 in)/4
	End If

 

Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram

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

Post to forums  

Autodesk Design & Make Report