Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
karthur1
in reply to: karthur1

I had an idea of rather than searching the table for the correct value, I would just tell it what value to set it to. It seems that the command 

"iPart.ChangeRow("iComponentName:1", "RowMemberName")  "  would do exactly what I need.  The code would work something like this.

 

Start with the first iPart.. Get its Component Name and length.  Add the increment to the length.... then change this with the "iPart.ChangeRow " command.  Go to the next part in the assembly and do the same thing.  Continue until all the parts are changed.

 

I can get this code to work for the first part, but then it errors out when it gets to the second part.  The "Lista" variable is the component browser name.

 

I am probably going about this all wrong. Any Suggestions?

 

Thanks,

Kirk

 

 

SyntaxEditor Code Snippet

oLength = InputBox("Enter the length change (+ or -)in inches.", "iLogic", "0.25")
Dim oAsmDoc as Inventor.AssemblyDocument
oAsmDoc = ThisDoc.Document
Dim comp As Inventor.ComponentOccurrence 
        Lista = ""
        For Each oOcc In ThisApplication.ActiveDocument.ComponentDefinition.Occurrences.AllLeafOccurrences
            Lista=oOcc.Name        
        MsgBox(Lista)
    
            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
            MsgBox("New Size==> " & MemberStringValue & " Current RowName==> " & rowname & " New Length ==> "& NewLength)
            'MsgBox("Size==> " & MemberStringValue & " RowName==> " & iPart.RowName(comp.Name) & " New Length ==> "& NewLength)
            'MemberStringValue = iPart.CurrentRowStringValue("Stock Number") & "-" & iPart.CurrentRowValue("Cutlength") + oLength
            iPart.ChangeRow(Lista, MemberStringValue)
            
            'iPart.ChangeRow("iComponentName:1", "RowMemberName")
            
            'i = iPart.FindRow(comp.Name, "Member", "=", MemberStringValue) 
             Next
            
    If i < 0 Then
        MessageBox.Show("Some problem occurred", "iLogic")
    Else
        'MessageBox.Show("iPart set to row: " & MemberStringValue , "Change ALL members iLogic")
    End If
Next