Here's the (incredibly verbose and inefficient) iLogic code I'm running that messes with the selection priority. I opened the *.ipt file used in the code by itself, and the selection priority is "Select Bodies".
If I simply place the *.ipt and do a save and replace, the selection priority sticks. Something in this iLogic is the culprit.
What am I missing?
Brandon
Dim oAssembly As AssemblyComponentDefinition
oAssembly = ThisApplication.ActiveDocument.ComponentDefinition
Dim oAssemblyDocument As AssemblyDocument
oAssemblyDocument = ThisDoc.Document
Dim oTransientGeometry As TransientGeometry
oTransientGeometry = ThisApplication.TransientGeometry
Dim oMatrix As Matrix
oMatrix = oTransientGeometry.CreateMatrix
Dim oPath As String
oPath = "G:\rmi Data\Inventor Standards\Master Library\2017 ILogic Parts\"
Dim oFile As String
oFile = "Cab Base 2017.ipt"
Dim oComponentOccurrence As ComponentOccurrence
oMatrix.SetTranslation(oTransientGeometry.CreateVector(oAssembly.Occurrences.Count*50, 0, 0))
oComponentOccurrence = oAssembly.Occurrences.Add(oPath & oFile, oMatrix)
Dim oPartPlane1 As WorkPlane
oPartPlane1 = oComponentOccurrence.Definition.WorkPlanes.Item(2) 'Component XZ Plane
Dim oAssemblyPlane1 As WorkPlane
oAssemblyPlane1 = oAssembly.WorkPlanes.Item(2) 'Assembly XZ Plane
Dim oAssemblyPlane2 As WorkPlaneProxy
oComponentOccurrence.CreateGeometryProxy(oPartPlane1, oAssemblyPlane2)
ThisApplication.ActiveView.Fit
oComponentOccurrence.Edit()
Dim oActiveDocument As Document
oActiveDocument = ThisApplication.ActiveDocument
Dim oEditInPlaceDocument As Document
oEditInPlaceDocument = ThisApplication.ActiveEditDocument
Dim oIProperties As PropertySets
oIProperties = oActiveDocument.PropertySets
Dim oIPropertiesSetSummary As PropertySet
oIPropertiesSetSummary = oIProperties.Item("Inventor Summary Information")
Dim oIPropertiesSetProject As PropertySet
oIPropertiesSetProject = oIProperties.Item("Design Tracking Properties")
Dim oIPropertiesPart As PropertySets
oIPropertiesPart = oEditInPlaceDocument.PropertySets
Dim oIPropertiesPartSetSummary As PropertySet
oIPropertiesPartSetSummary = oIPropertiesPart.Item("Inventor Summary Information")
Dim oIPropertiesPartSetProject As PropertySet
oIPropertiesPartSetProject = oIPropertiesPart.Item("Design Tracking Properties")
Dim oIPropertiesPartSetSummaryB As PropertySet
oIPropertiesPartSetSummaryB = oIPropertiesPart.Item("Inventor Document Summary Information")
Dim oIPropertiesPartSetCustom As PropertySet
oIPropertiesPartSetCustom = oIPropertiesPart.Item("Inventor User Defined Properties")
Dim iFileNameIncrement As Integer
iFileNameIncrement = 1
Dim oNewFileName As String
oNewFileName = oIPropertiesSetProject.Item("Project").Value & " " & oIPropertiesSetProject.Item("Stock Number").Value & " " & oIPropertiesSetProject.Item("Description").Value & " " & oIPropertiesPartSetSummaryB.Item("Category").Value & " " & iFileNameIncrement
Do While My.Computer.FileSystem.FileExists(ThisDoc.Path() & "\" & oNewFileName & ".ipt") = True
iFileNameIncrement = iFileNameIncrement + 1
oNewFileName = oIPropertiesSetProject.Item("Project").Value & " " & oIPropertiesSetProject.Item("Stock Number").Value & " " & oIPropertiesSetProject.Item("Description").Value & " " & oIPropertiesPartSetSummaryB.Item("Category").Value & " " & iFileNameIncrement
Loop
Dim oFileDialog2 As Inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDialog2)
oFileDialog2.Filter = "Autodesk Inventor Part Files (*.ipt)|*.ipt"
oFileDialog2.InitialDirectory = ThisDoc.Path()
oFileDialog2.FileName = ThisDoc.Path() &"\" & oNewFileName
oFileDialog2.CancelError = True
On Error Resume Next
oFileDialog2.ShowSave()
If Err.Number <> 0 Then
MessageBox.Show("Component not saved." & vbCrLf & "Deleting template so you don't edit it.", "The Explanation")
oComponentOccurrence.ExitEdit(63746)
oComponentOccurrence.Delete()
ElseIf oFileDialog2.FileName <> "" Then
MyFile = oFileDialog2.FileName
oEditInPlaceDocument.SaveAs(MyFile, True)
End If
oComponentOccurrence.ExitEdit(63746) 'kExitToParent
oComponentOccurrence.Replace(MyFile, False)
oIPropertiesPartSetSummary.Item("Title").Value = oIPropertiesSetSummary.Item("Title").Value 'Job Name
oIPropertiesPartSetProject.Item("Project").Value = oIPropertiesSetProject.Item("Project").Value 'Job Number
oIPropertiesPartSetProject.Item("Stock Number").Value = oIPropertiesSetProject.Item("Stock Number").Value 'Room Number
oIPropertiesPartSetProject.Item("Description").Value = oIPropertiesSetProject.Item("Description").Value 'Room Name
Dim oParametersComponent As Parameters
Dim oParametersWalls As Parameters
For Each oComponentOccurrence In oAssembly.Occurrences
If oComponentOccurrence.Grounded = True Then
oParametersWalls = oComponentOccurrence.Definition.Parameters
End If
Next
oParametersComponent = oComponentOccurrence.Definition.Parameters
oParametersComponent.UserParameters.Item("WallWidth").Value = oParametersWalls.Item("WallWidth").Value
oParametersComponent.UserParameters.Item("WallLeftWidth").Value = oParametersWalls.Item("WallLeftWidth").Value
oParametersComponent.UserParameters.Item("WallRightWidth").Value = oParametersWalls.Item("WallRightWidth").Value
oComponentOccurrence.Edit()
iLogicVb.RunRule(ThisApplication.ActiveEditDocument.DisplayName, "Launch Form")
iLogicVb.UpdateWhenDone = True