iLogic look up table without Excel

iLogic look up table without Excel

Anonymous
Not applicable
1,709 Views
16 Replies
Message 1 of 17

iLogic look up table without Excel

Anonymous
Not applicable

I'm trying to create an ilogic lookup table without using excel.  We have a machine with several flanges on it and I want to put the design parameters of the flange like OD, Hole size, Hole QTY, etc. to reference for each flange.

 

I thought about using case, but I dont think you can use it for different parameters this is a simplified example of what I am trying to do.

FlangeA=multiselect value (3,4,5)

FlangeB=MultiSelect Value (3,4,5)

 

Each flange needs 3 parameters, OD, ID, and HoleD

 

I'm trying to populate all these values by just selecting the size on each mutiselect pull down

FlangeA_OD, FlangeA_ID, FlangeA_HoleD

FlangeB_OD, FlangeB_ID, FlangeB_HoleD

 

So if Flange A is 3 it looks up the values it needs and feeds them to the FlangeA_ parameters, and Flange B is 4 it looks up the values it needs and feeds them to the FlangeB_ parameters


What I'm trying to prevent from doing is this:

If FlangeA=3 then FlangeA_OD=1 : FlangeA_ID=2:  FlangeA_HoleD=.5

If FlangeA=4 then FlangeA_OD=2 : FlangeA_ID=3:  FlangeA_HoleD=.75

If FlangeA=5 then FlangeA_OD=3 : FlangeA_ID=4:  FlangeA_HoleD=1

 

If FlangeB=3 then FlangeB_OD=1 : FlangeB_ID=2:  FlangeB_HoleD=.5

If FlangeB=4 then FlangeB_OD=2 : FlangeB_ID=3:  FlangeB_HoleD=.75

If FlangeB=5 then FlangeB_OD=3 : FlangeB_ID=4:  FlangeB_HoleD=1

 

Again, this is a simplified version so there are many more sizes and many more parameters. I know this can be done with excel but it is very slow to do it this way on our model. And I'd like to keep it all in ilogic.

 

 

0 Likes
Accepted solutions (2)
1,710 Views
16 Replies
Replies (16)
Message 2 of 17

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous 

 

This is how I've handled this type of thing in the past.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum  where there are more programming related discussions
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

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

 

 

'table data
Dim oList As New ArrayList
'FlangeA Size | FlangeA_OD | FlangeA_ID | FlangeA_HoleD
oList.Add(3 & "|" & 1 & "|" & 2 & "|" & 0.50)
oList.Add(4 & "|" & 2 & "|" & 3 & "|" & 0.75)
oList.Add(5 & "|" & 3 & "|" & 4 & "|" & 1.00)
oList.Add(6 & "|" & 4 & "|" & 5 & "|" & 1.25)
oList.Add(7 & "|" & 5 & "|" & 6 & "|" & 1.50)
oList.Add(8 & "|" & 6 & "|" & 7 & "|" & 1.75)
oList.Add(9 & "|" & 7 & "|" & 8 & "|" & 2.00)

'Look at each row
For Each oRow In oList
	'split the string using the vertical bar char
	oValues = Split(oRow, "|")	

'set the flange parameters 
	If oValues(0) = Parameter("FlangeA") Then
		Parameter("FlangeA_OD") = oValues(1) 
		Parameter("FlangeA_ID") = oValues(2) 
		Parameter("FlangeA_HoleD")  = oValues(3) 
	End If
Next

 

 

EESignature

0 Likes
Message 3 of 17

johnsonshiue
Community Manager
Community Manager

Hi! I am wondering if you could leverage LibXL. In certain Excel workflows, Inventor does read the spreadsheet via LibXL without having to launch Excel.exe.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 4 of 17

Anonymous
Not applicable

Thank you, for the tip about the Inventor Customization forum.  I think this is just what I'm looking for. So if I wanted to set the parameters for FlangeB, FlangeC ... FlangeX. etc.

 

I would replicate this block for each flange?

 

'set the flange parameters 
	If oValues(0) = Parameter("FlangeX") Then
		Parameter("FlangeX_OD") = oValues(1) 
		Parameter("FlangeX_ID") = oValues(2) 
		Parameter("FlangeX_HoleD")  = oValues(3) 
	End If
Next

 

 

0 Likes
Message 5 of 17

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous 

 

I'd probably do it something like this.

 

The oTriggers are just to get the rule to run when those parameters are changed in a form... that might or might not apply to your situation.

 

I padded the values with trailing zeros, etc just to keep things lined up, but that's just for ease of reading and isn't required.

 

I'd set up a throwaway spreadsheet to create the table data, and then paste that into the rule, see the attached zip file containing the file called Format List.xlsx file for an example.

 

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

 

 

 

 

 

 

oTrigger = FlangeB
oTrigger = FlangeA
'table data
Dim oList As New ArrayList
'Flange Name | Flange Size | Flange OD | Flange ID | Flange HoleD
'values    0           1            2            3            4
oList.Add("A" & "|" & 3.00 & "|" & 1.00 & "|" & 2.00 & "|" & 0.50)
oList.Add("A" & "|" & 4.00 & "|" & 2.00 & "|" & 3.00 & "|" & 0.75)
oList.Add("A" & "|" & 5.00 & "|" & 3.00 & "|" & 4.00 & "|" & 1.00)
oList.Add("A" & "|" & 6.00 & "|" & 4.00 & "|" & 5.00 & "|" & 1.25)
oList.Add("A" & "|" & 7.00 & "|" & 5.00 & "|" & 6.00 & "|" & 1.50)
oList.Add("A" & "|" & 8.00 & "|" & 6.00 & "|" & 7.00 & "|" & 1.75)
oList.Add("B" & "|" & 3.20 & "|" & 1.30 & "|" & 2.10 & "|" & 2.00)
oList.Add("B" & "|" & 4.20 & "|" & 2.30 & "|" & 3.10 & "|" & 2.25)
oList.Add("B" & "|" & 5.20 & "|" & 3.30 & "|" & 4.10 & "|" & 2.50)
oList.Add("B" & "|" & 6.20 & "|" & 4.30 & "|" & 5.10 & "|" & 2.75)
oList.Add("B" & "|" & 7.20 & "|" & 5.30 & "|" & 6.10 & "|" & 3.00)



'Look at each row
For Each oRow In oList
	'split the string using the vertical bar char
	oValues = Split(oRow, "|")
	
	'get the first value in the array and use it as the lookup key
	' this is the Letter A, B, etc
	oKey = oValues(0) 

	'set the flange parameters by plugging the key/letter into the paramter names
	'example: "Flange" & oKey = FlangeA, where oKey is A
	If oValues(1) = Parameter("Flange" & oKey) Then
		Parameter("Flange" & oKey) = oValues(1) 
		Parameter("Flange"& oKey & "_OD") = oValues(2) 
		Parameter("Flange"& oKey & "_ID") = oValues(3) 
		Parameter("Flange"& oKey & "_HoleD")  = oValues(4) 
	End If
Next

 

 

 

 

 

 

EESignature

0 Likes
Message 6 of 17

Anonymous
Not applicable

Sorry, I think I did a bad job explaining what I was trying to do.  I should have probably just shown what I was actually trying to do from the start.  I'm trying to basically put  this table into ilogic https://www.engineeringtoolbox.com/flanges-bolts-dimensions-d_464.html

There is an ANSI standard flange and our machine has several of these on it, and they can all change size.  They will all  be one of the flanges on this list though. 

So if FlangeA=6, then it would go to that table and pull the required dimensions for FlangeA_OD, FlangeA_ID, etc.  Also if FlangeB=6 (or 4 or whatever) it will pull FlangeB_OD, and FlangeB_ID, etc from the same list.  based on what FlangeB is.

0 Likes
Message 7 of 17

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous 

 

What version of Inventor are you running? I might be able to provide an example file, showing how this works...

 

I might still be misunderstanding, but I think this approach can be used for your task.

 

 

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

EESignature

0 Likes
Message 8 of 17

Anonymous
Not applicable

Hi @Curtis_Waguespack ,

    Thank you for all the attention to this, I really appreciate it. I'm on Inventor 2021.  I have spent some time and created a simplified version of our model with 3 flanges I think it shows what I'm trying to accomplish.  For proprietary reasons I cant share the actual model, but I think this gets the point across.  Just imagine more flanges and pipes 🙂

     There is an ilogic form that lets you pick flange sizes for 1 Inlet and 2 Effluent pipes then I've created an ilogic rule with information for each flange.  The data is duplicated on all 3 flanges but with different parameter names attached to it.  What I'd like to do is just put that information in an ilogic table once and then based on what parameter is selected for each flange, it would query the table for the rest of the parameters.  This way the data is only entered in one place and all the flanges reference the same data.  I hope this clarifies it.

0 Likes
Message 9 of 17

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous 

 

Unofrtunatley I don't have 2021 on this machine, but I have 2019, 2020 and 2022, so I could look at your file in 2022, but couldn't make changes that you can access. But here is a quick example in 2019... but its an assembly file.

 

I would expect this to be an assembly, unless there is a very compelling reason to do this as a single part file. 

 

The problem with making it a part file, is that it becomes a house of cards, particularly when we try to make it dynamic with automation via iLogic.

 

In any case here is a example as an assembly in inventor 2019. If you must have it as a single part, I can put together a quick example later.

 

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

EESignature

0 Likes
Message 10 of 17

Anonymous
Not applicable

Wow that is quite the awesome form/model.  This is part of a larger more complex multi solid body model that the bodies are exported to separate parts. That would be extremely helpful if you could think of a way that it could be done in the part.

Message 11 of 17

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @Anonymous 

 

Here's a part version of this, it's pretty much the same as the assembly version as far as creating a "lookup table"...

 

again, since you're going to be doing a lot of this, I'd use a throw away spreadsheet to create the list rows and copy and paste that into the rule... see the one in my previous post as an example.

 

Curtis_W_0-1622751252193.png

 

 

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

EESignature

Message 12 of 17

Anonymous
Not applicable

Awesome! Thank you so much I think this will save me a lot of time.

Message 13 of 17

Anonymous
Not applicable

Hey @Curtis_Waguespack 

I think I've got it close, but for some reason its throwing me an error when I try to run the code.  Would you be able to take a look and see what I'm doing wrong?

0 Likes
Message 14 of 17

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous 

 

I loaded Inventor 2021 yesterday, so I was able to make some edits to your model... here it is... I put some notes in the code.

 

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

 

 

EESignature

0 Likes
Message 15 of 17

Anonymous
Not applicable

Hi @Curtis_Waguespack ,

Thanks for looking at the file, I think the same file may have got uploaded.  There doesn't seem to be any changes.

Message 16 of 17

Curtis_Waguespack
Consultant
Consultant
Accepted solution

ooops! 🙄

 

try this one 

EESignature

Message 17 of 17

Anonymous
Not applicable

@Curtis_Waguespack This is exactly what I was trying to do Thank you so much!  There were a couple parameters that I missed on the inlet pipe that you noted.  I've uploaded the final corrected model in case anyone would find this useful in the future.  Thank you so much for the help, it is greatly appreciated!