Weird, if i place it in a new assembly, it works fine. Here's the entire rule I'm using to create the virtual components. Maybe there's something in how I'm creating them giving problems. In this code its looking at features in a single part, testing whether the feature is active and creating a virtual component.
Dim oAsm As AssemblyDocument = ThisDoc.Document
Dim oMatrix As Matrix = ThisApplication.TransientGeometry.CreateMatrix
deleteall = New String(){"PUB_Left_Side", "PUB_Right_Side", "PUB_Top_Stretcher", "PUB_Top_Rear_Stretcher", "PUB_Full_Subtop", "PUB_Back", "PUB_Shelf_Hardwood_Edge", "PUB_Toe_Kick", "PUB_Right_Toe", "PUB_Left_Toe", "PUB_Rear_Toe", "PUB_Flush_Toe", "PUB_Sink_Apron", "PUB_Adjustable_Shelf"}
For Each element In deleteall
Try
Component.InventorComponent(Replace(element, "PUB_", "") & ":1").delete
Catch ex As exception
End Try
Next
addactive = New String(){"PUB_Left_Side", "PUB_Right_Side", "PUB_Top_Stretcher", "PUB_Top_Rear_Stretcher", "PUB_Full_Subtop", "PUB_Back", "PUB_Shelf_Hardwood_Edge", "PUB_Toe_Kick", "PUB_Right_Toe", "PUB_Left_Toe", "PUB_Rear_Toe", "PUB_Flush_Toe", "PUB_Sink_Apron", "PUB_Adjustable_Shelf"}
occur = 0
For Each element In addactive
Try
If Feature.IsActive("toplevel_notes", element) = True Then
Try
occur = occur + 1
Dim oOcc As ComponentOccurrence
oOcc = oAsm.ComponentDefinition.Occurrences.AddVirtual(Replace(element, "PUB_", ""), oMatrix)
Dim oCompDefVirtual As VirtualComponentDefinition = oOcc.Definition
iProperties.Value(Replace(element, "PUB_", "") & ":1", "Custom", "Component_Width") = Parameter("toplevel_notes", Replace(element, "PUB_", "") & "_Wt")
iProperties.Value(Replace(element, "PUB_", "") & ":1", "Custom", "Component_Length") = Parameter("toplevel_notes", Replace(element, "PUB_", "") & "_Lt")
iProperties.Value(Replace(element, "PUB_", "") & ":1", "Custom", "Component_Thickness") = Parameter("toplevel_notes", Replace(element, "PUB_", "") & "_Th")
iProperties.Value(Replace(element, "PUB_", "") & ":1", "Custom", "Part_Description") = Replace(Replace(element, "PUB_", ""), "_", " ")
Catch ex As exception
MessageBox.Show("Error in assigning " & element & " properties", "Warning!")
End Try
End If
Catch ex As exception
MessageBox.Show("The feature named " & element & " was not found.", "Warning!")
End Try
Next
a virtual part if active.