Restricting excel imported User Parameters to certain combinations - ISO3601 O Rings

Restricting excel imported User Parameters to certain combinations - ISO3601 O Rings

Halleffect24
Advocate Advocate
388 Views
2 Replies
Message 1 of 3

Restricting excel imported User Parameters to certain combinations - ISO3601 O Rings

Halleffect24
Advocate
Advocate

I'm just beginning iLogic and I've managed to create a rule that imports cross section and inner diameter of ISO3601 metric o-rings from an excel spreadsheet. The code creates the 2 user parameters and a corresponding multi value list for each.

 

However, the values are not linked to each other as they should be. e.g. A 0.74 ID O ring should be limited to a 1.02 cross section only but I can pick any cross section available in my list and vice versa. Is there some way to link the values together when I import them? 

 

Here is my code and a portion of the excel spreadsheet I'm using:

 

oDoc.ComponentDefinition
Dim oUPs As UserParameters = oComp.Parameters.UserParameters
Dim oUP As UserParameter

'Set excel filename
Dim xlsFile As String = "C:\Users\domin\OneDrive\Documents\Inventor\iLogic\ISO3601 Metric O Rings.xlsx"
GoExcel.Open(xlsFile, "Sheet1")
oColumn = "B"
oRow = 1
Param = "Start"

Dim List As IList
Do Until Param = ""
	oCell = oColumn & oRow
 Param = GoExcel.CellValue(xlsFile,oSheetName,oCell)
 If Param = "" Then Exit Do
List = GoExcel.CellValues(oColumn & oRow+1,oColumn & oRow+6)
 Try
 Test = oUPs.Item(ParamName).Value
Catch
 oUP = oUPs.AddByExpression(Param, GoExcel.CellValue(oColumn & 2), UnitsTypeEnum.kMillimeterLengthUnits)
End Try
MultiValue.List(Param) = List

'Set the next column
oColumn = Chr(Asc(oColumn)+1)
Loop

 

 

 

0 Likes
Accepted solutions (1)
389 Views
2 Replies
Replies (2)
Message 2 of 3

A.Acheson
Mentor
Mentor
Accepted solution

Will you continue to have the excel file linked? If so you could simply select the ID in multi list then find the cell value and return the appropriate cell. If you just want to store the values in the document you could use a dictionary of string to lock two values together. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 3

Halleffect24
Advocate
Advocate

Thanks for your response. Just thinking aloud here, yes I intend to keep the excel file linked (just like Thread data for Inventor), and your suggestion would solve my issue because the ID is unique (which didn't occur to me until just now)!

 

I'm posting this just out of curiosity for anyone who may answer but what if the ID was not unique and there were 2 ID's for which you could have 2 possible cross sections? I guessing that Inventor must be set up to handle that because when it imports thread data you could have different threads with the same pitch for instance.  I would like to know how to do that.

0 Likes