Rocky is correct that there isn't a specific event to notify you when the end of part marker is moved. However there are some higher level events that you can sometime use to respond to more granular activity within Inventor. Here's a small prototype is used to test handling the end of part marker change. It's reacting to the OnDocumentChange event which occurrs when any change at all occurs within a document. It provides some context about what the change is and in this case reports it as a "Reorder Feature" operation. To determine if it's a standard feature reorder or an end of part marker change I check the position of the end of part marker before and after the change and if it's moved then I assume the end of part marker has changed. If it has changed then it reports all of the features in the tree after it.
To test this create a new form in VBA. Select the form and in the Properties window set the ShowModal property to False. Copy the code below into the code window for the form. Run the form and move the end of part marker. It should report the change.
I wouldn't recommend implementing your final version of this in VBA, but it is a good way to quickly test something, like I've done here.
Private WithEvents appEvents As ApplicationEvents
Private currentAfter As Object
Private currentBefore As Object
Private Sub appEvents_OnDocumentChange(ByVal DocumentObject As Document, ByVal BeforeOrAfter As EventTimingEnum, ByVal ReasonsForChange As CommandTypesEnum, ByVal Context As NameValueMap, HandlingCode As HandlingCodeEnum)
If Context.count > 0 Then
If Context.value("InternalName") = "Reorder Feature" Then
Dim partDoc As PartDocument
If BeforeOrAfter = kBefore Then
' Record the current position of the end of part marker.
Set partDoc = DocumentObject
Call partDoc.ComponentDefinition.GetEndOfPartPosition(currentBefore, currentAfter)
Else
Set partDoc = DocumentObject
Dim newAfter As Object
Dim newBefore As Object
Call partDoc.ComponentDefinition.GetEndOfPartPosition(newBefore, newAfter)
Dim featureList As String
If Not newAfter Is Nothing Then
' Check to see if it's changed.
Dim bFoundFeature As Boolean
bFoundFeature = False
If Not currentBefore Is newBefore Or Not currentAfter Is newAfter Then
' Build a list of the features after the end of part marker.
Dim featureNode As BrowserNode
For Each featureNode In partDoc.BrowserPanes.ActivePane.TopNode.BrowserNodes
If Not featureNode.NativeObject Is Nothing Then
If TypeOf featureNode.NativeObject Is PartFeature Or TypeOf featureNode.NativeObject Is WorkPlane Or TypeOf featureNode.NativeObject Is WorkAxis Or TypeOf featureNode.NativeObject Is WorkPoint Then
Dim nativeFeature As Object
Set nativeFeature = featureNode.NativeObject
If nativeFeature Is newAfter Then
bFoundFeature = True
End If
If bFoundFeature Then
If featureList = "" Then
featureList = " " & nativeFeature.Name
Else
featureList = featureList & vbCrLf & " " & nativeFeature.Name
End If
End If
End If
End If
Next
End If
Set currentAfter = Nothing
Set currentBefore = Nothing
MsgBox "Features after end of part marker: " & vbCrLf & featureList
Debug.Print ""
Debug.Print "Features after end of part marker: " & vbCrLf & featureList
Else
MsgBox "No features are after the end of part marker."
End If
End If
End If
End If
End Sub
Private Sub UserForm_Initialize()
Set appEvents = ThisApplication.ApplicationEvents
End Sub