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

Hi Kirk,

 

Thanks for sending the assembly. Here is the iLogic rule that works for me. (no error about missing occurrence) Not exactly sure this is what you want.

 

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
			'WB commented above, it helps me to have a variable name that indicates what the varible is
			occName = oOcc.Name
			
			'WB added - just wanted to see the names of the occurrences and exit
			'MsgBox("occName = " & occName)
		'Next
		'Return

	        'WB commented, not sure what this for loop was supposed to do
			'For Each comp In oAsmDoc.ComponentDefinition.Occurrences
		        'WB commented 
				'rowName = iPart.RowName(comp.Name)
				rowName = iPart.RowName(occName)
				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)
				MsgBox("occName = " & occName & " Changing to " & MemberStringValue)
				iPart.ChangeRow(occName, 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
	
		'WB commented
		'Next

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network