iPart rows names problem

iPart rows names problem

Daan_M
Collaborator Collaborator
455 Views
4 Replies
Message 1 of 5

iPart rows names problem

Daan_M
Collaborator
Collaborator

Good morning!

 

I've ran into a problem working with iParts. I located the problem and it was kinda funny once i realized what caused it. I made iPart members with a certain numirical code, consisting of 5 digits in total  (xxx,xx). In a assembly i swap between the iPart variants by filling in the according 5 digit code in Excel.

 

The problem: Everytime i filled in a 5 digit code in Excel, it seemed to swap to a completely random part and not the part with the according code. See the iLogic below.

 

forum2.PNG

The cause: Inventor takes the 5 digit Excel code, and instead of looking for the right membername, it starts looking for a the memberrow. So when i fill in code 197,05, instead of finding the membername '197,05', it goes to row 197 which is code '245,05', see the picture below.

 

forum.PNG

 

Now is there a easy fix for this? Can i tell iLogic to look for member name instead of member row?

It would save me alot of time, otherwise i have to rewrite my 5 digit code to alphabetical characters.

 

Cheers, Daan

 

0 Likes
Accepted solutions (1)
456 Views
4 Replies
Replies (4)
Message 2 of 5

JhoelForshav
Mentor
Mentor

Hi @Daan_M 

You can use iPart.FindRow. It automatically changes to the found row aswell. So all you need is something like this to change the row:

iPart.FindRow("Compactmotor", "Member", "=", GoExcel.CellValue(Excelfile, "Sheet1", "B3"))
Message 3 of 5

Daan_M
Collaborator
Collaborator

Thank you for the reply, i think your solution is fitting, but theres a new problem that comes up. See the error message below. Below the pictures ive also posted the entire code.

 

 

 

 

Capture2.PNGCapture.PNG

 

 

Excelfile = "C:\Users\Administrator\EMS source.xlsx"

Kasttype = GoExcel.CellValue(Excelfile, "Sheet1" ,"D2")

Dim occ As ComponentOccurrence
Dim ass As AssemblyDocument
ass = ThisDoc.Document

For Each occ In ass.ComponentDefinition.Occurrences
If occ.Name.StartsWith("kast") Then
occ.Suppress
End If

If occ.Name = "kast"&Kasttype Then  
occ.Unsuppress
End If
Next


iPart.FindRow("Compactmotor",  "Member", "=", GoExcel.CellValue(Excelfile, "Sheet1", "B3"))
iPart.FindRow("kast"&Kasttype, "Member", "=", GoExcel.CellValue(Excelfile, "Sheet1", "E2"))

d2 = GoExcel.CellValue(Excelfile, "Sheet1", "B5")

iLogicVb.UpdateWhenDone = True

Excelnamevalue = GoExcel.CellValue(Excelfile, "Sheet1", "B6")
Stepfilename = Excelnamevalue
ThisDoc.Document.SaveAs("C:\Data\Output\" & Stepfilename & ".stp", True)
0 Likes
Message 4 of 5

JhoelForshav
Mentor
Mentor
Accepted solution

@Daan_M 

Maybe your exceldocument doesn't return a string and thats the problem...

Try using .ToString and see if it helps.

iPart.FindRow("Compactmotor",  "Member", "=", GoExcel.CellValue(Excelfile, "Sheet1", "B3").ToString)
Message 5 of 5

Daan_M
Collaborator
Collaborator

That made it work! Thank you for the quick and helpfull support.