Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
alikhan.ganayev
435 Views, 2 Replies

Numbering components

I'm trying to piece a rule together that would number my placed subassemblies correctly. I have a rule where, depending on a user parameter I can change, subassemblies get added or removed if I want less. The specifics about that are not all that important I assume because it works perfectly. It works but the problem is that the number it puts behind the placed components keeps adding up with each add/remove.

ask.PNG

There are always three parts present on each side, no matter the parameter. So one of each: 1.1, 1.2 and 1.3. And its mirror too. The 1.2 part is the one that gets added depending on the user parameter.

ask2.PNG

So I've only been using iLogic since september. I was trying to write a rule that would correctly number the components but I keep getting an error and I can't help but think I'm really screwing up here.  This the rule. Inventor 22/Windows. The error also doesn't say anything useful.

Dim oAsmDoc As AssemblyDocument
    oAsmDoc = ThisApplication.ActiveDocument
Dim oAsmDef As AssemblyComponentDefinition
    oAsmDef = oAsmDoc.ComponentDefinition

Dim oOcc As ComponentOccurrence 
Dim i As Integer = 1

For Each oOcc In oAsmDef.Occurrences
	If oOcc.Type = ObjectTypeEnum.kComponentOccurrenceObject
		oOcc.Name = "99991000 - CBC - Zijwang 1.2_Weld" & ":" & i
		i = i + 1
	End If
Next

 

askerror.PNG

askerror2.PNG

Labels (2)