- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Maybe, you can save the row into a variable. And then refer to that variable instead of looking into the table's current row. Don't know if it would do much. But maybe a little.
Dim iPartRow As iPartTableRow
What I don't quite understand, is this line. Does it also activate the new found row?
i = iPart.FindRow(comp.Name, "Member", "=", MemberStringValue)
Maybe you can shorten you code a little. The rowName varaible is unused? you should delete or comment it out.
This is you loop;
Dim comp As Inventor.ComponentOccurrence
For Each comp In oAsmDoc.ComponentDefinition.Occurrences
rowName = iPart.RowName(comp.Name)
RowValue = iPart.CurrentRowValue("Cutlength")
StockNoStringValue = iPart.CurrentRowStringValue("Stock Number")
NewLength = RowValue + oLength
MemberStringValue = StockNoStringValue & "-" & NewLength
i = iPart.FindRow(comp.Name, "Member", "=", MemberStringValue)
If i < 0 Then
MessageBox.Show("Some problem occurred", "iLogic")
Else
'MessageBox.Show("iPart set to row: " & MemberStringValue , "Change ALL members iLogic")
End If
NextIn short it could also be this, same effect ( haven't tested it ).
Also I have no idea if this has a real impact on the speed. But you could give it a shot. (let me know the result, i'm just learning to code efficiently myself).
Dim comp As Inventor.ComponentOccurrence
For Each comp In oAsmDoc.ComponentDefinition.Occurrences
MemberStringValue = iPart.CurrentRowStringValue("Stock Number") & "-" & iPart.CurrentRowValue("Cutlength") + oLength
i = iPart.FindRow(comp.Name, "Member", "=", MemberStringValue)
If i < 0 Then
MessageBox.Show("Some problem occurred", "iLogic")
Else
'MessageBox.Show("iPart set to row: " & MemberStringValue , "Change ALL members iLogic")
End If
NextI also have a question about the IF ELSE END IF statement on the end.
i = the row number and when there is a error, it goes to -1 or how does this check work? I don't have a clue ![]()
i = iPart.FindRow(comp.Name, "Member", "=", MemberStringValue)
If i < 0 Then
MessageBox.Show("Some problem occurred", "iLogic")
Else
'MessageBox.Show("iPart set to row: " & MemberStringValue , "Change ALL members iLogic")
End IfHope you find this post helpfull.
Please kudo if this post was helpfull
Please accept as solution if your problem was solved
Inventor 2014 SP2