Driving several parameters in an assembly/parts from an excel table.

Driving several parameters in an assembly/parts from an excel table.

peter
Contributor Contributor
259 Views
3 Replies
Message 1 of 4

Driving several parameters in an assembly/parts from an excel table.

peter
Contributor
Contributor

Im making an iLogic configurator  for a part in a tubing system. It comes in several sizes and wallthicknesses, and I would like to drive it from an excel table. For the time being there is only 2 configurations, but over time many more will follow.

I cannot figure out wow to do this the easy/right way. I can do it using a Multi Value parameter in the parameters, and then a lot of if-statements. But this will be a nightmare to change later. So an spreadsheet driven method is what im after.

 

Anyone who has got a suggestion, or a link to a guide?
I need to drive the following parameters. Name is the text I would like to selet in my iLogic configurator form. The other fields are numeric fields.

peter_0-1654970890974.png


Regards

Peter

0 Likes
260 Views
3 Replies
Replies (3)
Message 2 of 4

A.Acheson
Mentor
Mentor

Having the excel table is convenient to store the data  but it still needs to get to the user and be presented using a  parameter and form then  be processed by the user.  

If you have a unique identifier then that is the easiest way  to find the row similar to the member in an ipart. 

Edit:

Option:1 Search excel file column "Name" for value.

Here the user selects the parameter from Drop down then the rule will run and look for the value in the excel table and return parameter values. 

 

XlFile = "C:\......ENTER PATH.......\.xlsx"
GoExcel.Open(XlFile, "Sheet1")

'Import Excel content to Multi Value Parameter all ready created. 
MultiValue.List("Name") = GoExcel.CellValues("A2", "A10")
MultiValue.List("Diameter") = GoExcel.CellValues("B2", "B10")
MultiValue.List("WallThickness") = GoExcel.CellValues( "C2", "D10")
MultiValue.List("Length") = GoExcel.CellValues("D2", "D10")

'Get the row that matches the user selected parameter
i = GoExcel.FindRow(XlFile, "BOM","Item", "=", Name)

'Assign the other Parameters based on finding the row. 
Diameter = GoExcel.CurrentRowValue("Diameter")
WallThickness = GoExcel.CurrentRowValue("WallThickness")
Length = GoExcel.CurrentRowValue("Length") MessageBox.Show(Diameter & "-" & WallThickness & "-" & Length, "Title")

Option:2 Direct reference excel cells with parameters.

If statements or Case statements method where case statements are easier to write.

Case Statements

XlFile = "C:\......ENTER PATH.......\.xlsx"
GoExcel.Open(XlFile, "BOM")

'Import Excel content to Multi Value Parameter all ready created. 
MultiValue.List("Name") = GoExcel.CellValues("A2", "A10")
MultiValue.List("Diameter") = GoExcel.CellValues("B2", "B10")
MultiValue.List("WallThickness") = GoExcel.CellValues( "C2", "D10")
MultiValue.List("Length") = GoExcel.CellValues("D2", "D10")

	
Select Case Name
Case GoExcel.CellValue("A2")
	MessageBox.Show(GoExcel.CellValue("B2"), "Title")
Case GoExcel.CellValue("A3")
	MessageBox.Show(GoExcel.CellValue("B3"), "Title")
End Select

 

 

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 4

peter
Contributor
Contributor

 A.Acheson

Thanks for the reply. Im not yet sure it is the path I want to follow. It looks overcomplicated. and Im looking for a simple solution.

I have seen an easier solution (about 8-9 years ago) that did the trick, and was quite simple, so I better look out for that again.

The problem is not your solution, but the logic needs some maintanance later. And I will not see the code again after I deliver the files. So Simple is the best.
But thank you for your time

0 Likes
Message 4 of 4

A.Acheson
Mentor
Mentor

I cleared up the original post with option 1 and 2. Option 1 is by far the easiest as long as the excel file exists in given path and the parameters exist in the file the rest is maintenance free apart from adding new variables in the excel sheet. The only down side I see is sometimes the speed of go excel can be questionable at times. 

 

An alternate method is just to create an ipart and switch the member by ilogic. This way all there references are in the ipart factory table and not in an external excel file. 

 

If you one more advice/solutions can you please attach more information of the restrictions your going to face in implementing the configurator. A sample set of files is always handy with some images. 

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