Assembly Events

The AssemblyDelete event notifies the client when a component occurrence or an assembly constraint is deleted from an assembly. _Pre fires before and _Post after the object is deleted.
Other object types are not reported by this event; use [DocumentDelete](<</code_reference/objects/inventor_event_mappings/document_events/documentdelete>) if notifications for other deleted objects are needed.

EventNames:

  • AssemblyDelete_Pre

  • AssemblyDelete_Post

Parameters

Type

Name

Description

Document

document

Object that indicates the document in which the change occurred.

Remarks

Assembly objects currently reported are ComponentOccurrence and AssemblyConstraint objects. The Document.OnDelete event can be used if delete notification is needed for other types of objects.

Examples:

AssemblyDelete_Pre:

Register-InventorEvent -EventName AssemblyDelete_Pre -Action 'PreAssemblyDelete'

function PreAssemblyDelete($document) {
	#Write event code here
}

AssemblyDelete_Post:

Register-InventorEvent -EventName AssemblyDelete_Post -Action 'PostAssemblyDelete'

function PostAssemblyDelete($document) {
	#Write event code here
}

The LoadStateChange event notifies the client whenever an assembly document changes its load state, i.e. goes from lite to full or from full to lite loading. _Pre fires before and _Post after the load state has changed.

EventNames:

  • LoadStateChange_Pre

  • LoadStateChange_Post

Parameters

Type

Name

Description

DocumentLoadStateEnum

newLoadState

Input DocumentLoadStateEnum value indicating the state the document is changing to when the timing kBefore and the current state when the timing is kAfter.

Remarks:

This event can be aborted by throwing an exception inside the action, but only if it is registered with the _Pre suffix.
Throwing an OperationCanceledException aborts the operation without any message.
Throwing any other exception aborts the operation and displays the thrown exception in an Error Message Box.

Examples:

LoadStateChange_Pre:

Register-InventorEvent -EventName LoadStateChange_Pre -Action 'PreLoadStateChange'

function PreLoadStateChange($newLoadState) {
	#Write event code here
}

LoadStateChange_Post:

Register-InventorEvent -EventName LoadStateChange_Post -Action 'PostLoadStateChange'

function PostLoadStateChange($newLoadState) {
	#Write event code here
}

The NewOccurrence event notifies the client whenever a component occurrence is created in an assembly. _Pre fires before and _Post after the occurrence is created.

EventNames:

  • NewOccurrence_Pre

  • NewOccurrence_Post

Examples:

NewOccurrence_Pre:

Register-InventorEvent -EventName NewOccurrence_Pre -Action 'PreNewOccurrence'

function PreNewOccurrence() {
	#Write event code here
}

NewOccurrence_Post:

Register-InventorEvent -EventName NewOccurrence_Post -Action 'PostNewOccurrence'

function PostNewOccurrence() {
	#Write event code here
}

The NewRelationship event notifies the client when a new constraint or connection is added to an assembly. _Pre fires before and _Post after the relationship is created.

EventNames:

  • NewRelationship_Pre

  • NewRelationship_Post

Examples:

NewRelationship_Pre:

Register-InventorEvent -EventName NewRelationship_Pre -Action 'PreNewRelationship'

function PreNewRelationship() {
	#Write event code here
}

NewRelationship_Post:

Register-InventorEvent -EventName NewRelationship_Post -Action 'PostNewRelationship'

function PostNewRelationship() {
	#Write event code here
}

The OccurrenceChange event notifies the client whenever the state of a component occurrence changes. Reported changes are: grounded, adaptive, visible, enabled, suppressed and repositioned (transformed). _Pre fires before and _Post after the occurrence is changed.
At _Pre the original state (for example the transformation) can still be read from the occurrence.

EventNames:

  • OccurrenceChange_Pre

  • OccurrenceChange_Post

Examples:

OccurrenceChange_Pre:

Register-InventorEvent -EventName OccurrenceChange_Pre -Action 'PreOccurrenceChange'

function PreOccurrenceChange() {
	#Write event code here
}

OccurrenceChange_Post:

Register-InventorEvent -EventName OccurrenceChange_Post -Action 'PostOccurrenceChange'

function PostOccurrenceChange() {
	#Write event code here
}